Last active
February 22, 2019 11:17
-
-
Save breyten/5143040 to your computer and use it in GitHub Desktop.
Automatically close inactive mercurial branches (use with care!)
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
for i in `hg branches |grep -v 'default' |grep -v 'production' |grep inactive |awk '{print $1}'`; do hg update $i && hg commit -m "close branch" --close-branch; done |
Unfortunately this script doesn't work when branches named with spaces, {print $1} takes first string, wich is just the first part of branch name.
I have added several changes to make this script possible close branches named with white spaces https://gist.github.com/RebornSoul/6c0a618466eade87df26#file-hg-close-inactive-branches-sh
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Very useful, thanks! Would be nice to parametrize the branches to exclude (default, production etc.). Also an output of
hg out
at the end for confirmation & doing ahg push
thereafter would be icing on the cake :)