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, forcerelativevalue=relative) + forcerelativevalue = None + if ui.hasconfig('commands', 'status.relative'): + forcerelativevalue = ui.configbool('commands', 'status.relative') + uipathfn = scmutil.getuipathfn(repo, legacyrelativevalue=bool(pats), + forcerelativevalue=forcerelativevalue) if opts.get('print0'): end = '\0' diff --git a/tests/test-status.t b/tests/test-status.t --- a/tests/test-status.t +++ b/tests/test-status.t @@ -132,11 +132,7 @@ relative paths can be requested - $ cat >> $HGRCPATH < [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 @@ -144,6 +140,13 @@ ? ../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 <