Created
November 27, 2012 09:29
-
-
Save cougarwww/4153325 to your computer and use it in GitHub Desktop.
shell: hg hooks for branch
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 | |
#set -x | |
if [ "$#" -lt 2 ] | |
then | |
echo -e "Not enouth args" | |
exit 1 | |
fi | |
revs=$(hg log -r "$HG_NODE:tip" --template '{rev} ') #Intentional space after {rev} | |
for rev in $revs | |
do | |
branch=$(hg log -r $rev --template '{branch}') | |
if [ x$branch = x$1 ] | |
then | |
echo "Match push branch: $branch" | |
$2 | |
else | |
echo "Do not need push branch: $branch" | |
fi | |
done | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment