diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -4734,7 +4734,7 @@ def status(ui, repo, *pats, **opts): else: node1, node2 = scmutil.revpair(repo, revs) - if pats: + if pats or ui.configbool('commands', 'status.relative'): cwd = repo.getcwd() else: cwd = '' diff --git a/mercurial/help/config.txt b/mercurial/help/config.txt --- a/mercurial/help/config.txt +++ b/mercurial/help/config.txt @@ -417,6 +417,10 @@ effect and style see :hg:`help color`. ``commands`` ---------- +``status.relative`` + Make paths in ``hg status`` output relative to the current directory. + (default: False) + ``update.requiredest`` Require that the user pass a destination when running ``hg update``. For example, ``hg update .::`` will be allowed, but a plain ``hg update`` diff --git a/tests/test-status.t b/tests/test-status.t --- a/tests/test-status.t +++ b/tests/test-status.t @@ -107,6 +107,27 @@ combining patterns with root and pattern ? a/in_a ? b/in_b +relative paths can be requested + + $ cat >> $HGRCPATH < [commands] + > status.relative = True + > EOF + $ hg status --cwd a + ? 1/in_a_1 + ? in_a + ? ../b/1/in_b_1 + ? ../b/2/in_b_2 + ? ../b/in_b + ? ../in_root + $ HGPLAIN=1 hg status --cwd a + ? a/1/in_a_1 + ? a/in_a + ? b/1/in_b_1 + ? b/2/in_b_2 + ? b/in_b + ? in_root + $ cd .. $ hg init repo2