mercurial/help.py
changeset 21289 c3784e3c3e8d
parent 21288 eb6eaef7ae44
child 21796 8225bb1f0ad3
--- a/mercurial/help.py	Wed Apr 16 20:01:03 2014 -0400
+++ b/mercurial/help.py	Wed Apr 16 19:55:40 2014 -0400
@@ -486,7 +486,6 @@
             hint = _('try "hg help" for a list of topics')
             raise util.Abort(msg, hint=hint)
     elif name and name != 'shortlist':
-        i = None
         if unknowncmd:
             queries = (helpextcmd,)
         elif opts.get('extension'):
@@ -498,12 +497,16 @@
         for f in queries:
             try:
                 rst = f(name)
-                i = None
                 break
-            except error.UnknownCommand, inst:
-                i = inst
-        if i:
-            raise i
+            except error.UnknownCommand:
+                pass
+        else:
+            if unknowncmd:
+                raise error.UnknownCommand(name)
+            else:
+                msg = _('no such help topic: %s') % name
+                hint = _('try "hg help --keyword %s"') % name
+                raise util.Abort(msg, hint=hint)
     else:
         # program name
         if not ui.quiet: