contrib/bash_completion
branchstable
changeset 13509 8aea95ec128f
parent 13243 159651b3c9ec
child 14332 a2f0f61a6988
--- a/contrib/bash_completion	Mon Feb 28 17:41:40 2011 -0600
+++ b/contrib/bash_completion	Mon Feb 28 16:45:15 2011 -0600
@@ -101,6 +101,20 @@
     COMPREPLY=(${COMPREPLY[@]:-} $(compgen -W '$branches' -- "$cur"))
 }
 
+_hg_bookmarks()
+{
+    local bookmarks="$(_hg_cmd bookmarks -q)"
+    local IFS=$'\n'
+    COMPREPLY=(${COMPREPLY[@]:-} $(compgen -W '$bookmarks' -- "$cur"))
+}
+
+_hg_labels()
+{
+    _hg_tags
+    _hg_branches
+    _hg_bookmarks
+}
+
 # this is "kind of" ugly...
 _hg_count_non_option()
 {
@@ -200,12 +214,10 @@
 
     if [ "$cmd" != status ] && [ "$prev" = -r ] || [ "$prev" == --rev ]; then
 	if [ $canonical = 1 ]; then
-	    _hg_tags
-	    _hg_branches
+	    _hg_labels
 	    return 0
 	elif [[ status != "$cmd"* ]]; then
-	    _hg_tags
-	    _hg_branches
+            _hg_labels
 	    return 0
 	else
 	    return 1
@@ -220,12 +232,10 @@
 	    if _hg_ext_mq_patchlist qapplied && [ "${COMPREPLY[*]}" ]; then
 		return 0
 	    fi
-	    _hg_tags
-	    _hg_branches
+	    _hg_labels
 	;;
 	manifest|update)
-	    _hg_tags
-	    _hg_branches
+	    _hg_labels
 	;;
 	pull|push|outgoing|incoming)
 	    _hg_paths
@@ -238,8 +248,7 @@
 	    _hg_status "u"
 	;;
 	merge)
-	    _hg_tags
-	    _hg_branches
+	    _hg_labels
 	;;
 	commit|record)
 	    _hg_status "mar"
@@ -378,8 +387,7 @@
 
 _hg_cmd_strip()
 {
-    _hg_tags
-    _hg_branches
+    _hg_labels
 }
 
 _hg_cmd_qcommit()
@@ -497,8 +505,7 @@
 
     case "$subcmd" in
 	good|bad)
-	    _hg_tags
-	    _hg_branches
+	    _hg_labels
 	    ;;
     esac
 
@@ -534,8 +541,7 @@
 	    ;;
     esac
 
-    _hg_tags
-    _hg_branches
+    _hg_labels
     return
 }
 
@@ -543,8 +549,7 @@
 # gpg
 _hg_cmd_sign()
 {
-    _hg_tags
-    _hg_branches
+    _hg_labels
 }
 
 
@@ -564,8 +569,7 @@
     esac
 
     # all other transplant options values and command parameters are revisions
-    _hg_tags
-    _hg_branches
+    _hg_labels
     return
 }