Created
May 18, 2013 12:57
-
-
Save Rud5G/5604323 to your computer and use it in GitHub Desktop.
Gerrit Code Review - Mass Abandon or Mass Approve
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# create alias for cli gerrit requests | |
alias gerrit='ssh -p 29418 gerrit.yourdomain.com gerrit' | |
# get tempfile for the ids | |
tmpfileids=$(tempfile -d /tmp) | |
# get all commit number ids for the project YOUR_PROJECT_NAME | |
gerrit query 'status:open project:YOUR_PROJECT_NAME' | egrep '^\ +number' | cut -d' ' -f4- > $tmpfileids | |
# do mass abandon | |
for i in `cat $tmpfileids`; do gerrit review --abandon $i,1; done ; | |
# or do mass approval | |
for i in `cat $tmpfileids`; do gerrit approve --verified 1 --code-review 2 --submit $i; done ; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
can one-liner this gerrit query 'status:open project:YOUR_PROJECT_NAME' |ggrep -oP '(?<=number: )\d+' | xargs -i gerrit review --abandon {},.1
whichever grep has PCRE in it... just needed this... thanks much!