Patchwork D5896: diff: make --stat respect ui.relative-paths

login
register
mail settings
Submitter phabricator
Date Feb. 11, 2019, 1:59 a.m.
Message ID <870cc39a748ab434df5ff39386f3de44@localhost.localdomain>
Download mbox | patch
Permalink /patch/38656/
State Not Applicable
Headers show

Comments

phabricator - Feb. 11, 2019, 1:59 a.m.
This revision was automatically updated to reflect the committed changes.
Closed by commit rHGdb69a763bc89: diff: make --stat respect ui.relative-paths (authored by martinvonz, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5896?vs=14001&id=14011

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

AFFECTED FILES
  mercurial/logcmdutil.py
  tests/test-diffstat.t

CHANGE DETAILS




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

Patch

diff --git a/tests/test-diffstat.t b/tests/test-diffstat.t
--- a/tests/test-diffstat.t
+++ b/tests/test-diffstat.t
@@ -146,10 +146,21 @@ 
   $ hg diff --stat .
    dir1/new |  1 +
    1 files changed, 1 insertions(+), 0 deletions(-)
+  $ hg diff --stat . --config ui.relative-paths=yes
+   new |  1 +
+   1 files changed, 1 insertions(+), 0 deletions(-)
   $ hg diff --stat --root .
    new |  1 +
    1 files changed, 1 insertions(+), 0 deletions(-)
 
+  $ hg diff --stat --root . --config ui.relative-paths=yes
+   new |  1 +
+   1 files changed, 1 insertions(+), 0 deletions(-)
+--root trumps ui.relative-paths
+  $ hg diff --stat --root .. --config ui.relative-paths=yes
+   new         |  1 +
+   ../dir2/new |  1 +
+   2 files changed, 2 insertions(+), 0 deletions(-)
   $ hg diff --stat --root ../dir1 ../dir2
   warning: ../dir2 not inside relative root .
 
diff --git a/mercurial/logcmdutil.py b/mercurial/logcmdutil.py
--- a/mercurial/logcmdutil.py
+++ b/mercurial/logcmdutil.py
@@ -99,6 +99,9 @@ 
         width = 80
         if not ui.plain():
             width = ui.termwidth() - graphwidth
+        # If an explicit --root was given, don't respect ui.relative-paths
+        if not relroot:
+            pathfn = compose(scmutil.getuipathfn(repo), pathfn)
 
     chunks = ctx2.diff(ctx1, match, changes, opts=diffopts, pathfn=pathfn,
                        copysourcematch=copysourcematch,