context: also accept diff option directly
authorBoris Feld <boris.feld@octobus.net>
Sat, 23 Jun 2018 13:19:03 +0100
changeset 38521 c1a7bbf9984d
parent 38520 02633fe3883a
child 38522 54d7aaa243cc
context: also accept diff option directly For now we accept both diff option and dictionary. This will let us upgrade internal users gradually before we drop the old API at the end of this series.
mercurial/context.py
--- a/mercurial/context.py	Wed May 23 15:31:40 2018 +0200
+++ b/mercurial/context.py	Sat Jun 23 13:19:03 2018 +0100
@@ -30,6 +30,7 @@
     error,
     fileset,
     match as matchmod,
+    mdiff,
     obsolete as obsmod,
     patch,
     pathutil,
@@ -302,7 +303,11 @@
             ctx2 = self.p1()
         if ctx2 is not None:
             ctx2 = self._repo[ctx2]
-        diffopts = patch.diffopts(self._repo.ui, opts)
+
+        if isinstance(opts, mdiff.diffopts):
+            diffopts = opts
+        else:
+            diffopts = patch.diffopts(self._repo.ui, opts)
         return patch.diff(self._repo, ctx2, self, match=match, changes=changes,
                           opts=diffopts, losedatafn=losedatafn, prefix=prefix,
                           relroot=relroot, copy=copy,