[PATCH 14 of 15 V5] bash_completion: add global support for -b|--branch

Sean Farley sean.michael.farley at gmail.com
Tue Nov 26 19:54:53 UTC 2013


# HG changeset patch
# User Sean Farley <sean.michael.farley at gmail.com>
# Date 1385497998 21600
#      Tue Nov 26 14:33:18 2013 -0600
# Node ID 7908c45ed714ef93803c7fdd7cf408be84d1d3f7
# Parent  9978ec49c0eb4a9fbfd0ce6f973da184a0053037
bash_completion: add global support for -b|--branch

Previously, only -r|--rev was parsed globally which meant 'hg push -b <tab>'
would try to complete a path instead of a branch.

diff --git a/contrib/bash_completion b/contrib/bash_completion
--- a/contrib/bash_completion
+++ b/contrib/bash_completion
@@ -253,10 +253,17 @@
                     _hg_bookmarks
                     return 0
                 fi
                 return 1
             ;;
+            -b|--branch)
+                if [[ $canonical = 1 || status != "$cmd"* ]]; then
+                    _hg_branches
+                    return 0
+                fi
+                return 1
+            ;;
         esac
     fi
 
     local aliascmd=$(_hg_cmd showconfig alias.$cmd | awk '{print $1}')
     [ -n "$aliascmd" ] && cmd=$aliascmd



More information about the Mercurial-devel mailing list