• Home
Name Date Size #Lines LOC

..--

README.mdD03-May-20243.1 KiB12378

gerrit.pyD03-May-202411 KiB388254

repo_patch.pyD03-May-20242.4 KiB7943

repo_pull.pyD03-May-202414 KiB436306

repo_review.pyD03-May-20249 KiB270190

README.md

1Repo Pull
2=========
3
4`repo_pull.py` pulls multiple change lists from a Gerrit code review website.
5A user may specify a query string and `repo_pull.py` will pull the matching
6change lists.
7
8For example, to pull the `repo-pull-initial-cl` topic from AOSP, run this
9command:
10
11    repo_pull.py pull 'topic:repo-pull-initial-cl' \
12        -g https://android-review.googlesource.com
13
14Read [Usage](#Usages) and [Examples](#Examples) for more details.
15
16
17## Installation
18
19`repo_pull.py` requires `.gitcookies` to access Gerrit APIs.  Please
20check whether the Gerrit Code Review URL is in `~/.gitcookies`.
21
22If you don't have an entry, follow these steps:
23
241. Visit the [Gerrit Code Review](https://android-review.googlesource.com).
25
262. Click [Settings -> HTTP Credentials](https://android-review.googlesource.com/settings/#HTTPCredentials)
27
283. Click **Obtain password**
29
304. Copy the highlighted shell commands and paste them in a terminal.
31
32Note: You must repeat these for each Gerrit Code Review websites.
33
34
35## Usages
36
37Command line usages:
38
39    $ repo_pull.py [sub-command] [query] \
40                   [-g gerrit] \
41                   [-b local-topic-branch] \
42                   [-j num-threads] \
43                   [--limits max-num-changes]
44
45
46Three sub-commands are supported:
47
48* `repo_pull.py json` prints the change lists in the JSON file format.
49
50* `repo_pull.py bash` prints the *bash commands* that can pull the change lists.
51
52* `repo_pull.py pull` *pulls the change lists* immediately.
53
54
55### Query String
56
57`[query]` is the query string that can be entered to the Gerrit search box.
58
59These are common queries:
60
61* `topic:name`
62* `hashtag:name`
63* `branch:name`
64* `project:name`
65* `owner:name`
66* `is:open` | `is:merged` | `is:abandoned`
67* `message:text`
68
69
70### Options
71
72* `-g` or `--gerrit` specifies the URL of the Gerrit Code Review website.
73
74* `-b` or `--branch` specifies the local branch name that will be passed to
75  `repo start`.
76
77* `-j` or `--parallel` specifies the number of parallel threads while pulling
78  change lists.
79
80* `-n` or `--limits` specifies the maximum number of change lists.  (default:
81  1000)
82
83* `-m` or `--merge` specifies the method to pick the merge commits.  (default:
84  `merge-ff-only`)
85
86* `-p` or `--pick` specifies the method to pick the non-merge commits.
87  (default: `pick`)
88
89  * `pick` maps to `git cherry-pick --allow-empty`
90  * `merge` maps to `git merge --no-edit`
91  * `merge-ff-only` maps to `git merge --no-edit --ff-only`
92  * `merge-no-ff` maps to `git merge --no-edit --no-ff`
93  * `reset` maps to `git reset --hard`
94  * `checkout` maps to `git checkout`
95
96
97## Examples
98
99To print the change lists with the topic `repo-pull-initial-cl` in JSON file
100format:
101
102```
103repo_pull.py json 'topic:repo-pull-initial-cl' \
104    -g https://android-review.googlesource.com
105```
106
107To print the bash commands that can pull the change lists, use the `bash`
108command:
109
110```
111repo_pull.py bash 'topic:repo-pull-initial-cl' \
112    -g https://android-review.googlesource.com \
113    -b my-local-topic-branch
114```
115
116To pull the change lists immediately, use the `pull` command:
117
118```
119repo_pull.py pull 'topic:repo-pull-initial-cl' \
120    -g https://android-review.googlesource.com \
121    -b my-local-topic-branch
122```
123