Mercurial > hg
changeset 19564:f0ed47b73d37
basectx: move diff from changectx
author | Sean Farley <sean.michael.farley@gmail.com> |
---|---|
date | Mon, 05 Aug 2013 18:41:12 -0500 |
parents | 87503cd824fa |
children | bd1580a9c133 |
files | mercurial/context.py |
diffstat | 1 files changed, 10 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/context.py Mon Aug 05 18:41:00 2013 -0500 +++ b/mercurial/context.py Mon Aug 05 18:41:12 2013 -0500 @@ -128,6 +128,16 @@ include, exclude, default, auditor=r.auditor, ctx=self) + def diff(self, ctx2=None, match=None, **opts): + """Returns a diff generator for the given contexts and matcher""" + if ctx2 is None: + ctx2 = self.p1() + if ctx2 is not None and not isinstance(ctx2, changectx): + ctx2 = self._repo[ctx2] + diffopts = patch.diffopts(self._repo.ui, opts) + return patch.diff(self._repo, ctx2.node(), self.node(), + match=match, opts=diffopts) + class changectx(basectx): """A changecontext object makes access to data related to a particular changeset convenient. It represents a read-only context already presnt in @@ -389,16 +399,6 @@ if match.bad(fn, _('no such file in rev %s') % self) and match(fn): yield fn - def diff(self, ctx2=None, match=None, **opts): - """Returns a diff generator for the given contexts and matcher""" - if ctx2 is None: - ctx2 = self.p1() - if ctx2 is not None and not isinstance(ctx2, changectx): - ctx2 = self._repo[ctx2] - diffopts = patch.diffopts(self._repo.ui, opts) - return patch.diff(self._repo, ctx2.node(), self.node(), - match=match, opts=diffopts) - @propertycache def _dirs(self): return scmutil.dirs(self._manifest)