changeset 588:89c8550019d0 stable

mercurial: replace all `newerversion` call by `successorsset` call
author Pierre-Yves David <pierre-yves.david@logilab.fr>
date Tue, 23 Oct 2012 16:49:29 +0200
parents 8152fedbac65
children 8945a62f9096 26f76b38f879
files hgext/evolve.py hgext/qsync.py
diffstat 2 files changed, 5 insertions(+), 27 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/evolve.py	Tue Oct 23 16:36:29 2012 +0200
+++ b/hgext/evolve.py	Tue Oct 23 16:49:29 2012 +0200
@@ -933,28 +933,6 @@
 
 
 
-def newerversion(repo, obs):
-    """Return the newer version of an obsolete changeset"""
-    toproceed = set([(obs,)])
-    # XXX known optimization available
-    newer = set()
-    objectrels = repo.obsstore.precursors
-    while toproceed:
-        current = toproceed.pop()
-        assert len(current) <= 1, 'splitting not handled yet. %r' % current
-        current = [n for n in current if n != nullid]
-        if current:
-            n, = current
-            if n in objectrels:
-                markers = objectrels[n]
-                for mark in markers:
-                    toproceed.add(tuple(mark[1]))
-            else:
-                newer.add(tuple(current))
-        else:
-            newer.add(())
-    return sorted(newer)
-
 
 #####################################################################
 ### Extending revset and template                                 ###
@@ -1568,13 +1546,13 @@
     if not obs.obsolete():
         obs = orig.parents()[1]
     assert obs.obsolete()
-    newer = newerversion(repo, obs.node())
+    newer = successorssets(repo, obs.node())
     # search of a parent which is not killed
-    while newer == [()]:
+    while not newer or newer == [()]:
         ui.debug("stabilize target %s is plain dead,"
                  " trying to stabilize on its parent")
         obs = obs.parents()[0]
-        newer = newerversion(repo, obs.node())
+        newer = successorssets(repo, obs.node())
     if len(newer) > 1:
         ui.write_err(_("conflict rewriting. can't choose destination\n"))
         return 2
--- a/hgext/qsync.py	Tue Oct 23 16:36:29 2012 +0200
+++ b/hgext/qsync.py	Tue Oct 23 16:49:29 2012 +0200
@@ -85,7 +85,7 @@
             except IOError:
                 oldnode = oldfiles[patch_name]
                 evolve = extensions.find('evolve')
-                newnodes = evolve.newerversion(repo, oldnode)
+                newnodes = evolve.successorssets(repo, oldnode)
                 if newnodes:
                     newnodes = [n for n in newnodes if n and n[0] in repo] # remove killing
                 if not newnodes:
@@ -174,7 +174,7 @@
         usedold.add(oldhex)
         oldname = str(oldname)
         oldnode = bin(oldhex)
-        newnodes = evolve.newerversion(repo, oldnode)
+        newnodes = evolve.successorssets(repo, oldnode)
         if newnodes:
             newnodes = [n for n in newnodes if n and n[0] in repo] # remove killing
             if len(newnodes) > 1: