Last active
January 28, 2017 13:36
-
-
Save alexanderjeurissen/d39647d29219feebb3ba069c754d5da7 to your computer and use it in GitHub Desktop.
Fuzzy select a Arcanist differential to either browse or land
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
browse() { | |
case $1 in | |
acc) | |
diffs=`arc list | grep 'Accepted' | egrep -o 'D\d+: .*'` | |
;; | |
rev) | |
diffs=`arc list | grep 'Needs Review' | egrep -o 'D\d+: .*'` | |
;; | |
req) | |
diffs=`arc list | grep 'Needs Revision' | egrep -o 'D\d+: .*'` | |
;; | |
*) | |
echo "Usage: $0 {acc||rev|req|cha}" | |
return 1 | |
esac | |
if [ -z $diffs ]; then | |
echo "no \`$1\` diffs available for browsing" | |
return 1 | |
fi | |
chosen_diff=`echo $diffs | fzf | egrep -o 'D\d{5}'` | |
if [ -z $chosen_diff ]; then | |
echo "operation cancelled" | |
return 1 | |
fi | |
arc browse $chosen_diff | |
} |
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
land() { | |
diffs=`arc list | grep 'Accepted' | egrep -o 'D\d+: .*'` | |
if [ -z $diffs ]; then | |
echo "no diffs available for landing" | |
return 1 | |
fi | |
chosen_diff=`echo $diffs | fzf | egrep -o 'D\d{5}'` | |
if [ -z $chosen_diff ]; then | |
echo "operation cancelled" | |
return 1 | |
fi | |
stash # stash current working directory, this a shell alias of mine. You can replace this with git stash -u | |
# TODO: add item to todolist to continue working on the just stashed changes | |
gco develop | |
arc patch $chosen_diff | |
# confirm landing this patch | |
read -p "Continue with landing (y/n)?" choice | |
case "$choice" in | |
y|Y ) arc land $chosen_diff;; | |
n|N ) echo "operation cancelled";; | |
* ) echo "invalid choice, please provide (y/n)";; | |
esac | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment