Last active
August 29, 2015 14:22
-
-
Save mattymo/f623399714908ee7b4c1 to your computer and use it in GitHub Desktop.
gerrit patches from topic
This file contains hidden or 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
#!/bin/bash | |
GERRITUSER=$USER | |
TOPIC=$1 | |
EXTRAQUERY=$2 | |
#Sort order | |
#0=as gerrit says (newest first) | |
#1=numeric by patchset id | |
#2=reverse of gerrit (oldest first) | |
SORTED=2 | |
if [ -z "$1" ];then echo "specify topic"; exit 1; fi | |
if [ "$SORTED" = "1" ]; then | |
ssh -p 29418 review.openstack.org gerrit query --current-patch-set \ | |
topic:$TOPIC $EXTRAQUERY | gawk ' | |
/ref:/ { | |
split($2,parts,"/") | |
refs[parts[4]] = $2 | |
} | |
END { | |
n=asorti(refs,sorted) | |
for (i=1;i<=n;i++) { | |
print refs[sorted[i]] | |
} | |
}' | |
elif [ "$SORTED" = "2" ];then | |
ssh -p 29418 review.openstack.org gerrit query --current-patch-set \ | |
topic:$TOPIC $EXTRAQUERY | tac | awk '/ref:/ {printf "%s\n",$2}' | |
else | |
ssh -p 29418 review.openstack.org gerrit query --current-patch-set \ | |
topic:$TOPIC $EXTRAQUERY | awk '/ref:/ {printf "%s\n",$2}' | |
fi | |
#awk '/ref:/ { split($2,parts,"/"); refs[parts[4]] = $2} END { for (ref in refs) print refs[ref]}' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment