Patchwork [4,of,5] show: also catch AmbiguousCommand

login
register
mail settings
Submitter Gregory Szorc
Date July 4, 2017, 4:32 a.m.
Message ID <b34900769c27a137fa31.1499142760@ubuntu-vm-main>
Download mbox | patch
Permalink /patch/21964/
State Accepted
Headers show

Comments

Gregory Szorc - July 4, 2017, 4:32 a.m.
# HG changeset patch
# User Gregory Szorc <gregory.szorc@gmail.com>
# Date 1499141912 25200
#      Mon Jul 03 21:18:32 2017 -0700
# Node ID b34900769c27a137fa31b86d88d9e09e29f15d4a
# Parent  98ad38a7e25c0fca06cac849e5f68bd3c0cc82bb
show: also catch AmbiguousCommand

cmdutil.findcmd() can raise this as well. While we'll almost certainly
never encounter this in the wild, guard against it regardless.

Patch

diff --git a/hgext/show.py b/hgext/show.py
--- a/hgext/show.py
+++ b/hgext/show.py
@@ -233,7 +233,7 @@  def showstack(ui, repo, displayer):
     try:
         cmdutil.findcmd('rebase', commands.table)
         haverebase = True
-    except error.UnknownCommand:
+    except (error.AmbiguousCommand, error.UnknownCommand):
         haverebase = False
 
     # TODO use templating.