Patchwork [2,of,8] children: update help with replacement

login
register
mail settings
Submitter timeless@mozdev.org
Date Jan. 10, 2016, 7:36 p.m.
Message ID <ad3e5e1b9f4d3ec45462.1452454576@waste.org>
Download mbox | patch
Permalink /patch/12641/
State Superseded
Commit 3501bd89dad2755ff47cfcb1cfef688c1dddb055
Headers show

Comments

timeless@mozdev.org - Jan. 10, 2016, 7:36 p.m.
# HG changeset patch
# User timeless <timeless@mozdev.org>
# Date 1452100698 0
#      Wed Jan 06 17:18:18 2016 +0000
# Node ID ad3e5e1b9f4d3ec45462d244ea4757a69a954621
# Parent  190ad6bc502ce70b1a431ff599fe46e49ad5a4cd
children: update help with replacement
Matt Harbison - Jan. 12, 2016, 12:52 a.m.
On Sun, 10 Jan 2016 14:36:16 -0500, timeless <timeless@mozdev.org> wrote:

> # HG changeset patch
> # User timeless <timeless@mozdev.org>
> # Date 1452100698 0
> #      Wed Jan 06 17:18:18 2016 +0000
> # Node ID ad3e5e1b9f4d3ec45462d244ea4757a69a954621
> # Parent  190ad6bc502ce70b1a431ff599fe46e49ad5a4cd
> children: update help with replacement
>
> diff --git a/hgext/children.py b/hgext/children.py
> --- a/hgext/children.py
> +++ b/hgext/children.py
> @@ -40,6 +40,14 @@
>      be printed. If a file argument is given, revision in which the
>      file was last changed (after the working directory revision or the
>      argument to --rev if given) is printed.
> +
> +    Please use :hg:`log` instead::
> +
> +        hg children => hg log -r 'children()'
> +        hg children -r REV => hg log -r 'children(REV)'

We should probably use double quotes (even though I understand the point  
in the next patch that it can look weird), because cmd.exe doesn't  
understand single quotes:

   C:\Users\Matt\Projects\hg>hg log -r 'children()'
   abort: unknown revision 'children()'!

It works fine in MSYS, but I suspect that most Windows users that copy  
help examples will be using cmd.exe, and not understand quote vs double  
quote.

This applies to the next two patches as well.  It hasn't stood out to me  
before, so I'm not sure how much has been converted (or added) already  
with your previous work on help stuff.

> +    See :hg:`help log` and :hg:`help revsets.children`.
> +
>      """
>      rev = opts.get('rev')
>      if file_:
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@selenic.com
> https://selenic.com/mailman/listinfo/mercurial-devel
Augie Fackler - Jan. 12, 2016, 3:07 a.m.
On Sun, Jan 10, 2016 at 01:36:16PM -0600, timeless wrote:
> # HG changeset patch
> # User timeless <timeless@mozdev.org>
> # Date 1452100698 0
> #      Wed Jan 06 17:18:18 2016 +0000
> # Node ID ad3e5e1b9f4d3ec45462d244ea4757a69a954621
> # Parent  190ad6bc502ce70b1a431ff599fe46e49ad5a4cd
> children: update help with replacement

I've taken these two, but need to spend more time on patch 3 than I
have right now before I can review the rest.

>
> diff --git a/hgext/children.py b/hgext/children.py
> --- a/hgext/children.py
> +++ b/hgext/children.py
> @@ -40,6 +40,14 @@
>      be printed. If a file argument is given, revision in which the
>      file was last changed (after the working directory revision or the
>      argument to --rev if given) is printed.
> +
> +    Please use :hg:`log` instead::
> +
> +        hg children => hg log -r 'children()'
> +        hg children -r REV => hg log -r 'children(REV)'
> +
> +    See :hg:`help log` and :hg:`help revsets.children`.
> +
>      """
>      rev = opts.get('rev')
>      if file_:
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@selenic.com
> https://selenic.com/mailman/listinfo/mercurial-devel
Siddharth Agarwal - Jan. 12, 2016, 3:11 a.m.
On 1/11/16 16:52, Matt Harbison wrote:
> We should probably use double quotes (even though I understand the 
> point in the next patch that it can look weird), because cmd.exe 
> doesn't understand single quotes:
>
>   C:\Users\Matt\Projects\hg>hg log -r 'children()'
>   abort: unknown revision 'children()'!

