[PATCH 2 of 2 V2] status: support commands.status.relative config

Augie Fackler raf at durin42.com
Thu Mar 23 11:26:40 EDT 2017


On Thu, Mar 23, 2017 at 09:49:35AM +0000, Ryan McElroy wrote:
> On 3/22/17 4:25 PM, Martin von Zweigbergk via Mercurial-devel wrote:
> ># HG changeset patch
> ># User Martin von Zweigbergk <martinvonz at google.com>
> ># Date 1490143844 25200
> >#      Tue Mar 21 17:50:44 2017 -0700
> ># Node ID 32fb4dfa78cb43ac9d6b42dcd9e8735bf02cefe4
> ># Parent  1ed5ec882c49934a16428fc72e7a366f39747cc5
> >status: support commands.status.relative config
>
> This series looks good to me.

Agreed, queued.

>
> >
> >When the config is set to true, status output becomes relative to the
> >working directory. This has bugged me since I started using hg and it
> >turns it is sillily simple to support it (unless I missed something,
> >of course).
> >
> >We could also add a --relative flag, but I would personally always
> >want that on, and I haven't heard any use for having it sometimes on,
> >so this patch only lets you enable it via config.
> >
> >diff -r 1ed5ec882c49 -r 32fb4dfa78cb mercurial/commands.py
> >--- a/mercurial/commands.py	Tue Mar 21 21:26:52 2017 -0700
> >+++ b/mercurial/commands.py	Tue Mar 21 17:50:44 2017 -0700
> >@@ -4734,7 +4734,7 @@
> >      else:
> >          node1, node2 = scmutil.revpair(repo, revs)
> >-    if pats:
> >+    if pats or ui.configbool('commands', 'status.relative'):
> >          cwd = repo.getcwd()
> >      else:
> >          cwd = ''
> >diff -r 1ed5ec882c49 -r 32fb4dfa78cb mercurial/help/config.txt
> >--- a/mercurial/help/config.txt	Tue Mar 21 21:26:52 2017 -0700
> >+++ b/mercurial/help/config.txt	Tue Mar 21 17:50:44 2017 -0700
> >@@ -417,6 +417,10 @@
> >  ``commands``
> >  ----------
> >+``status.relative``
> >+    Make paths in ``hg status`` output relative to the current directory.
> >+    (default: False)
> >+
> >  ``update.requiredest``
> >      Require that the user pass a destination when running ``hg update``.
> >      For example, ``hg update .::`` will be allowed, but a plain ``hg update``
> >diff -r 1ed5ec882c49 -r 32fb4dfa78cb tests/test-status.t
> >--- a/tests/test-status.t	Tue Mar 21 21:26:52 2017 -0700
> >+++ b/tests/test-status.t	Tue Mar 21 17:50:44 2017 -0700
> >@@ -107,6 +107,27 @@
> >    ? a/in_a
> >    ? b/in_b
> >+relative paths can be requested
> >+
> >+  $ cat >> $HGRCPATH <<EOF
> >+  > [commands]
> >+  > status.relative = True
> >+  > EOF
> >+  $ hg status --cwd a
> >+  ? 1/in_a_1
> >+  ? in_a
> >+  ? ../b/1/in_b_1
> >+  ? ../b/2/in_b_2
> >+  ? ../b/in_b
> >+  ? ../in_root
> >+  $ HGPLAIN=1 hg status --cwd a
> >+  ? a/1/in_a_1
> >+  ? a/in_a
> >+  ? b/1/in_b_1
> >+  ? b/2/in_b_2
> >+  ? b/in_b
> >+  ? in_root
> >+
> >    $ cd ..
> >    $ hg init repo2
> >
>
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


More information about the Mercurial-devel mailing list