Show More
@@ -84,34 +84,35 b' def revancestors(repo, revs, followfirst' | |||
|
84 | 84 | gen = _genrevancestors(repo, revs, followfirst, startdepth, stopdepth) |
|
85 | 85 | return generatorset(gen, iterasc=False) |
|
86 | 86 | |
|
87 | def revdescendants(repo, revs, followfirst): | |
|
88 | """Like revlog.descendants() but supports followfirst.""" | |
|
87 | def _genrevdescendants(repo, revs, followfirst): | |
|
89 | 88 | if followfirst: |
|
90 | 89 | cut = 1 |
|
91 | 90 | else: |
|
92 | 91 | cut = None |
|
93 | 92 | |
|
94 | def iterate(): | |
|
95 | cl = repo.changelog | |
|
96 | # XXX this should be 'parentset.min()' assuming 'parentset' is a | |
|
97 | # smartset (and if it is not, it should.) | |
|
98 | first = min(revs) | |
|
99 | nullrev = node.nullrev | |
|
100 | if first == nullrev: | |
|
101 | # Are there nodes with a null first parent and a non-null | |
|
102 | # second one? Maybe. Do we care? Probably not. | |
|
103 |
|
|
|
104 | yield i | |
|
105 | else: | |
|
106 | seen = set(revs) | |
|
107 |
for |
|
|
108 | for x in cl.parentrevs(i)[:cut]: | |
|
109 | if x != nullrev and x in seen: | |
|
110 |
|
|
|
111 |
|
|
|
112 | break | |
|
93 | cl = repo.changelog | |
|
94 | # XXX this should be 'parentset.min()' assuming 'parentset' is a | |
|
95 | # smartset (and if it is not, it should.) | |
|
96 | first = min(revs) | |
|
97 | nullrev = node.nullrev | |
|
98 | if first == nullrev: | |
|
99 | # Are there nodes with a null first parent and a non-null | |
|
100 | # second one? Maybe. Do we care? Probably not. | |
|
101 | for i in cl: | |
|
102 | yield i | |
|
103 | else: | |
|
104 | seen = set(revs) | |
|
105 | for i in cl.revs(first + 1): | |
|
106 | for x in cl.parentrevs(i)[:cut]: | |
|
107 | if x != nullrev and x in seen: | |
|
108 | seen.add(i) | |
|
109 | yield i | |
|
110 | break | |
|
113 | 111 | |
|
114 | return generatorset(iterate(), iterasc=True) | |
|
112 | def revdescendants(repo, revs, followfirst): | |
|
113 | """Like revlog.descendants() but supports followfirst.""" | |
|
114 | gen = _genrevdescendants(repo, revs, followfirst) | |
|
115 | return generatorset(gen, iterasc=True) | |
|
115 | 116 | |
|
116 | 117 | def _reachablerootspure(repo, minroot, roots, heads, includepath): |
|
117 | 118 | """return (heads(::<roots> and ::<heads>)) |
General Comments 0
You need to be logged in to leave comments.
Login now