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 *(required)* 74 75* `-b` or `--branch` specifies the local branch name that will be passed to 76 `repo start`. 77 78* `-j` or `--parallel` specifies the number of parallel threads while pulling 79 change lists. 80 81* `-n` or `--limits` specifies the maximum number of change lists. (default: 82 1000) 83 84* `-m` or `--merge` specifies the method to pick the merge commits. (default: 85 `merge-ff-only`) 86 87* `-p` or `--pick` specifies the method to pick the non-merge commits. 88 (default: `pick`) 89 90 * `pick` maps to `git cherry-pick --allow-empty` 91 * `merge` maps to `git merge --no-edit` 92 * `merge-ff-only` maps to `git merge --no-edit --ff-only` 93 * `merge-no-ff` maps to `git merge --no-edit --no-ff` 94 * `reset` maps to `git reset --hard` 95 * `checkout` maps to `git checkout` 96 97 98## Examples 99 100To print the change lists with the topic `repo-pull-initial-cl` in JSON file 101format: 102 103``` 104repo_pull.py json 'topic:repo-pull-initial-cl' \ 105 -g https://android-review.googlesource.com 106``` 107 108To print the bash commands that can pull the change lists, use the `bash` 109command: 110 111``` 112repo_pull.py bash 'topic:repo-pull-initial-cl' \ 113 -g https://android-review.googlesource.com \ 114 -b my-local-topic-branch 115``` 116 117To pull the change lists immediately, use the `pull` command: 118 119``` 120repo_pull.py pull 'topic:repo-pull-initial-cl' \ 121 -g https://android-review.googlesource.com \ 122 -b my-local-topic-branch 123``` 124