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.
--- 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,