Patchwork commit: add some help examples (issue4963)

login
register
mail settings
Submitter Augie Fackler
Date Dec. 4, 2015, 8:50 p.m.
Message ID <f19bf31bc4b064ab4fd2.1449262212@arthedain.pit.corp.google.com>
Download mbox | patch
Permalink /patch/11821/
State Accepted
Headers show

Comments

Augie Fackler - Dec. 4, 2015, 8:50 p.m.
# HG changeset patch
# User Augie Fackler <augie@google.com>
# Date 1449260645 18000
#      Fri Dec 04 15:24:05 2015 -0500
# Node ID f19bf31bc4b064ab4fd2f331f9f5a868f5b9b0f7
# Parent  79db86a0884617202808e979181819df2faaf0c2
commit: add some help examples (issue4963)

Includes documenting --date now, which resolves the above issue.
Anton Shestakov - Dec. 4, 2015, 8:57 p.m.
05.12.2015, 04:51, "Augie Fackler" <raf@durin42.com>:
> # HG changeset patch
> # User Augie Fackler <augie@google.com>
> # Date 1449260645 18000
> # Fri Dec 04 15:24:05 2015 -0500
> # Node ID f19bf31bc4b064ab4fd2f331f9f5a868f5b9b0f7
> # Parent 79db86a0884617202808e979181819df2faaf0c2
> commit: add some help examples (issue4963)
>
> Includes documenting --date now, which resolves the above issue.
>
> diff --git a/mercurial/commands.py b/mercurial/commands.py
> --- a/mercurial/commands.py
> +++ b/mercurial/commands.py
> @@ -1585,6 +1585,22 @@ def commit(ui, repo, *pats, **opts):
>      See :hg:`help dates` for a list of formats valid for -d/--date.
>
>      Returns 0 on success, 1 if nothing changed.
> +
> + .. container:: verbose
> +
> + Examples:
> +
> + - commit all files ending in .py:
> +
> + hg commit --include 'set:**.py$'

Unless $ is required due to some reST quirk, it shouldn't be used, since ** means a glob, not a regex. In fact:

$ hg commit --include 'set:**.py$'
hg: parse error at 5: syntax error
Augie Fackler - Dec. 4, 2015, 8:59 p.m.
On Fri, Dec 4, 2015 at 3:57 PM, Anton Shestakov <engored@ya.ru> wrote:
> 05.12.2015, 04:51, "Augie Fackler" <raf@durin42.com>:
>> # HG changeset patch
>> # User Augie Fackler <augie@google.com>
>> # Date 1449260645 18000
>> # Fri Dec 04 15:24:05 2015 -0500
>> # Node ID f19bf31bc4b064ab4fd2f331f9f5a868f5b9b0f7
>> # Parent 79db86a0884617202808e979181819df2faaf0c2
>> commit: add some help examples (issue4963)
>>
>> Includes documenting --date now, which resolves the above issue.
>>
>> diff --git a/mercurial/commands.py b/mercurial/commands.py
>> --- a/mercurial/commands.py
>> +++ b/mercurial/commands.py
>> @@ -1585,6 +1585,22 @@ def commit(ui, repo, *pats, **opts):
>>      See :hg:`help dates` for a list of formats valid for -d/--date.
>>
>>      Returns 0 on success, 1 if nothing changed.
>> +
>> + .. container:: verbose
>> +
>> + Examples:
>> +
>> + - commit all files ending in .py:
>> +
>> + hg commit --include 'set:**.py
>
>
> Unless $ is required due to some reST quirk, it shouldn't be used, since ** means a glob, not a regex. In fact:
>
> $ hg commit --include 'set:**.py
> hg: parse error at 5: syntax error


Yep, this had started as a regexp. Oops. Can someone fix it in flight?
Pierre-Yves David - Dec. 5, 2015, 12:20 a.m.
On 12/04/2015 12:59 PM, Augie Fackler wrote:
> On Fri, Dec 4, 2015 at 3:57 PM, Anton Shestakov <engored@ya.ru> wrote:
>> 05.12.2015, 04:51, "Augie Fackler" <raf@durin42.com>:
>>> # HG changeset patch
>>> # User Augie Fackler <augie@google.com>
>>> # Date 1449260645 18000
>>> # Fri Dec 04 15:24:05 2015 -0500
>>> # Node ID f19bf31bc4b064ab4fd2f331f9f5a868f5b9b0f7
>>> # Parent 79db86a0884617202808e979181819df2faaf0c2
>>> commit: add some help examples (issue4963)
>>>
>>> Includes documenting --date now, which resolves the above issue.
>>>
>>> diff --git a/mercurial/commands.py b/mercurial/commands.py
>>> --- a/mercurial/commands.py
>>> +++ b/mercurial/commands.py
>>> @@ -1585,6 +1585,22 @@ def commit(ui, repo, *pats, **opts):
>>>       See :hg:`help dates` for a list of formats valid for -d/--date.
>>>
>>>       Returns 0 on success, 1 if nothing changed.
>>> +
>>> + .. container:: verbose
>>> +
>>> + Examples:
>>> +
>>> + - commit all files ending in .py:
>>> +
>>> + hg commit --include 'set:**.py
>>
>>
>> Unless $ is required due to some reST quirk, it shouldn't be used, since ** means a glob, not a regex. In fact:
>>
>> $ hg commit --include 'set:**.py
>> hg: parse error at 5: syntax error
>
>
> Yep, this had started as a regexp. Oops. Can someone fix it in flight?

This is pushed to the clowncopter, fixed in-flight.

Patch

diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -1585,6 +1585,22 @@  def commit(ui, repo, *pats, **opts):
     See :hg:`help dates` for a list of formats valid for -d/--date.
 
     Returns 0 on success, 1 if nothing changed.
+
+    .. container:: verbose
+
+      Examples:
+
+      - commit all files ending in .py:
+
+          hg commit --include 'set:**.py$'
+
+      - commit all non-binary files:
+
+          hg commit --exclude 'set:binary()'
+
+      - amend the current commit and set the date to now:
+
+          hg commit --amend --date now
     """
     wlock = lock = None
     try: