├── gerrit-fetch-all └── README /gerrit-fetch-all: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | REMOTE="${1-review}" 3 | git ls-remote "${REMOTE}" | grep /changes/ | awk '{print $2;}' | while read REF 4 | do 5 | git fetch "${REMOTE}" "${REF}" 6 | git branch `echo "${REF}" | sed 's#refs/changes/../#change/#'` FETCH_HEAD 7 | done 8 | -------------------------------------------------------------------------------- /README: -------------------------------------------------------------------------------- 1 | A shell script to fetch all changesets from Gerrit 2 | 3 | This script allows to fetch all (open and closed) 4 | changesets from Gerrit. This can be useful for 5 | doing offline code review without access to 6 | the Gerit web interface, or to comparing 7 | differrent submitted changesets. 8 | 9 | 10 | Gerrit allows you to fetch individual changes into 11 | the git repository like this: 12 | 13 | git fetch https://review.openstack.org/p/openstack-ci/git-review refs/changes/84/5784/2 14 | git checkout FETCH_HEAD 15 | 16 | This script fetches list of all "refs/changes/*" 17 | references from gerrit and then downloads them. 18 | 19 | For every patchset a branch will be created called 20 | 21 | change/5784/2 22 | 23 | where 5784 is Gerrit changeset number and 2 is 24 | current patchset number. 25 | 26 | You can then compare changesets with a simple 27 | 28 | git diff change/5784/2 change/5784/3 29 | 30 | (if they have the same parent) 31 | 32 | You should invoke the script giving it the name 33 | of the git "remote" that identifies the Gerrit 34 | instance the you fetch from: 35 | 36 | gerrit-fetch-all gerrit 37 | 38 | If no parameters are given, "review" is assumed default. 39 | --------------------------------------------------------------------------------