# HG changeset patch # User Boris Feld <boris.f...@octobus.net> # Date 1526993961 -7200 # Tue May 22 14:59:21 2018 +0200 # Node ID d76075d78a860ea2b3e01f3c05969cd0b8839f35 # Parent 2f2232e5f0b60a3dd591ea16dfffc3c0a050acdc # EXP-Topic diff-cleanup # Available At https://bitbucket.org/octobus/mercurial-devel/ # hg pull https://bitbucket.org/octobus/mercurial-devel/ -r d76075d78a86 diff: accept "dict" as diff option
Current callers of `context.diff` needs a simple way to pass diff options (currently as a dictionary). To use it in more places we need to also support the callers who already build a `diffopts` object. For convenience, we add support for passing option either as a `diffopts` object or as a `dict`. diff --git a/mercurial/context.py b/mercurial/context.py --- a/mercurial/context.py +++ b/mercurial/context.py @@ -34,7 +34,6 @@ from . import ( patch, pathutil, phases, - pycompat, repoview, revlog, scmutil, @@ -302,9 +301,8 @@ class basectx(object): ctx2 = self.p1() if ctx2 is not None: ctx2 = self._repo[ctx2] - diffopts = patch.diffopts(self._repo.ui, pycompat.byteskwargs(opts)) return patch.diff(self._repo, ctx2, self, match=match, changes=changes, - opts=diffopts, losedatafn=losedatafn, prefix=prefix, + opts=opts, losedatafn=losedatafn, prefix=prefix, relroot=relroot, copy=copy, hunksfilterfn=hunksfilterfn) diff --git a/mercurial/patch.py b/mercurial/patch.py --- a/mercurial/patch.py +++ b/mercurial/patch.py @@ -2379,6 +2379,8 @@ def diffhunks(repo, node1=None, node2=No if opts is None: opts = mdiff.defaultopts + elif not isinstance(opts, mdiff.diffopts): + opts = diffopts(repo.ui, pycompat.byteskwargs(opts)) if not node1 and not node2: node1 = repo.dirstate.p1() _______________________________________________ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel