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