D5746: status: introduce higher-level ui.relative-paths
martinvonz (Martin von Zweigbergk)
phabricator at mercurial-scm.org
Thu Jan 31 16:27:45 EST 2019
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG784594080ad4: status: introduce higher-level ui.relative-paths (authored by martinvonz, committed by ).
REPOSITORY
rHG Mercurial
CHANGES SINCE LAST UPDATE
https://phab.mercurial-scm.org/D5746?vs=13575&id=13650
REVISION DETAIL
https://phab.mercurial-scm.org/D5746
AFFECTED FILES
mercurial/commands.py
mercurial/configitems.py
mercurial/help/config.txt
mercurial/scmutil.py
tests/test-status.t
CHANGE DETAILS
diff --git a/tests/test-status.t b/tests/test-status.t
--- a/tests/test-status.t
+++ b/tests/test-status.t
@@ -133,6 +133,22 @@
relative paths can be requested
$ cat >> $HGRCPATH <<EOF
+ > [ui]
+ > relative-paths = 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
+
+commands.status.relative overrides ui.relative-paths
+
+ $ cat >> $HGRCPATH <<EOF
+ > [ui]
+ > relative-paths = False
> [commands]
> status.relative = True
> EOF
diff --git a/mercurial/scmutil.py b/mercurial/scmutil.py
--- a/mercurial/scmutil.py
+++ b/mercurial/scmutil.py
@@ -725,7 +725,9 @@
return []
return parents
-def getuipathfn(repo, relative):
+def getuipathfn(repo, relative=None):
+ if relative is None:
+ relative = repo.ui.configbool('ui', 'relative-paths')
if relative:
cwd = repo.getcwd()
pathto = repo.pathto
diff --git a/mercurial/help/config.txt b/mercurial/help/config.txt
--- a/mercurial/help/config.txt
+++ b/mercurial/help/config.txt
@@ -2331,6 +2331,9 @@
Reduce the amount of output printed.
(default: False)
+``relative-paths``
+ Prefer relative paths in the UI.
+
``remotecmd``
Remote command to use for clone/push/pull operations.
(default: ``hg``)
diff --git a/mercurial/configitems.py b/mercurial/configitems.py
--- a/mercurial/configitems.py
+++ b/mercurial/configitems.py
@@ -1233,6 +1233,9 @@
coreconfigitem('ui', 'quietbookmarkmove',
default=False,
)
+coreconfigitem('ui', 'relative-paths',
+ default=False,
+)
coreconfigitem('ui', 'remotecmd',
default='hg',
)
diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -5414,7 +5414,11 @@
repo = scmutil.unhidehashlikerevs(repo, revs, 'nowarn')
ctx1, ctx2 = scmutil.revpair(repo, revs)
- relative = pats or ui.configbool('commands', 'status.relative'):
+ relative = None
+ if pats:
+ relative = True
+ elif ui.hasconfig('commands', 'status.relative'):
+ relative = ui.configbool('commands', 'status.relative')
uipathfn = scmutil.getuipathfn(repo, relative)
if opts.get('print0'):
To: martinvonz, #hg-reviewers, pulkit
Cc: mercurial-devel
More information about the Mercurial-devel
mailing list