Skip to content

Instantly share code, notes, and snippets.

@andrewshatnyy
Created August 5, 2013 21:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andrewshatnyy/6159964 to your computer and use it in GitHub Desktop.
Save andrewshatnyy/6159964 to your computer and use it in GitHub Desktop.
Mercurial find old branches merged into default oldbranches.sh username
#!/bin/bash
USERNAME=$1
get_heads () {
hg heads --template "{branches}:{author}\n"
}
find_user_branches () {
get_heads | grep -i "$USERNAME"
}
get_branch_names () {
find_user_branches | cut -d ":" -f 1
}
compare_branches() {
for branch in `get_branch_names`
do
diff=`hg diff -r$branch:default`
if [ -z "$diff" ]; then
echo $branch
fi
done
}
main () {
compare_branches
}
echo "Working please wait..."
main
echo "Done."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment