##// END OF EJS Templates
context: add a changectx.diff() convenience function...
Steve Borho -
r11097:9651fa5a default
parent child Browse files
Show More
@@ -7,7 +7,7 b''
7
7
8 from node import nullid, nullrev, short, hex
8 from node import nullid, nullrev, short, hex
9 from i18n import _
9 from i18n import _
10 import ancestor, bdiff, error, util, subrepo
10 import ancestor, bdiff, error, util, subrepo, patch
11 import os, errno
11 import os, errno
12
12
13 propertycache = util.propertycache
13 propertycache = util.propertycache
@@ -204,6 +204,14 b' class changectx(object):'
204 def sub(self, path):
204 def sub(self, path):
205 return subrepo.subrepo(self, path)
205 return subrepo.subrepo(self, path)
206
206
207 def diff(self, ctx2=None, match=None):
208 """Returns a diff generator for the given contexts and matcher"""
209 if ctx2 is None:
210 ctx2 = self.p1()
211 if ctx2 is not None and not isinstance(ctx2, changectx):
212 ctx2 = self._repo[ctx2]
213 return patch.diff(self._repo, ctx2.node(), self.node(), match=match)
214
207 class filectx(object):
215 class filectx(object):
208 """A filecontext object makes access to data related to a particular
216 """A filecontext object makes access to data related to a particular
209 filerevision convenient."""
217 filerevision convenient."""
General Comments 0
You need to be logged in to leave comments. Login now