Patchwork D5801: files: respect ui.relative-paths

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

Comments

phabricator - Feb. 3, 2019, 5:46 p.m.
martinvonz updated this revision to Diff 13733.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5801?vs=13699&id=13733

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

AFFECTED FILES
  mercurial/cmdutil.py
  tests/test-locate.t

CHANGE DETAILS




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

Patch

diff --git a/tests/test-locate.t b/tests/test-locate.t
--- a/tests/test-locate.t
+++ b/tests/test-locate.t
@@ -123,6 +123,24 @@ 
   ../t.h
   ../t/e.h
   ../t/x
+  $ hg files --config ui.relative-paths=yes
+  ../b
+  ../dir.h/foo
+  ../t.h
+  ../t/e.h
+  ../t/x
+  $ hg files --config ui.relative-paths=no
+  b
+  dir.h/foo
+  t.h
+  t/e.h
+  t/x
+  $ hg files --config ui.relative-paths=legacy
+  ../b
+  ../dir.h/foo
+  ../t.h
+  ../t/e.h
+  ../t/x
 
   $ hg locate b
   ../b
diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -2162,14 +2162,15 @@ 
     ret = 1
 
     needsfctx = ui.verbose or {'size', 'flags'} & fm.datahint()
+    uipathfn = scmutil.getuipathfn(ctx.repo(), legacyvalue=True)
     for f in ctx.matches(m):
         fm.startitem()
         fm.context(ctx=ctx)
         if needsfctx:
             fc = ctx[f]
             fm.write('size flags', '% 10d % 1s ', fc.size(), fc.flags())
         fm.data(path=f)
-        fm.plain(fmt % m.rel(f))
+        fm.plain(fmt % uipathfn(f))
         ret = 0
 
     for subpath in sorted(ctx.substate):