Show More
@@ -77,7 +77,10 b' def _walkrevtree(pfunc, revs, startdepth' | |||||
77 |
|
77 | |||
78 | def filectxancestors(fctxs, followfirst=False): |
|
78 | def filectxancestors(fctxs, followfirst=False): | |
79 | """Like filectx.ancestors(), but can walk from multiple files/revisions, |
|
79 | """Like filectx.ancestors(), but can walk from multiple files/revisions, | |
80 |
and includes the given fctxs themselves |
|
80 | and includes the given fctxs themselves | |
|
81 | ||||
|
82 | Yields (rev, {fctx, ...}) pairs in descending order. | |||
|
83 | """ | |||
81 | visit = {} |
|
84 | visit = {} | |
82 | def addvisit(fctx): |
|
85 | def addvisit(fctx): | |
83 | rev = fctx.rev() |
|
86 | rev = fctx.rev() | |
@@ -93,13 +96,21 b' def filectxancestors(fctxs, followfirst=' | |||||
93 | for c in fctxs: |
|
96 | for c in fctxs: | |
94 | addvisit(c) |
|
97 | addvisit(c) | |
95 | while visit: |
|
98 | while visit: | |
96 | rev = max(visit) |
|
99 | currev = max(visit) | |
97 |
c = visit |
|
100 | curfctxs = visit.pop(currev) | |
98 | if not visit[rev]: |
|
101 | yield currev, curfctxs | |
99 | del visit[rev] |
|
102 | for c in curfctxs: | |
100 | yield c |
|
103 | for parent in c.parents()[:cut]: | |
101 | for parent in c.parents()[:cut]: |
|
104 | addvisit(parent) | |
102 | addvisit(parent) |
|
105 | ||
|
106 | def filerevancestors(fctxs, followfirst=False): | |||
|
107 | """Like filectx.ancestors(), but can walk from multiple files/revisions, | |||
|
108 | and includes the given fctxs themselves | |||
|
109 | ||||
|
110 | Returns a smartset. | |||
|
111 | """ | |||
|
112 | gen = (rev for rev, _cs in filectxancestors(fctxs, followfirst)) | |||
|
113 | return generatorset(gen, iterasc=False) | |||
103 |
|
114 | |||
104 | def _genrevancestors(repo, revs, followfirst, startdepth, stopdepth, cutfunc): |
|
115 | def _genrevancestors(repo, revs, followfirst, startdepth, stopdepth, cutfunc): | |
105 | if followfirst: |
|
116 | if followfirst: |
@@ -928,8 +928,7 b' def _follow(repo, subset, x, name, follo' | |||||
928 | files = c.manifest().walk(matcher) |
|
928 | files = c.manifest().walk(matcher) | |
929 |
|
929 | |||
930 | fctxs = [c[f].introfilectx() for f in files] |
|
930 | fctxs = [c[f].introfilectx() for f in files] | |
931 |
|
|
931 | s = dagop.filerevancestors(fctxs, followfirst) | |
932 | s = set(c.rev() for c in a) |
|
|||
933 | else: |
|
932 | else: | |
934 | s = dagop.revancestors(repo, baseset([c.rev()]), followfirst) |
|
933 | s = dagop.revancestors(repo, baseset([c.rev()]), followfirst) | |
935 |
|
934 |
General Comments 0
You need to be logged in to leave comments.
Login now