Patchwork [V2] help: show help for disabled extensions(issue5228)

login
register
mail settings
Submitter Pulkit Goyal
Date Nov. 6, 2016, 3:40 a.m.
Message ID <6d27c42a7e01adcc0eab.1478403618@pulkit-goyal>
Download mbox | patch
Permalink /patch/17362/
State Accepted
Headers show

Comments

Pulkit Goyal - Nov. 6, 2016, 3:40 a.m.
# HG changeset patch
# User Pulkit Goyal <7895pulkit@gmail.com>
# Date 1478395471 -19800
#      Sun Nov 06 06:54:31 2016 +0530
# Node ID 6d27c42a7e01adcc0eabf88c623390c85c4a5943
# Parent  b5fc4e71286dd4f33336e4f38e0b9fb17f51f1e3
help: show help for disabled extensions(issue5228)

This patch does not exactly solve issue5228 but it results in a better
condition on this issue. For disabled extensions, we used to parse the
module and get the first occurences of docstring and then retrun the first
line of that as an introductory heading of extension. This is what we get
today.
This patch returns the whole docstring of the module as a help for extension,
which is more informative. There are some modules which don't have much
docstring at top level except the heading so those are unaffected by this
change. To follow the existing trend of showing commands either we have to
load the extension or have a very ugly parsing method which don't even assure
correctness.
Yuya Nishihara - Nov. 6, 2016, 7:56 a.m.
On Sun, 06 Nov 2016 09:10:18 +0530, Pulkit Goyal wrote:
> # HG changeset patch
> # User Pulkit Goyal <7895pulkit@gmail.com>
> # Date 1478395471 -19800
> #      Sun Nov 06 06:54:31 2016 +0530
> # Node ID 6d27c42a7e01adcc0eabf88c623390c85c4a5943
> # Parent  b5fc4e71286dd4f33336e4f38e0b9fb17f51f1e3
> help: show help for disabled extensions(issue5228)

Queued this, thanks.
Pulkit Goyal - Dec. 4, 2016, 1:52 p.m.
The status of bug doesn't seem to change, do we need more improvement
in this. I want to make sure to fix this one.
https://bz.mercurial-scm.org/show_bug.cgi?id=5228

On Sun, Nov 6, 2016 at 1:26 PM, Yuya Nishihara <yuya@tcha.org> wrote:
> On Sun, 06 Nov 2016 09:10:18 +0530, Pulkit Goyal wrote:
>> # HG changeset patch
>> # User Pulkit Goyal <7895pulkit@gmail.com>
>> # Date 1478395471 -19800
>> #      Sun Nov 06 06:54:31 2016 +0530
>> # Node ID 6d27c42a7e01adcc0eabf88c623390c85c4a5943
>> # Parent  b5fc4e71286dd4f33336e4f38e0b9fb17f51f1e3
>> help: show help for disabled extensions(issue5228)
>
> Queued this, thanks.
Yuya Nishihara - Dec. 4, 2016, 2:23 p.m.
On Sun, 4 Dec 2016 19:22:28 +0530, Pulkit Goyal wrote:
> The status of bug doesn't seem to change, do we need more improvement
> in this. I want to make sure to fix this one.
> https://bz.mercurial-scm.org/show_bug.cgi?id=5228

I don't think we need more.

Bugzilla bot dead?
Yuya Nishihara - Dec. 6, 2016, 12:36 p.m.
On Mon, 5 Dec 2016 10:05:46 -0600, Kevin Bullock wrote:
> > On Dec 4, 2016, at 07:52, Pulkit Goyal <7895pulkit@gmail.com> wrote:
> > 
> > The status of bug doesn't seem to change, do we need more improvement
> > in this. I want to make sure to fix this one.
> > https://bz.mercurial-scm.org/show_bug.cgi?id=5228
> > 
> > On Sun, Nov 6, 2016 at 1:26 PM, Yuya Nishihara <yuya@tcha.org> wrote:
> >> On Sun, 06 Nov 2016 09:10:18 +0530, Pulkit Goyal wrote:
> >>> # HG changeset patch
> >>> # User Pulkit Goyal <7895pulkit@gmail.com>
> >>> # Date 1478395471 -19800
> >>> #      Sun Nov 06 06:54:31 2016 +0530
> >>> # Node ID 6d27c42a7e01adcc0eabf88c623390c85c4a5943
> >>> # Parent  b5fc4e71286dd4f33336e4f38e0b9fb17f51f1e3
> >>> help: show help for disabled extensions(issue5228)
> 
> I'm guessing the bz bot was confused by a ^^ missing space here.

