Show More
@@ -31,30 +31,32 b' def _genrevancestors(repo, revs, followf' | |||||
31 | # without fully computing the input revs |
|
31 | # without fully computing the input revs | |
32 | revs.sort(reverse=True) |
|
32 | revs.sort(reverse=True) | |
33 | irevs = iter(revs) |
|
33 | irevs = iter(revs) | |
34 | pendingheap = [] |
|
34 | pendingheap = [] # [(-rev, depth), ...] (i.e. lower depth first) | |
35 |
|
35 | |||
36 | inputrev = next(irevs, None) |
|
36 | inputrev = next(irevs, None) | |
37 | if inputrev is not None: |
|
37 | if inputrev is not None: | |
38 | heapq.heappush(pendingheap, -inputrev) |
|
38 | heapq.heappush(pendingheap, (-inputrev, 0)) | |
39 |
|
39 | |||
40 | lastrev = None |
|
40 | lastrev = None | |
41 | while pendingheap: |
|
41 | while pendingheap: | |
42 |
currev = |
|
42 | currev, curdepth = heapq.heappop(pendingheap) | |
|
43 | currev = -currev | |||
43 | if currev == inputrev: |
|
44 | if currev == inputrev: | |
44 | inputrev = next(irevs, None) |
|
45 | inputrev = next(irevs, None) | |
45 | if inputrev is not None: |
|
46 | if inputrev is not None: | |
46 | heapq.heappush(pendingheap, -inputrev) |
|
47 | heapq.heappush(pendingheap, (-inputrev, 0)) | |
47 | if currev != lastrev: |
|
48 | if currev != lastrev: | |
48 | lastrev = currev |
|
49 | lastrev = currev | |
49 | yield currev |
|
50 | yield currev | |
|
51 | pdepth = curdepth + 1 | |||
50 | try: |
|
52 | try: | |
51 | for prev in cl.parentrevs(currev)[:cut]: |
|
53 | for prev in cl.parentrevs(currev)[:cut]: | |
52 | if prev != node.nullrev: |
|
54 | if prev != node.nullrev: | |
53 | heapq.heappush(pendingheap, -prev) |
|
55 | heapq.heappush(pendingheap, (-prev, pdepth)) | |
54 | except error.WdirUnsupported: |
|
56 | except error.WdirUnsupported: | |
55 | for pctx in repo[currev].parents()[:cut]: |
|
57 | for pctx in repo[currev].parents()[:cut]: | |
56 | if pctx.rev() != node.nullrev: |
|
58 | if pctx.rev() != node.nullrev: | |
57 | heapq.heappush(pendingheap, -pctx.rev()) |
|
59 | heapq.heappush(pendingheap, (-pctx.rev(), pdepth)) | |
58 |
|
60 | |||
59 | def revancestors(repo, revs, followfirst): |
|
61 | def revancestors(repo, revs, followfirst): | |
60 | """Like revlog.ancestors(), but supports followfirst.""" |
|
62 | """Like revlog.ancestors(), but supports followfirst.""" |
General Comments 0
You need to be logged in to leave comments.
Login now