# HG changeset patch # User Bryan O'Sullivan # Date 1338579438 25200 # Node ID 91f3ac205816a05fdb9880c887a0fde690310023 # Parent a6543fdcf86986f5b4d2e5ee3bb2db88ac231da1 revlog: ancestors(*revs) becomes ancestors(revs) (API) Accepting a variable number of arguments as the old API did is deeply ugly, particularly as it means the API can't be extended with new arguments. Partly as a result, we have at least three different implementations of the same ancestors algorithm (!?). Most callers were forced to call ancestors(*somelist), adding to both inefficiency and ugliness. diff -r a6543fdcf869 -r 91f3ac205816 contrib/perf.py --- a/contrib/perf.py Tue May 29 23:26:55 2012 +0200 +++ b/contrib/perf.py Fri Jun 01 12:37:18 2012 -0700 @@ -74,7 +74,7 @@ def perfancestors(ui, repo): heads = repo.changelog.headrevs() def d(): - for a in repo.changelog.ancestors(*heads): + for a in repo.changelog.ancestors(heads): pass timer(d) diff -r a6543fdcf869 -r 91f3ac205816 hgext/rebase.py --- a/hgext/rebase.py Tue May 29 23:26:55 2012 +0200 +++ b/hgext/rebase.py Fri Jun 01 12:37:18 2012 -0700 @@ -224,7 +224,7 @@ else: originalwd, target, state = result if collapsef: - targetancestors = set(repo.changelog.ancestors(target)) + targetancestors = set(repo.changelog.ancestors([target])) targetancestors.add(target) external = checkexternal(repo, state, targetancestors) @@ -243,7 +243,7 @@ # Rebase if not targetancestors: - targetancestors = set(repo.changelog.ancestors(target)) + targetancestors = set(repo.changelog.ancestors([target])) targetancestors.add(target) # Keep track of the current bookmarks in order to reset them later diff -r a6543fdcf869 -r 91f3ac205816 mercurial/commands.py --- a/mercurial/commands.py Tue May 29 23:26:55 2012 +0200 +++ b/mercurial/commands.py Fri Jun 01 12:37:18 2012 -0700 @@ -5396,12 +5396,12 @@ cl = repo.changelog for a in [cl.rev(n) for n in bheads]: new[a] = 1 - for a in cl.ancestors(*[cl.rev(n) for n in bheads]): + for a in cl.ancestors([cl.rev(n) for n in bheads]): new[a] = 1 for a in [p.rev() for p in parents]: if a >= 0: new[a] = 0 - for a in cl.ancestors(*[p.rev() for p in parents]): + for a in cl.ancestors([p.rev() for p in parents]): new[a] = 0 new = sum(new) diff -r a6543fdcf869 -r 91f3ac205816 mercurial/context.py --- a/mercurial/context.py Tue May 29 23:26:55 2012 +0200 +++ b/mercurial/context.py Fri Jun 01 12:37:18 2012 -0700 @@ -223,7 +223,7 @@ return [changectx(self._repo, x) for x in c] def ancestors(self): - for a in self._repo.changelog.ancestors(self._rev): + for a in self._repo.changelog.ancestors([self._rev]): yield changectx(self._repo, a) def descendants(self): @@ -1019,7 +1019,7 @@ def ancestors(self): for a in self._repo.changelog.ancestors( - *[p.rev() for p in self._parents]): + [p.rev() for p in self._parents]): yield changectx(self._repo, a) def undelete(self, list): diff -r a6543fdcf869 -r 91f3ac205816 mercurial/discovery.py --- a/mercurial/discovery.py Tue May 29 23:26:55 2012 +0200 +++ b/mercurial/discovery.py Fri Jun 01 12:37:18 2012 -0700 @@ -140,7 +140,7 @@ og._computecommonmissing() cl = repo.changelog missingrevs = set(cl.rev(n) for n in og._missing) - og._common = set(cl.ancestors(*missingrevs)) - missingrevs + og._common = set(cl.ancestors(missingrevs)) - missingrevs commonheads = set(og.commonheads) og.missingheads = [h for h in og.missingheads if h not in commonheads] diff -r a6543fdcf869 -r 91f3ac205816 mercurial/localrepo.py --- a/mercurial/localrepo.py Tue May 29 23:26:55 2012 +0200 +++ b/mercurial/localrepo.py Fri Jun 01 12:37:18 2012 -0700 @@ -1791,7 +1791,7 @@ bases = [nullid] csets, bases, heads = cl.nodesbetween(bases, heads) # We assume that all ancestors of bases are known - common = set(cl.ancestors(*[cl.rev(n) for n in bases])) + common = set(cl.ancestors([cl.rev(n) for n in bases])) return self._changegroupsubset(common, csets, heads, source) def getlocalbundle(self, source, outgoing): diff -r a6543fdcf869 -r 91f3ac205816 mercurial/revlog.py --- a/mercurial/revlog.py Tue May 29 23:26:55 2012 +0200 +++ b/mercurial/revlog.py Fri Jun 01 12:37:18 2012 -0700 @@ -381,7 +381,7 @@ visit.append(p) return reachable - def ancestors(self, *revs): + def ancestors(self, revs): """Generate the ancestors of 'revs' in reverse topological order. Yield a sequence of revision numbers starting with the parents @@ -441,7 +441,7 @@ heads = [self.rev(n) for n in heads] # we want the ancestors, but inclusive - has = set(self.ancestors(*common)) + has = set(self.ancestors(common)) has.add(nullrev) has.update(common) diff -r a6543fdcf869 -r 91f3ac205816 tests/test-revlog-ancestry.py --- a/tests/test-revlog-ancestry.py Tue May 29 23:26:55 2012 +0200 +++ b/tests/test-revlog-ancestry.py Fri Jun 01 12:37:18 2012 -0700 @@ -47,15 +47,15 @@ # Ancestors print 'Ancestors of 5' - for r in repo.changelog.ancestors(5): + for r in repo.changelog.ancestors([5]): print r, print '\nAncestors of 6 and 5' - for r in repo.changelog.ancestors(6, 5): + for r in repo.changelog.ancestors([6, 5]): print r, print '\nAncestors of 5 and 4' - for r in repo.changelog.ancestors(5, 4): + for r in repo.changelog.ancestors([5, 4]): print r, # Descendants