D5802: status: if ui.relative-paths=no, don't use relative paths even with patterns

martinvonz (Martin von Zweigbergk) phabricator at mercurial-scm.org
Sun Feb 3 12:47:18 EST 2019


martinvonz updated this revision to Diff 13734.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5802?vs=13700&id=13734

REVISION DETAIL
  https://phab.mercurial-scm.org/D5802

AFFECTED FILES
  mercurial/commands.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
@@ -132,18 +132,21 @@
 
 relative paths can be requested
 
-  $ cat >> $HGRCPATH <<EOF
-  > [ui]
-  > relative-paths = True
-  > EOF
-  $ hg status --cwd a
+  $ hg status --cwd a --config ui.relative-paths=yes
   ? 1/in_a_1
   ? in_a
   ? ../b/1/in_b_1
   ? ../b/2/in_b_2
   ? ../b/in_b
   ? ../in_root
 
+  $ hg status --cwd a . --config ui.relative-paths=legacy
+  ? 1/in_a_1
+  ? in_a
+  $ hg status --cwd a . --config ui.relative-paths=no
+  ? a/1/in_a_1
+  ? a/in_a
+
 commands.status.relative overrides ui.relative-paths
 
   $ cat >> $HGRCPATH <<EOF
diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -5416,12 +5416,11 @@
         repo = scmutil.unhidehashlikerevs(repo, revs, 'nowarn')
         ctx1, ctx2 = scmutil.revpair(repo, revs)
 
-    relative = None
-    if pats:
-        relative = True
-    elif ui.hasconfig('commands', 'status.relative'):
-        relative = ui.configbool('commands', 'status.relative')
-    uipathfn = scmutil.getuipathfn(repo, forceto=relative)
+    forceto = None
+    if ui.hasconfig('commands', 'status.relative'):
+        forceto = ui.configbool('commands', 'status.relative')
+    uipathfn = scmutil.getuipathfn(repo, legacyvalue=bool(pats),
+                                   forceto=forceto)
 
     if opts.get('print0'):
         end = '\0'



To: martinvonz, #hg-reviewers
Cc: mercurial-devel


More information about the Mercurial-devel mailing list