##// END OF EJS Templates
ancestor.lazyancestors: take parentrevs function rather than changelog...
Siddharth Agarwal -
r23328:3a7d9c0c default
parent child Browse files
Show More
@@ -216,7 +216,7 b' def missingancestors(revs, bases, pfunc)'
216 return missing
216 return missing
217
217
218 class lazyancestors(object):
218 class lazyancestors(object):
219 def __init__(self, cl, revs, stoprev=0, inclusive=False):
219 def __init__(self, pfunc, revs, stoprev=0, inclusive=False):
220 """Create a new object generating ancestors for the given revs. Does
220 """Create a new object generating ancestors for the given revs. Does
221 not generate revs lower than stoprev.
221 not generate revs lower than stoprev.
222
222
@@ -228,7 +228,7 b' class lazyancestors(object):'
228 than stoprev will not be generated.
228 than stoprev will not be generated.
229
229
230 Result does not include the null revision."""
230 Result does not include the null revision."""
231 self._parentrevs = cl.parentrevs
231 self._parentrevs = pfunc
232 self._initrevs = revs
232 self._initrevs = revs
233 self._stoprev = stoprev
233 self._stoprev = stoprev
234 self._inclusive = inclusive
234 self._inclusive = inclusive
@@ -407,7 +407,7 b' class revlog(object):'
407
407
408 See the documentation for ancestor.lazyancestors for more details."""
408 See the documentation for ancestor.lazyancestors for more details."""
409
409
410 return ancestor.lazyancestors(self, revs, stoprev=stoprev,
410 return ancestor.lazyancestors(self.parentrevs, revs, stoprev=stoprev,
411 inclusive=inclusive)
411 inclusive=inclusive)
412
412
413 def descendants(self, revs):
413 def descendants(self, revs):
@@ -34,9 +34,6 b' graph = {0: [-1], 1: [0], 2: [1], 3: [1]'
34 13: [8]}
34 13: [8]}
35 pfunc = graph.get
35 pfunc = graph.get
36
36
37 class mockchangelog(object):
38 parentrevs = graph.get
39
40 def runmissingancestors(revs, bases):
37 def runmissingancestors(revs, bases):
41 print "%% ancestors of %s and not of %s" % (revs, bases)
38 print "%% ancestors of %s and not of %s" % (revs, bases)
42 print ancestor.missingancestors(revs, bases, pfunc)
39 print ancestor.missingancestors(revs, bases, pfunc)
@@ -76,7 +73,7 b' def test_missingancestors():'
76 def genlazyancestors(revs, stoprev=0, inclusive=False):
73 def genlazyancestors(revs, stoprev=0, inclusive=False):
77 print ("%% lazy ancestor set for %s, stoprev = %s, inclusive = %s" %
74 print ("%% lazy ancestor set for %s, stoprev = %s, inclusive = %s" %
78 (revs, stoprev, inclusive))
75 (revs, stoprev, inclusive))
79 return ancestor.lazyancestors(mockchangelog, revs, stoprev=stoprev,
76 return ancestor.lazyancestors(graph.get, revs, stoprev=stoprev,
80 inclusive=inclusive)
77 inclusive=inclusive)
81
78
82 def printlazyancestors(s, l):
79 def printlazyancestors(s, l):
General Comments 0
You need to be logged in to leave comments. Login now