diff --git a/mercurial/dispatch.py b/mercurial/dispatch.py index 9bb180abc4d07f1b6fac20125e8c14f245c2e057_bWVyY3VyaWFsL2Rpc3BhdGNoLnB5..ab93029ab622d4c6167fe792fc53dcd73fc86545_bWVyY3VyaWFsL2Rpc3BhdGNoLnB5 100644 --- a/mercurial/dispatch.py +++ b/mercurial/dispatch.py @@ -453,7 +453,7 @@ cmd = args[0] try: aliases, entry = cmdutil.findcmd(cmd, cmdtable, lui.config("ui", "strict")) - except error.UnknownCommand: + except (error.AmbiguousCommand, error.UnknownCommand): commands.norepo = norepo os.chdir(cwd) return diff --git a/tests/test-alias.t b/tests/test-alias.t index 9bb180abc4d07f1b6fac20125e8c14f245c2e057_dGVzdHMvdGVzdC1hbGlhcy50..ab93029ab622d4c6167fe792fc53dcd73fc86545_dGVzdHMvdGVzdC1hbGlhcy50 100644 --- a/tests/test-alias.t +++ b/tests/test-alias.t @@ -29,6 +29,11 @@ > mcount = !hg log \$@ --template='.' | wc -c | sed -e 's/ //g' > rt = root > tglog = glog --template "{rev}:{node|short}: '{desc}' {branches}\n" + > idalias = id + > idaliaslong = id + > idaliasshell = !echo test + > parentsshell1 = !echo one + > parentsshell2 = !echo two > > [defaults] > mylog = -q @@ -194,6 +199,35 @@ o 0:e63c23eaa88a: 'foo' + +shadowing + + $ hg i + hg: command 'i' is ambiguous: + idalias idaliaslong idaliasshell identify import incoming init + [255] + $ hg id + 7e7f92de180e tip + $ hg ida + hg: command 'ida' is ambiguous: + idalias idaliaslong idaliasshell + [255] + $ hg idalias + 7e7f92de180e tip + $ hg idaliasl + 7e7f92de180e tip + $ hg idaliass + test + $ hg parentsshell + hg: command 'parentsshell' is ambiguous: + parentsshell1 parentsshell2 + [255] + $ hg parentsshell1 + one + $ hg parentsshell2 + two + + shell aliases with global options $ hg init sub