[PATCH 12 of 15 V5] bash_completion: change --rev if-else block into a case
Sean Farley
sean.michael.farley at gmail.com
Tue Nov 26 19:54:51 UTC 2013
# HG changeset patch
# User Sean Farley <sean.michael.farley at gmail.com>
# Date 1385496252 21600
# Tue Nov 26 14:04:12 2013 -0600
# Node ID 58efbd280c39addee05fe06175989da96823efd0
# Parent 1e5decdcde0ac1767b980c212901ca7559a92d99
bash_completion: change --rev if-else block into a case
Again, this doesn't change behavior but does make it easy to add cases in the
next patch.
diff --git a/contrib/bash_completion b/contrib/bash_completion
--- a/contrib/bash_completion
+++ b/contrib/bash_completion
@@ -237,16 +237,20 @@
if [ "$(type -t "_hg_cmd_$cmd")" = function ]; then
"_hg_cmd_$cmd"
return 0
fi
- if [ "$cmd" != status ] && [ "$prev" = -r ] || [ "$prev" == --rev ]; then
- if [[ $canonical = 1 || status != "$cmd"* ]]; then
- _hg_labels
- return 0
- fi
- return 1
+ if [ "$cmd" != status ]; then
+ case "$prev" in
+ -r|--rev)
+ if [[ $canonical = 1 || status != "$cmd"* ]]; then
+ _hg_labels
+ 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