# HG changeset patch # User Martin von Zweigbergk # Date 2019-01-29 23:49:20 # Node ID 15f63ac122ea3ee97c67e868d055c3c310725fe4 # Parent aec185af621eed82f397495614f995764e75f91d files: respect ui.relative-paths Differential Revision: https://phab.mercurial-scm.org/D5801 diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py --- a/mercurial/cmdutil.py +++ b/mercurial/cmdutil.py @@ -2164,6 +2164,7 @@ def files(ui, ctx, m, fm, fmt, subrepos) ret = 1 needsfctx = ui.verbose or {'size', 'flags'} & fm.datahint() + uipathfn = scmutil.getuipathfn(ctx.repo(), legacyrelativevalue=True) for f in ctx.matches(m): fm.startitem() fm.context(ctx=ctx) @@ -2171,7 +2172,7 @@ def files(ui, ctx, m, fm, fmt, subrepos) 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): 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 @@ Issue294: hg remove --after dir fails wh ../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