I've queued the fixed version. It seems the bugzilla is silent these days.

Patch

diff -r b5fc4e71286d -r 6d27c42a7e01 mercurial/extensions.py
--- a/mercurial/extensions.py	Sun Nov 06 04:36:26 2016 +0530
+++ b/mercurial/extensions.py	Sun Nov 06 06:54:31 2016 +0530
@@ -426,7 +426,7 @@ 
         file.close()
 
     if doc: # extracting localized synopsis
-        return gettext(doc).splitlines()[0]
+        return gettext(doc)
     else:
         return _('(no help text available)')
 
@@ -448,7 +448,7 @@ 
     for name, path in paths.iteritems():
         doc = _disabledhelp(path)
         if doc:
-            exts[name] = doc
+            exts[name] = doc.splitlines()[0]
 
     return exts
 
diff -r b5fc4e71286d -r 6d27c42a7e01 tests/test-extension.t
--- a/tests/test-extension.t	Sun Nov 06 04:36:26 2016 +0530
+++ b/tests/test-extension.t	Sun Nov 06 06:54:31 2016 +0530
@@ -1045,6 +1045,61 @@ 
   $ hg help patchbomb
   patchbomb extension - command to send changesets as (a series of) patch emails
   
+  The series is started off with a "[PATCH 0 of N]" introduction, which
+  describes the series as a whole.
+  
+  Each patch email has a Subject line of "[PATCH M of N] ...", using the first
+  line of the changeset description as the subject text. The message contains
+  two or three body parts:
+  
+  - The changeset description.
+  - [Optional] The result of running diffstat on the patch.
+  - The patch itself, as generated by 'hg export'.
+  
+  Each message refers to the first in the series using the In-Reply-To and
+  References headers, so they will show up as a sequence in threaded mail and
+  news readers, and in mail archives.
+  
+  To configure other defaults, add a section like this to your configuration
+  file:
+  
+    [email]
+    from = My Name <my@email>
+    to = recipient1, recipient2, ...
+    cc = cc1, cc2, ...
+    bcc = bcc1, bcc2, ...
+    reply-to = address1, address2, ...
+  
+  Use "[patchbomb]" as configuration section name if you need to override global
+  "[email]" address settings.
+  
+  Then you can use the 'hg email' command to mail a series of changesets as a
+  patchbomb.
+  
+  You can also either configure the method option in the email section to be a
+  sendmail compatible mailer or fill out the [smtp] section so that the
+  patchbomb extension can automatically send patchbombs directly from the
+  commandline. See the [email] and [smtp] sections in hgrc(5) for details.
+  
+  By default, 'hg email' will prompt for a "To" or "CC" header if you do not
+  supply one via configuration or the command line.  You can override this to
+  never prompt by configuring an empty value:
+  
+    [email]
+    cc =
+  
+  You can control the default inclusion of an introduction message with the
+  "patchbomb.intro" configuration option. The configuration is always
+  overwritten by command line flags like --intro and --desc:
+  
+    [patchbomb]
+    intro=auto   # include introduction message if more than 1 patch (default)
+    intro=never  # never include an introduction message
+    intro=always # always include an introduction message
+  
+  You can set patchbomb to always ask for confirmation by setting
+  "patchbomb.confirm" to true.
+  
   (use 'hg help extensions' for information on enabling extensions)
 
 
diff -r b5fc4e71286d -r 6d27c42a7e01 tests/test-qrecord.t
--- a/tests/test-qrecord.t	Sun Nov 06 04:36:26 2016 +0530
+++ b/tests/test-qrecord.t	Sun Nov 06 06:54:31 2016 +0530
@@ -9,6 +9,9 @@ 
   record extension - commands to interactively select changes for
   commit/qrefresh (DEPRECATED)
   
+  The feature provided by this extension has been moved into core Mercurial as
+  'hg commit --interactive'.
+  
   (use 'hg help extensions' for information on enabling extensions)
 
 help qrecord (no record)