# HG changeset patch # User Alexis S. L. Carvalho # Date 1161489663 10800 # Node ID 03932425cfd86eb2aa658ca4c314d0e7c8af73a1 # Parent bbfb392b2b1aa4b88e751eecf6c3bb7a47f52a77 bash_completion: don't complete export with "garbage" when mq is not around The "garbage" is the output of hg help printed when a command is not found. diff --git a/contrib/bash_completion b/contrib/bash_completion --- a/contrib/bash_completion +++ b/contrib/bash_completion @@ -251,8 +251,13 @@ complete -o bashdefault -o default -F _h # mq _hg_ext_mq_patchlist() { - local patches=$("$hg" $1 2>/dev/null) - COMPREPLY=(${COMPREPLY[@]:-} $(compgen -W '$patches' -- "$cur")) + local patches + patches=$("$hg" $1 2>/dev/null) + if [ $? -eq 0 ] && [ "$patches" ]; then + COMPREPLY=(${COMPREPLY[@]:-} $(compgen -W '$patches' -- "$cur")) + return 0 + fi + return 1 } _hg_ext_mq_queues()