Patchwork [4,of,5] show: make template option actually show up in help

login
register
mail settings
Submitter Ryan McElroy
Date April 10, 2017, 9:41 a.m.
Message ID <eefe70d59a3ea5a09b57.1491817266@devbig314.prn1.facebook.com>
Download mbox | patch
Permalink /patch/20049/
State Accepted
Headers show

Comments

Ryan McElroy - April 10, 2017, 9:41 a.m.
# HG changeset patch
# User Ryan McElroy <rmcelroy@fb.com>
# Date 1491817029 25200
#      Mon Apr 10 02:37:09 2017 -0700
# Node ID eefe70d59a3ea5a09b5711ea8d7c568002a8d9e3
# Parent  ee1bd54bfda1dd1aea0f9b2397ddeae42d58c54a
show: make template option actually show up in help

Previously, the --template/-T option didn't show up in help because it's marked
as experimental. It's not really experimental for show, and its quite important
for show's funcationality, so let's make sure it always shows up.
Yuya Nishihara - April 11, 2017, 1 p.m.
On Mon, 10 Apr 2017 02:41:06 -0700, Ryan McElroy wrote:
> # HG changeset patch
> # User Ryan McElroy <rmcelroy@fb.com>
> # Date 1491817029 25200
> #      Mon Apr 10 02:37:09 2017 -0700
> # Node ID eefe70d59a3ea5a09b5711ea8d7c568002a8d9e3
> # Parent  ee1bd54bfda1dd1aea0f9b2397ddeae42d58c54a
> show: make template option actually show up in help
> 
> Previously, the --template/-T option didn't show up in help because it's marked
> as experimental. It's not really experimental for show, and its quite important
> for show's funcationality, so let's make sure it always shows up.

I prefer not making show() diverged from the other commands taking -T option.
"hg show" is experimental anyway.
Ryan McElroy - April 12, 2017, 11:34 a.m.
On 4/11/17 2:00 PM, Yuya Nishihara wrote:
> On Mon, 10 Apr 2017 02:41:06 -0700, Ryan McElroy wrote:
>> # HG changeset patch
>> # User Ryan McElroy <rmcelroy@fb.com>
>> # Date 1491817029 25200
>> #      Mon Apr 10 02:37:09 2017 -0700
>> # Node ID eefe70d59a3ea5a09b5711ea8d7c568002a8d9e3
>> # Parent  ee1bd54bfda1dd1aea0f9b2397ddeae42d58c54a
>> show: make template option actually show up in help
>>
>> Previously, the --template/-T option didn't show up in help because it's marked
>> as experimental. It's not really experimental for show, and its quite important
>> for show's funcationality, so let's make sure it always shows up.
> I prefer not making show() diverged from the other commands taking -T option.
> "hg show" is experimental anyway.

Right now, the output looks silly and confusing. It ends with:



(use 'hg help -e show' to show help for the show extension)

options:

(some details hidden, use --verbose to show complete help)


Yes, that's an empty list of options, which looks really weird.

I'll take a look at making experimental commands also show experimental 
options, but if anyone has pointers that would be cool.
Yuya Nishihara - April 12, 2017, 3:37 p.m.
On Wed, 12 Apr 2017 12:34:14 +0100, Ryan McElroy wrote:
> On 4/11/17 2:00 PM, Yuya Nishihara wrote:
> > On Mon, 10 Apr 2017 02:41:06 -0700, Ryan McElroy wrote:
> >> # HG changeset patch
> >> # User Ryan McElroy <rmcelroy@fb.com>
> >> # Date 1491817029 25200
> >> #      Mon Apr 10 02:37:09 2017 -0700
> >> # Node ID eefe70d59a3ea5a09b5711ea8d7c568002a8d9e3
> >> # Parent  ee1bd54bfda1dd1aea0f9b2397ddeae42d58c54a
> >> show: make template option actually show up in help
> >>
> >> Previously, the --template/-T option didn't show up in help because it's marked
> >> as experimental. It's not really experimental for show, and its quite important
> >> for show's funcationality, so let's make sure it always shows up.
> > I prefer not making show() diverged from the other commands taking -T option.
> > "hg show" is experimental anyway.
> 
> Right now, the output looks silly and confusing. It ends with:
> 
> (use 'hg help -e show' to show help for the show extension)
> 
> options:
> 
> (some details hidden, use --verbose to show complete help)
> 
> Yes, that's an empty list of options, which looks really weird.

I'm okay with that because the command is experimental, but yeah it's weird.

Can you resend this with some TODO comment so we'll never expose the -T
option when "show" gets stable but -T is still experimental?
Ryan McElroy - April 13, 2017, 9:52 a.m.
On 4/12/17 4:37 PM, Yuya Nishihara wrote:
> On Wed, 12 Apr 2017 12:34:14 +0100, Ryan McElroy wrote:
>> On 4/11/17 2:00 PM, Yuya Nishihara wrote:
>>> On Mon, 10 Apr 2017 02:41:06 -0700, Ryan McElroy wrote:
>>>> # HG changeset patch
>>>> # User Ryan McElroy <rmcelroy@fb.com>
>>>> # Date 1491817029 25200
>>>> #      Mon Apr 10 02:37:09 2017 -0700
>>>> # Node ID eefe70d59a3ea5a09b5711ea8d7c568002a8d9e3
>>>> # Parent  ee1bd54bfda1dd1aea0f9b2397ddeae42d58c54a
>>>> show: make template option actually show up in help
>>>>
>>>> Previously, the --template/-T option didn't show up in help because it's marked
>>>> as experimental. It's not really experimental for show, and its quite important
>>>> for show's funcationality, so let's make sure it always shows up.
>>> I prefer not making show() diverged from the other commands taking -T option.
>>> "hg show" is experimental anyway.
>> Right now, the output looks silly and confusing. It ends with:
>>
>> (use 'hg help -e show' to show help for the show extension)
>>
>> options:
>>
>> (some details hidden, use --verbose to show complete help)
>>
>> Yes, that's an empty list of options, which looks really weird.
> I'm okay with that because the command is experimental, but yeah it's weird.
>
> Can you resend this with some TODO comment so we'll never expose the -T
> option when "show" gets stable but -T is still experimental?

Sure, will send follow-ups. Thanks for the review!

Patch

diff --git a/hgext/show.py b/hgext/show.py
--- a/hgext/show.py
+++ b/hgext/show.py
@@ -17,7 +17,6 @@  from __future__ import absolute_import
 from mercurial.i18n import _
 from mercurial import (
     cmdutil,
-    commands,
     error,
     registrar,
 )
@@ -51,7 +50,9 @@  class showcmdfunc(registrar._funcregistr
 
 showview = showcmdfunc()
 
-@command('show', commands.formatteropts, _('VIEW'))
+@command('show', [
+    ('T', 'template', '', ('display with template'), _('TEMPLATE')),
+    ], _('VIEW'))
 def show(ui, repo, view=None, template=None):
     """show various repository information
 
diff --git a/tests/test-show.t b/tests/test-show.t
--- a/tests/test-show.t
+++ b/tests/test-show.t
@@ -43,6 +43,8 @@  No arguments shows available views
   
   options:
   
+   -T --template TEMPLATE display with template
+  
   (some details hidden, use --verbose to show complete help)
 
 Unknown view prints error