Patchwork [13,of,15,V5] bash_completion: add global support for -B|--bookmark

login
register
mail settings
Submitter Sean Farley
Date Nov. 26, 2013, 7:54 p.m.
Message ID <9978ec49c0eb4a9fbfd0.1385499292@laptop.local>
Download mbox | patch
Permalink /patch/3167/
State Accepted
Commit bc97358555988e9e630ff2dd85f665df672ed159
Headers show

Comments

Sean Farley - Nov. 26, 2013, 7:54 p.m.
# HG changeset patch
# User Sean Farley <sean.michael.farley@gmail.com>
# Date 1385497900 21600
#      Tue Nov 26 14:31:40 2013 -0600
# Node ID 9978ec49c0eb4a9fbfd0ce6f973da184a0053037
# Parent  58efbd280c39addee05fe06175989da96823efd0
bash_completion: add global support for -B|--bookmark

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

Patch

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