Show More
@@ -78,6 +78,12 b' def _walkrevtree(pfunc, revs, startdepth' | |||
|
78 | 78 | def filectxancestors(fctx, followfirst=False): |
|
79 | 79 | """Like filectx.ancestors(), but includes the given fctx itself""" |
|
80 | 80 | visit = {} |
|
81 | def addvisit(fctx): | |
|
82 | rev = fctx.rev() | |
|
83 | if rev not in visit: | |
|
84 | visit[rev] = set() | |
|
85 | visit[rev].add(fctx) | |
|
86 | ||
|
81 | 87 | c = fctx |
|
82 | 88 | if followfirst: |
|
83 | 89 | cut = 1 |
@@ -87,10 +93,13 b' def filectxancestors(fctx, followfirst=F' | |||
|
87 | 93 | yield c |
|
88 | 94 | while True: |
|
89 | 95 | for parent in c.parents()[:cut]: |
|
90 | visit[(parent.rev(), parent.filenode())] = parent | |
|
96 | addvisit(parent) | |
|
91 | 97 | if not visit: |
|
92 | 98 | break |
|
93 |
|
|
|
99 | rev = max(visit) | |
|
100 | c = visit[rev].pop() | |
|
101 | if not visit[rev]: | |
|
102 | del visit[rev] | |
|
94 | 103 | yield c |
|
95 | 104 | |
|
96 | 105 | def _genrevancestors(repo, revs, followfirst, startdepth, stopdepth, cutfunc): |
General Comments 0
You need to be logged in to leave comments.
Login now