bash_completion: change --rev if-else block into a case
authorSean Farley <sean.michael.farley@gmail.com>
Tue, 26 Nov 2013 14:04:12 -0600
changeset 20133 f6c33fc59dbd
parent 20132 d14f9c4a4398
child 20134 bc9735855598
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.
contrib/bash_completion
--- a/contrib/bash_completion	Tue Nov 26 13:55:33 2013 -0600
+++ b/contrib/bash_completion	Tue Nov 26 14:04:12 2013 -0600
@@ -239,12 +239,16 @@
         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}')