Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
## 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