Show More
@@ -74,7 +74,7 b' def perftags(ui, repo):' | |||||
74 | def perfancestors(ui, repo): |
|
74 | def perfancestors(ui, repo): | |
75 | heads = repo.changelog.headrevs() |
|
75 | heads = repo.changelog.headrevs() | |
76 | def d(): |
|
76 | def d(): | |
77 |
for a in repo.changelog.ancestors( |
|
77 | for a in repo.changelog.ancestors(heads): | |
78 | pass |
|
78 | pass | |
79 | timer(d) |
|
79 | timer(d) | |
80 |
|
80 |
@@ -224,7 +224,7 b' def rebase(ui, repo, **opts):' | |||||
224 | else: |
|
224 | else: | |
225 | originalwd, target, state = result |
|
225 | originalwd, target, state = result | |
226 | if collapsef: |
|
226 | if collapsef: | |
227 | targetancestors = set(repo.changelog.ancestors(target)) |
|
227 | targetancestors = set(repo.changelog.ancestors([target])) | |
228 | targetancestors.add(target) |
|
228 | targetancestors.add(target) | |
229 | external = checkexternal(repo, state, targetancestors) |
|
229 | external = checkexternal(repo, state, targetancestors) | |
230 |
|
230 | |||
@@ -243,7 +243,7 b' def rebase(ui, repo, **opts):' | |||||
243 |
|
243 | |||
244 | # Rebase |
|
244 | # Rebase | |
245 | if not targetancestors: |
|
245 | if not targetancestors: | |
246 | targetancestors = set(repo.changelog.ancestors(target)) |
|
246 | targetancestors = set(repo.changelog.ancestors([target])) | |
247 | targetancestors.add(target) |
|
247 | targetancestors.add(target) | |
248 |
|
248 | |||
249 | # Keep track of the current bookmarks in order to reset them later |
|
249 | # Keep track of the current bookmarks in order to reset them later |
@@ -5396,12 +5396,12 b' def summary(ui, repo, **opts):' | |||||
5396 | cl = repo.changelog |
|
5396 | cl = repo.changelog | |
5397 | for a in [cl.rev(n) for n in bheads]: |
|
5397 | for a in [cl.rev(n) for n in bheads]: | |
5398 | new[a] = 1 |
|
5398 | new[a] = 1 | |
5399 |
for a in cl.ancestors( |
|
5399 | for a in cl.ancestors([cl.rev(n) for n in bheads]): | |
5400 | new[a] = 1 |
|
5400 | new[a] = 1 | |
5401 | for a in [p.rev() for p in parents]: |
|
5401 | for a in [p.rev() for p in parents]: | |
5402 | if a >= 0: |
|
5402 | if a >= 0: | |
5403 | new[a] = 0 |
|
5403 | new[a] = 0 | |
5404 |
for a in cl.ancestors( |
|
5404 | for a in cl.ancestors([p.rev() for p in parents]): | |
5405 | new[a] = 0 |
|
5405 | new[a] = 0 | |
5406 | new = sum(new) |
|
5406 | new = sum(new) | |
5407 |
|
5407 |
@@ -223,7 +223,7 b' class changectx(object):' | |||||
223 | return [changectx(self._repo, x) for x in c] |
|
223 | return [changectx(self._repo, x) for x in c] | |
224 |
|
224 | |||
225 | def ancestors(self): |
|
225 | def ancestors(self): | |
226 | for a in self._repo.changelog.ancestors(self._rev): |
|
226 | for a in self._repo.changelog.ancestors([self._rev]): | |
227 | yield changectx(self._repo, a) |
|
227 | yield changectx(self._repo, a) | |
228 |
|
228 | |||
229 | def descendants(self): |
|
229 | def descendants(self): | |
@@ -1019,7 +1019,7 b' class workingctx(changectx):' | |||||
1019 |
|
1019 | |||
1020 | def ancestors(self): |
|
1020 | def ancestors(self): | |
1021 | for a in self._repo.changelog.ancestors( |
|
1021 | for a in self._repo.changelog.ancestors( | |
1022 |
|
|
1022 | [p.rev() for p in self._parents]): | |
1023 | yield changectx(self._repo, a) |
|
1023 | yield changectx(self._repo, a) | |
1024 |
|
1024 | |||
1025 | def undelete(self, list): |
|
1025 | def undelete(self, list): |
@@ -140,7 +140,7 b' def findcommonoutgoing(repo, other, only' | |||||
140 | og._computecommonmissing() |
|
140 | og._computecommonmissing() | |
141 | cl = repo.changelog |
|
141 | cl = repo.changelog | |
142 | missingrevs = set(cl.rev(n) for n in og._missing) |
|
142 | missingrevs = set(cl.rev(n) for n in og._missing) | |
143 |
og._common = set(cl.ancestors( |
|
143 | og._common = set(cl.ancestors(missingrevs)) - missingrevs | |
144 | commonheads = set(og.commonheads) |
|
144 | commonheads = set(og.commonheads) | |
145 | og.missingheads = [h for h in og.missingheads if h not in commonheads] |
|
145 | og.missingheads = [h for h in og.missingheads if h not in commonheads] | |
146 |
|
146 |
@@ -1791,7 +1791,7 b' class localrepository(repo.repository):' | |||||
1791 | bases = [nullid] |
|
1791 | bases = [nullid] | |
1792 | csets, bases, heads = cl.nodesbetween(bases, heads) |
|
1792 | csets, bases, heads = cl.nodesbetween(bases, heads) | |
1793 | # We assume that all ancestors of bases are known |
|
1793 | # We assume that all ancestors of bases are known | |
1794 |
common = set(cl.ancestors( |
|
1794 | common = set(cl.ancestors([cl.rev(n) for n in bases])) | |
1795 | return self._changegroupsubset(common, csets, heads, source) |
|
1795 | return self._changegroupsubset(common, csets, heads, source) | |
1796 |
|
1796 | |||
1797 | def getlocalbundle(self, source, outgoing): |
|
1797 | def getlocalbundle(self, source, outgoing): |
@@ -381,7 +381,7 b' class revlog(object):' | |||||
381 | visit.append(p) |
|
381 | visit.append(p) | |
382 | return reachable |
|
382 | return reachable | |
383 |
|
383 | |||
384 |
def ancestors(self, |
|
384 | def ancestors(self, revs): | |
385 | """Generate the ancestors of 'revs' in reverse topological order. |
|
385 | """Generate the ancestors of 'revs' in reverse topological order. | |
386 |
|
386 | |||
387 | Yield a sequence of revision numbers starting with the parents |
|
387 | Yield a sequence of revision numbers starting with the parents | |
@@ -441,7 +441,7 b' class revlog(object):' | |||||
441 | heads = [self.rev(n) for n in heads] |
|
441 | heads = [self.rev(n) for n in heads] | |
442 |
|
442 | |||
443 | # we want the ancestors, but inclusive |
|
443 | # we want the ancestors, but inclusive | |
444 |
has = set(self.ancestors( |
|
444 | has = set(self.ancestors(common)) | |
445 | has.add(nullrev) |
|
445 | has.add(nullrev) | |
446 | has.update(common) |
|
446 | has.update(common) | |
447 |
|
447 |
@@ -47,15 +47,15 b" if __name__ == '__main__':" | |||||
47 |
|
47 | |||
48 | # Ancestors |
|
48 | # Ancestors | |
49 | print 'Ancestors of 5' |
|
49 | print 'Ancestors of 5' | |
50 | for r in repo.changelog.ancestors(5): |
|
50 | for r in repo.changelog.ancestors([5]): | |
51 | print r, |
|
51 | print r, | |
52 |
|
52 | |||
53 | print '\nAncestors of 6 and 5' |
|
53 | print '\nAncestors of 6 and 5' | |
54 | for r in repo.changelog.ancestors(6, 5): |
|
54 | for r in repo.changelog.ancestors([6, 5]): | |
55 | print r, |
|
55 | print r, | |
56 |
|
56 | |||
57 | print '\nAncestors of 5 and 4' |
|
57 | print '\nAncestors of 5 and 4' | |
58 | for r in repo.changelog.ancestors(5, 4): |
|
58 | for r in repo.changelog.ancestors([5, 4]): | |
59 | print r, |
|
59 | print r, | |
60 |
|
60 | |||
61 | # Descendants |
|
61 | # Descendants |
General Comments 0
You need to be logged in to leave comments.
Login now