Mercurial > public > mercurial-scm > hg
diff mercurial/context.py @ 41646:d4c9eebdd72d
patch: replace "prefix" and "relroot" arguments by "pathfn" (API)
The two arguments serve a very similar purpose: "relroot" is stripped
from the front of the path, and then "prefix" (a subrepo path) is
added (also to the front). Passing in a function that does that is
more generic and will make it easier to respect ui.relative-paths in
later patches (don't worry, I'm not going to respect that option for
regular patches, only for --stat). I'm deliberately not calling it
"uipathfn", because it's generally for producing valid diffs
(including when prefix is non-empty), so things like using backslash
on Windows is not an option.
Differential Revision: https://phab.mercurial-scm.org/D5894
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Wed, 06 Feb 2019 23:12:56 -0800 |
parents | 74f53d3bd685 |
children | a4358f7345b4 |
line wrap: on
line diff
--- a/mercurial/context.py Sat Feb 09 01:24:32 2019 +0100 +++ b/mercurial/context.py Wed Feb 06 23:12:56 2019 -0800 @@ -294,7 +294,7 @@ listsubrepos=listsubrepos, badfn=badfn) def diff(self, ctx2=None, match=None, changes=None, opts=None, - losedatafn=None, prefix='', relroot='', copy=None, + losedatafn=None, pathfn=None, copy=None, copysourcematch=None, hunksfilterfn=None): """Returns a diff generator for the given contexts and matcher""" if ctx2 is None: @@ -302,9 +302,8 @@ if ctx2 is not None: ctx2 = self._repo[ctx2] return patch.diff(self._repo, ctx2, self, match=match, changes=changes, - opts=opts, losedatafn=losedatafn, prefix=prefix, - relroot=relroot, copy=copy, - copysourcematch=copysourcematch, + opts=opts, losedatafn=losedatafn, pathfn=pathfn, + copy=copy, copysourcematch=copysourcematch, hunksfilterfn=hunksfilterfn) def dirs(self):