# HG changeset patch # User Steve Losh # Date 1244084323 14400 # Node ID b5e9ed63913b2d953eb7f6fd704b5e356fa53642 # Parent 3463b28681eec1407816a56a24ccee54dd11abdf Support branch names in contrib/bash_completion Anywhere a revision is needed a branch name can be used to specify the tip of that branch, so branch names should be tab completed. diff -r 3463b28681ee -r b5e9ed63913b contrib/bash_completion --- a/contrib/bash_completion Wed Jun 03 22:54:53 2009 -0400 +++ b/contrib/bash_completion Wed Jun 03 22:58:43 2009 -0400 @@ -89,6 +89,13 @@ COMPREPLY=(${COMPREPLY[@]:-} $(compgen -W '$tags' -- "$cur")) } +_hg_branches() +{ + local branches="$("$hg" branches -q 2>/dev/null)" + local IFS=$'\n' + COMPREPLY=(${COMPREPLY[@]:-} $(compgen -W '$branches' -- "$cur")) +} + # this is "kind of" ugly... _hg_count_non_option() { @@ -189,9 +196,11 @@ if [ "$cmd" != status ] && [ "$prev" = -r ] || [ "$prev" == --rev ]; then if [ $canonical = 1 ]; then _hg_tags + _hg_branches return 0 elif [[ status != "$cmd"* ]]; then _hg_tags + _hg_branches return 0 else return 1 @@ -207,9 +216,11 @@ return 0 fi _hg_tags + _hg_branches ;; manifest|update) _hg_tags + _hg_branches ;; pull|push|outgoing|incoming) _hg_paths @@ -223,6 +234,7 @@ ;; merge) _hg_tags + _hg_branches ;; commit) _hg_status "mar" @@ -338,6 +350,7 @@ _hg_cmd_strip() { _hg_tags + _hg_branches } _hg_cmd_qcommit() @@ -446,6 +459,7 @@ case "$subcmd" in good|bad) _hg_tags + _hg_branches ;; esac @@ -482,6 +496,7 @@ esac _hg_tags + _hg_branches return } @@ -490,6 +505,7 @@ _hg_cmd_sign() { _hg_tags + _hg_branches } @@ -510,6 +526,7 @@ # all other transplant options values and command parameters are revisions _hg_tags + _hg_branches return }