Yeah. What about doing it the other way round? Ban

"hg log "foo bar""

and

"hg log 'foo bar'"

but allow

'hg log "foo bar"'

Not perfect, but it'll work I guess.
>
> It works fine in MSYS, but I suspect that most Windows users that copy 
> help examples will be using cmd.exe, and not understand quote vs 
> double quote.
>
> This applies to the next two patches as well.  It hasn't stood out to 
> me before, so I'm not sure how much has been converted (or added) 
> already with your previous work on help stuff.
Matt Harbison - Jan. 12, 2016, 3:23 a.m.
On Mon, 11 Jan 2016 22:11:57 -0500, Siddharth Agarwal  
<sid@less-broken.com> wrote:

> On 1/11/16 16:52, Matt Harbison wrote:
>> We should probably use double quotes (even though I understand the  
>> point in the next patch that it can look weird), because cmd.exe  
>> doesn't understand single quotes:
>>
>>   C:\Users\Matt\Projects\hg>hg log -r 'children()'
>>   abort: unknown revision 'children()'!
>
> Yeah. What about doing it the other way round? Ban
>
> "hg log "foo bar""
>
> and
>
> "hg log 'foo bar'"
>
> but allow
>
> 'hg log "foo bar"'
>
> Not perfect, but it'll work I guess.

It seems from the 3 of 8 patch that something is translating '`' -> '"',  
so there might be more than banning one form involved?  But the help  
generation is still magic to me.

I think single quotes on the outside is reasonable, barring some technical  
issue.

>>
>> It works fine in MSYS, but I suspect that most Windows users that copy  
>> help examples will be using cmd.exe, and not understand quote vs double  
>> quote.
>>
>> This applies to the next two patches as well.  It hasn't stood out to  
>> me before, so I'm not sure how much has been converted (or added)  
>> already with your previous work on help stuff.
timeless - Jan. 12, 2016, 7:27 a.m.
Matt Harbison wrote:
> We should probably use double quotes (even though I understand the point
> in the next patch that it can look weird), because cmd.exe doesn't
> understand single quotes:

Yeah, I was aware of that, and was struggling w/ what to do about it.

>   C:\Users\Matt\Projects\hg>hg log -r 'children()'
>   abort: unknown revision 'children()'!

> It works fine in MSYS, but I suspect that most Windows users that copy
> help examples will be using cmd.exe, and not understand quote vs double
> quote.

> This applies to the next two patches as well.  It hasn't stood out to me
> before, so I'm not sure how much has been converted (or added) already with
> your previous work on help stuff.

A quick check shows that `hg help -c ...` doesn't generate any such
content today.
I have definitely sent patches which cause mercurial to generate `"hg help..."`.

And I have recently sent at least one patch which used the wrong quote:
          hg log -r 'sort(all(), date)'

At some point, I'll see about a docchecker for this...

Siddharth Agarwal <sid@less-broken.com> wrote:
> Yeah. What about doing it the other way round? Ban
> "hg log "foo bar""
> and
> "hg log 'foo bar'"
> but allow
> 'hg log "foo bar"'
>
> Not perfect, but it'll work I guess.

Matt Harbison wrote:
> It seems from the 3 of 8 patch that something is translating '`' -> '"', so
> there might be more than banning one form involved?  But the help generation
> is still magic to me.
>
> I think single quotes on the outside is reasonable, barring some technical
> issue.

The reason I didn't go that way at first is that I didn't want to
touch that file.

But, I agree that it's the right approach, so v2 now includes that.

Patch

diff --git a/hgext/children.py b/hgext/children.py
--- a/hgext/children.py
+++ b/hgext/children.py
@@ -40,6 +40,14 @@ 
     be printed. If a file argument is given, revision in which the
     file was last changed (after the working directory revision or the
     argument to --rev if given) is printed.
+
+    Please use :hg:`log` instead::
+
+        hg children => hg log -r 'children()'
+        hg children -r REV => hg log -r 'children(REV)'
+
+    See :hg:`help log` and :hg:`help revsets.children`.
+
     """
     rev = opts.get('rev')
     if file_: