changeset 38521:c1a7bbf9984d

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.
author Boris Feld <boris.feld@octobus.net>
date Sat, 23 Jun 2018 13:19:03 +0100
parents 02633fe3883a
children 54d7aaa243cc
files mercurial/context.py
diffstat 1 files changed, 6 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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,