Patchwork Correct example concerning "hg purge" alias in "hgrc.5"

login
register
mail settings
Submitter Dr Rainer Woitok
Date Feb. 20, 2016, 5:37 p.m.
Message ID <22216.42065.889000.345853@woitok.gmail.com>
Download mbox | patch
Permalink /patch/13274/
State Accepted
Delegated to: Yuya Nishihara
Headers show

Comments

Dr Rainer Woitok - Feb. 20, 2016, 5:37 p.m.
Yuya,

On Saturday, 2016-02-20 12:52:45 +0900, you wrote:

> ...
> You could make status output relative.
> 
>     status --no-status --unknown -0 re:

Nice trick that evaded me for years :-)

> https://selenic.com/repo/hg/help/status

This contains  this example, yes.   But doesn't care  to explain  why it
works.  What's probably  missing in "hg.1"  is some hint that when files
are specified on the command line,  they will be listed  relative to the
current directory in the output.

Anyway, below's the new patch.

Sincerely,
  Rainer

# HG changeset patch
# User Rainer Woitok <Rainer.Woitok@Gmail.Com>
# Date 1455985946 -3600
#      Sat Feb 20 17:32:26 2016 +0100
# Branch stable
# Node ID d9d9844f921c0712f8b9d6da7017328168af20df
# Parent  4c6053a6b17d682b34fb88bbeb5e94ed9085d900
doc: correct example concerning "hg purge" alias in man page "hgrc.5"

The "hg purge" alias as currently described in "hgrc.5" only works, if
the caller's current working directory is identical to the repository's
root directory.

This patch slightly modifies the example by adding an empty pattern as a
file argument to the "hg status" command, thus forcing this command to
list the affected files relative to the current directory.
Yuya Nishihara - Feb. 21, 2016, 3:55 a.m.
On Sat, 20 Feb 2016 18:37:21 +0100, Dr Rainer Woitok wrote:
> > https://selenic.com/repo/hg/help/status
> 
> This contains  this example, yes.   But doesn't care  to explain  why it
> works.  What's probably  missing in "hg.1"  is some hint that when files
> are specified on the command line,  they will be listed  relative to the
> current directory in the output.

IIRC, files and patterns are relative to cwd in general, but "hg status"
(with no pattern) is different due to backward compatibility.

> # HG changeset patch
> # User Rainer Woitok <Rainer.Woitok@Gmail.Com>
> # Date 1455985946 -3600
> #      Sat Feb 20 17:32:26 2016 +0100
> # Branch stable
> # Node ID d9d9844f921c0712f8b9d6da7017328168af20df
> # Parent  4c6053a6b17d682b34fb88bbeb5e94ed9085d900
> doc: correct example concerning "hg purge" alias in man page "hgrc.5"

Queued this for stable, thanks.
Dr Rainer Woitok - Feb. 21, 2016, 5:06 p.m.
Yuya,

On Sunday, 2016-02-21 12:55:21 +0900, you wrote:

> ...
> IIRC, files and patterns are relative to cwd in general, but "hg status"
> (with no pattern) is different due to backward compatibility.

And exactly this should clearly be documented in the "status" section of
the "hg.1" manual page.  But I've already  seen that this manual page is
plumbed together from a variety of sources, including the doc strings of
"*.py" files, so maintaining it is not that easy.

> ...
> > doc: correct example concerning "hg purge" alias in man page "hgrc.5"
> 
> Queued this for stable, thanks.

You are welcome ... :-)

Sincerely,
  Rainer

Patch

diff --git a/mercurial/help/config.txt b/mercurial/help/config.txt
--- a/mercurial/help/config.txt
+++ b/mercurial/help/config.txt
@@ -276,7 +276,7 @@ 
 will let you do ``hg echo foo`` to have ``foo`` printed in your
 terminal. A better example might be::
 
-   purge = !$HG status --no-status --unknown -0 | xargs -0 rm
+   purge = !$HG status --no-status --unknown -0 re: | xargs -0 rm
 
 which will make ``hg purge`` delete all unknown files in the
 repository in the same manner as the purge extension.