Patchwork Bug 3749 --help does not show non-command help topics

login
register
mail settings
Submitter Ankur Ankan
Date April 15, 2013, 4:28 a.m.
Message ID <CANnmyOvgOFFkMnmKPJNvvJkLb8MpsFWEYOeKPa27UCnhd2aypQ@mail.gmail.com>
Download mbox | patch
Permalink /patch/1315/
State Superseded
Headers show

Comments

Ankur Ankan - April 15, 2013, 4:28 a.m.
# HG changeset patch
# User Ankur Ankan <ankurankan@gmail.com>
# Date 1365998534 -19800
#      Mon Apr 15 09:32:14 2013 +0530
# Node ID 12eb5092b99745e6117e38489c145b7b0cb80576
# Parent  4e1ae55e63ef13bbee13256f236d93efe817be69
bug 3749
Matt Mackall - April 15, 2013, 4:54 a.m.
Not bad for a first attempt, but needs some work.

On Mon, 2013-04-15 at 09:58 +0530, Ankur Ankan wrote:
> # HG changeset patch
> # User Ankur Ankan <ankurankan@gmail.com>
> # Date 1365998534 -19800
> #      Mon Apr 15 09:32:14 2013 +0530
> # Node ID 12eb5092b99745e6117e38489c145b7b0cb80576
> # Parent  4e1ae55e63ef13bbee13256f236d93efe817be69
> bug 3749

This has the least guideline-compliant patch description I've seen in a
while. From http://mercurial.selenic.com/wiki/ContributingChanges:

* first line of commit message is of the form "topic: uncapitalized, no trailing period" 
* bugs that are resolved are mentioned in summary in the form "(issueNNNN)" (no space) 
* all relevant info is in the commit message for posterity (not a "0 of N" message) 

Look at this for thousands of examples:

$ hg log -M --template '{desc|firstline}\n' | less

> diff -r 4e1ae55e63ef -r 12eb5092b997 mercurial/dispatch.py
> --- a/mercurial/dispatch.py Fri Apr 12 17:00:42 2013 -0400
> +++ b/mercurial/dispatch.py Mon Apr 15 09:32:14 2013 +0530
> @@ -144,13 +144,16 @@
>      except error.SignalInterrupt:
>          ui.warn(_("killed!\n"))
>      except error.UnknownCommand, inst:
> -        ui.warn(_("hg: unknown command '%s'\n") % inst.args[0])
>          try:
> -            # check if the command is in a disabled extension
> -            # (but don't check for extensions themselves)
> -            commands.help_(ui, inst.args[0], unknowncmd=True)
> -        except error.UnknownCommand:
> -            commands.help_(ui, 'shortlist')
> +            commands.help_(ui,inst.args[0])

check-code sends its regards:

$ python contrib/check-code.py mercurial/dispatch.py
mercurial/dispatch.py:151:
 >             commands.help_(ui,inst.args[0])
 missing whitespace after ,
mercurial/dispatch.py:152:
 >         except:
 naked except clause

> +        except:
> +            ui.warn(_("hg: unknown command '%s'\n") % inst.args[0])

Ok, this now works:

 hg --help revsets

..but so does this, which probably shouldn't:

 hg revsets --help

And so does this, which almost certainly shouldn't:

 hg revsets

Patch

diff -r 4e1ae55e63ef -r 12eb5092b997 mercurial/dispatch.py
--- a/mercurial/dispatch.py Fri Apr 12 17:00:42 2013 -0400
+++ b/mercurial/dispatch.py Mon Apr 15 09:32:14 2013 +0530
@@ -144,13 +144,16 @@ 
     except error.SignalInterrupt:
         ui.warn(_("killed!\n"))
     except error.UnknownCommand, inst:
-        ui.warn(_("hg: unknown command '%s'\n") % inst.args[0])
         try:
-            # check if the command is in a disabled extension
-            # (but don't check for extensions themselves)
-            commands.help_(ui, inst.args[0], unknowncmd=True)
-        except error.UnknownCommand:
-            commands.help_(ui, 'shortlist')
+            commands.help_(ui,inst.args[0])
+        except:
+            ui.warn(_("hg: unknown command '%s'\n") % inst.args[0])
+            try:
+                # check if the command is in a disabled extension
+                # (but don't check for extensions themselves)
+                commands.help_(ui, inst.args[0], unknowncmd=True)
+            except error.UnknownCommand:
+                commands.help_(ui, 'shortlist')
     except util.Abort, inst:
         ui.warn(_("abort: %s\n") % inst)
         if inst.hint: