Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@reidbaker
Created February 28, 2014 20:40
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save reidbaker/9279430 to your computer and use it in GitHub Desktop.
Save reidbaker/9279430 to your computer and use it in GitHub Desktop.
## Gerrit is dumb ##
####################
alias gerrit='ssh -p 29418 <wherever you run gerrit> gerrit'
# Usage #
# gerritIds <project>
# will list all change ids by you that are open for <project>
# useful to find what ids will will be abandoned by abandonALl
gerritIds() {
gerrit query --format=JSON --patch-sets -- status:open project:$1 | grep -v runTimeMilliseconds | grep -E "`git config user.email`" | grep -E -o '"number":"\d\d+"' | tr '"' ' ' | cut -d' ' -f4-
}
# Usage #
# abandonAll <project>
# will abandon all commits open with your email (as determined by git's user.email) for <project>
abandonAll() {
for i in `gerritIds $1`; do gerrit review --abandon $i,1; done ;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment