##// END OF EJS Templates
dagop: factor out pfunc from revancestors() generator...
Yuya Nishihara -
r33077:58ebb384 default
parent child Browse files
Show More
@@ -38,6 +38,11 b' def _genrevancestors(repo, revs, followf'
38 raise error.ProgrammingError('negative stopdepth')
38 raise error.ProgrammingError('negative stopdepth')
39
39
40 cl = repo.changelog
40 cl = repo.changelog
41 def pfunc(rev):
42 try:
43 return cl.parentrevs(rev)[:cut]
44 except error.WdirUnsupported:
45 return (pctx.rev() for pctx in repo[rev].parents()[:cut])
41
46
42 # load input revs lazily to heap so earlier revisions can be yielded
47 # load input revs lazily to heap so earlier revisions can be yielded
43 # without fully computing the input revs
48 # without fully computing the input revs
@@ -65,14 +70,9 b' def _genrevancestors(repo, revs, followf'
65 yield currev
70 yield currev
66 pdepth = curdepth + 1
71 pdepth = curdepth + 1
67 if foundnew and pdepth < stopdepth:
72 if foundnew and pdepth < stopdepth:
68 try:
73 for prev in pfunc(currev):
69 for prev in cl.parentrevs(currev)[:cut]:
70 if prev != node.nullrev:
74 if prev != node.nullrev:
71 heapq.heappush(pendingheap, (-prev, pdepth))
75 heapq.heappush(pendingheap, (-prev, pdepth))
72 except error.WdirUnsupported:
73 for pctx in repo[currev].parents()[:cut]:
74 if pctx.rev() != node.nullrev:
75 heapq.heappush(pendingheap, (-pctx.rev(), pdepth))
76
76
77 def revancestors(repo, revs, followfirst, startdepth=None, stopdepth=None):
77 def revancestors(repo, revs, followfirst, startdepth=None, stopdepth=None):
78 """Like revlog.ancestors(), but supports additional options, includes
78 """Like revlog.ancestors(), but supports additional options, includes
General Comments 0
You need to be logged in to leave comments. Login now