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

login
register
mail settings
Submitter phabricator
Date Feb. 3, 2019, 5:47 p.m.
Message ID <e91c8b8a9b1968a357aad547273ceec0@localhost.localdomain>
Download mbox | patch
Permalink /patch/38354/
State Not Applicable
Headers show

Comments

phabricator - Feb. 3, 2019, 5:47 p.m.
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




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

Patch

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'