comparison mercurial/context.py @ 38525: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 62249cfe02d2
comparison
equal deleted inserted replaced
38524:02633fe3883a 38525:c1a7bbf9984d
28 dagop, 28 dagop,
29 encoding, 29 encoding,
30 error, 30 error,
31 fileset, 31 fileset,
32 match as matchmod, 32 match as matchmod,
33 mdiff,
33 obsolete as obsmod, 34 obsolete as obsmod,
34 patch, 35 patch,
35 pathutil, 36 pathutil,
36 phases, 37 phases,
37 pycompat, 38 pycompat,
300 """Returns a diff generator for the given contexts and matcher""" 301 """Returns a diff generator for the given contexts and matcher"""
301 if ctx2 is None: 302 if ctx2 is None:
302 ctx2 = self.p1() 303 ctx2 = self.p1()
303 if ctx2 is not None: 304 if ctx2 is not None:
304 ctx2 = self._repo[ctx2] 305 ctx2 = self._repo[ctx2]
305 diffopts = patch.diffopts(self._repo.ui, opts) 306
307 if isinstance(opts, mdiff.diffopts):
308 diffopts = opts
309 else:
310 diffopts = patch.diffopts(self._repo.ui, opts)
306 return patch.diff(self._repo, ctx2, self, match=match, changes=changes, 311 return patch.diff(self._repo, ctx2, self, match=match, changes=changes,
307 opts=diffopts, losedatafn=losedatafn, prefix=prefix, 312 opts=diffopts, losedatafn=losedatafn, prefix=prefix,
308 relroot=relroot, copy=copy, 313 relroot=relroot, copy=copy,
309 hunksfilterfn=hunksfilterfn) 314 hunksfilterfn=hunksfilterfn)
310 315