Skip to content

Instantly share code, notes, and snippets.

@Rud5G
Created May 18, 2013 12:57
Show Gist options
  • Save Rud5G/5604323 to your computer and use it in GitHub Desktop.
Save Rud5G/5604323 to your computer and use it in GitHub Desktop.
Gerrit Code Review - Mass Abandon or Mass Approve
# 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 ;
@brchrisman
Copy link

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment