Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/context.py @ 38523:4455e5d4d59c
context: explicitly take diffopts in `context.diff` (API)
To provide a proper replacement for the `patch.diff(?)` function, the
`context.diff(?)` method needs to be able to take more parameters. To
distinguish the diff options from the new other arguments, we upgrade the diff
options to its own explicit argument.
author | Boris Feld <boris.feld@octobus.net> |
---|---|
date | Tue, 22 May 2018 15:02:52 +0200 |
parents | da2a7d8354b2 |
children | 02633fe3883a |
comparison
equal
deleted
inserted
replaced
38522:cf24f678adda | 38523:4455e5d4d59c |
---|---|
292 return matchmod.match(r.root, r.getcwd(), pats, | 292 return matchmod.match(r.root, r.getcwd(), pats, |
293 include, exclude, default, | 293 include, exclude, default, |
294 auditor=r.nofsauditor, ctx=self, | 294 auditor=r.nofsauditor, ctx=self, |
295 listsubrepos=listsubrepos, badfn=badfn) | 295 listsubrepos=listsubrepos, badfn=badfn) |
296 | 296 |
297 def diff(self, ctx2=None, match=None, **opts): | 297 def diff(self, ctx2=None, match=None, opts=None): |
298 """Returns a diff generator for the given contexts and matcher""" | 298 """Returns a diff generator for the given contexts and matcher""" |
299 if ctx2 is None: | 299 if ctx2 is None: |
300 ctx2 = self.p1() | 300 ctx2 = self.p1() |
301 if ctx2 is not None: | 301 if ctx2 is not None: |
302 ctx2 = self._repo[ctx2] | 302 ctx2 = self._repo[ctx2] |
303 diffopts = patch.diffopts(self._repo.ui, pycompat.byteskwargs(opts)) | 303 diffopts = patch.diffopts(self._repo.ui, opts) |
304 return patch.diff(self._repo, ctx2, self, match=match, opts=diffopts) | 304 return patch.diff(self._repo, ctx2, self, match=match, opts=diffopts) |
305 | 305 |
306 def dirs(self): | 306 def dirs(self): |
307 return self._manifest.dirs() | 307 return self._manifest.dirs() |
308 | 308 |