changeset 16867:1093ad1e8903

revlog: descendants(*revs) becomes descendants(revs) (API) Once again making the API more rational, as with ancestors.
author Bryan O'Sullivan <bryano@fb.com>
date Fri, 01 Jun 2012 12:45:16 -0700
parents 91f3ac205816
children eb88ed4269c5
files hgext/convert/hg.py hgext/mq.py hgext/rebase.py mercurial/context.py mercurial/phases.py mercurial/repair.py mercurial/revlog.py tests/test-revlog-ancestry.py
diffstat 8 files changed, 13 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/convert/hg.py	Fri Jun 01 12:37:18 2012 -0700
+++ b/hgext/convert/hg.py	Fri Jun 01 12:45:16 2012 -0700
@@ -259,7 +259,7 @@
                                  % startnode)
             startrev = self.repo.changelog.rev(startnode)
             children = {startnode: 1}
-            for rev in self.repo.changelog.descendants(startrev):
+            for rev in self.repo.changelog.descendants([startrev]):
                 children[self.repo.changelog.node(rev)] = 1
             self.keep = children.__contains__
         else:
--- a/hgext/mq.py	Fri Jun 01 12:37:18 2012 -0700
+++ b/hgext/mq.py	Fri Jun 01 12:45:16 2012 -0700
@@ -2963,7 +2963,7 @@
     if not revs:
         raise util.Abort(_('empty revision set'))
 
-    descendants = set(cl.descendants(*revs))
+    descendants = set(cl.descendants(revs))
     strippedrevs = revs.union(descendants)
     roots = revs.difference(descendants)
 
--- a/hgext/rebase.py	Fri Jun 01 12:37:18 2012 -0700
+++ b/hgext/rebase.py	Fri Jun 01 12:45:16 2012 -0700
@@ -321,7 +321,7 @@
             # Remove no more useful revisions
             rebased = [rev for rev in state if state[rev] != nullmerge]
             if rebased:
-                if set(repo.changelog.descendants(min(rebased))) - set(state):
+                if set(repo.changelog.descendants([min(rebased)])) - set(state):
                     ui.warn(_("warning: new changesets detected "
                               "on source branch, not stripping\n"))
                 else:
@@ -575,7 +575,7 @@
 
     descendants = set()
     if dstates:
-        descendants = set(repo.changelog.descendants(*dstates))
+        descendants = set(repo.changelog.descendants(dstates))
     if descendants - set(dstates):
         repo.ui.warn(_("warning: new changesets detected on target branch, "
                        "can't abort\n"))
--- a/mercurial/context.py	Fri Jun 01 12:37:18 2012 -0700
+++ b/mercurial/context.py	Fri Jun 01 12:45:16 2012 -0700
@@ -227,7 +227,7 @@
             yield changectx(self._repo, a)
 
     def descendants(self):
-        for d in self._repo.changelog.descendants(self._rev):
+        for d in self._repo.changelog.descendants([self._rev]):
             yield changectx(self._repo, d)
 
     def _fileinfo(self, path):
--- a/mercurial/phases.py	Fri Jun 01 12:37:18 2012 -0700
+++ b/mercurial/phases.py	Fri Jun 01 12:45:16 2012 -0700
@@ -189,7 +189,7 @@
                 if roots:
                     for rev in roots:
                         revs[rev] = phase
-                    for rev in repo.changelog.descendants(*roots):
+                    for rev in repo.changelog.descendants(roots):
                         revs[rev] = phase
             self._phaserevs = revs
         return self._phaserevs
--- a/mercurial/repair.py	Fri Jun 01 12:37:18 2012 -0700
+++ b/mercurial/repair.py	Fri Jun 01 12:45:16 2012 -0700
@@ -74,7 +74,7 @@
     #  base = revision in the set that has no ancestor in the set)
     tostrip = set(striplist)
     for rev in striplist:
-        for desc in cl.descendants(rev):
+        for desc in cl.descendants([rev]):
             tostrip.add(desc)
 
     files = _collectfiles(repo, striprev)
@@ -91,7 +91,7 @@
 
     # compute base nodes
     if saverevs:
-        descendants = set(cl.descendants(*saverevs))
+        descendants = set(cl.descendants(saverevs))
         saverevs.difference_update(descendants)
     savebases = [cl.node(r) for r in saverevs]
     stripbases = [cl.node(r) for r in tostrip]
--- a/mercurial/revlog.py	Fri Jun 01 12:37:18 2012 -0700
+++ b/mercurial/revlog.py	Fri Jun 01 12:45:16 2012 -0700
@@ -398,7 +398,7 @@
                     seen.add(parent)
                     yield parent
 
-    def descendants(self, *revs):
+    def descendants(self, revs):
         """Generate the descendants of 'revs' in revision order.
 
         Yield a sequence of revision numbers starting with a child of
@@ -700,7 +700,7 @@
     def descendant(self, start, end):
         if start == nullrev:
             return True
-        for i in self.descendants(start):
+        for i in self.descendants([start]):
             if i == end:
                 return True
             elif i > end:
--- a/tests/test-revlog-ancestry.py	Fri Jun 01 12:37:18 2012 -0700
+++ b/tests/test-revlog-ancestry.py	Fri Jun 01 12:45:16 2012 -0700
@@ -60,14 +60,14 @@
 
     # Descendants
     print '\n\nDescendants of 5'
-    for r in repo.changelog.descendants(5):
+    for r in repo.changelog.descendants([5]):
         print r,
 
     print '\nDescendants of 5 and 3'
-    for r in repo.changelog.descendants(5, 3):
+    for r in repo.changelog.descendants([5, 3]):
         print r,
 
     print '\nDescendants of 5 and 4'
-    for r in repo.changelog.descendants(5, 4):
+    for r in repo.changelog.descendants([5, 4]):
         print r,