Patchwork D5895: diff: make `hg diff --root=subrepo` work

login
register
mail settings
Submitter phabricator
Date Feb. 10, 2019, 3:37 a.m.
Message ID <38a1f847f155117808f0a02f68366bf5@localhost.localdomain>
Download mbox | patch
Permalink /patch/38624/
State Not Applicable
Headers show

Comments

phabricator - Feb. 10, 2019, 3:37 a.m.
This revision was automatically updated to reflect the committed changes.
Closed by commit rHGec37db02fc72: diff: make `hg diff --root=subrepo` work (authored by martinvonz, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5895?vs=13909&id=13979

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

AFFECTED FILES
  mercurial/logcmdutil.py

CHANGE DETAILS




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

Patch

diff --git a/mercurial/logcmdutil.py b/mercurial/logcmdutil.py
--- a/mercurial/logcmdutil.py
+++ b/mercurial/logcmdutil.py
@@ -66,6 +66,8 @@ 
     else:
         relroot = ''
     copysourcematch = None
+    def compose(f, g):
+        return lambda x: f(g(x))
     def pathfn(f):
         return posixpath.join(prefix, f)
     if relroot != '':
@@ -84,11 +86,12 @@ 
 
         checkroot = (repo.ui.configbool('devel', 'all-warnings') or
                      repo.ui.configbool('devel', 'check-relroot'))
-        def pathfn(f):
+        def relrootpathfn(f):
             if checkroot and not f.startswith(relroot):
                 raise AssertionError(
                     "file %s doesn't start with relroot %s" % (f, relroot))
-            return posixpath.join(prefix, f[len(relroot):])
+            return f[len(relroot):]
+        pathfn = compose(relrootpathfn, pathfn)
 
     if stat:
         diffopts = diffopts.copy(context=0, noprefix=False)