Pierre-Yves David avatar Pierre-Yves David committed 89c8550

mercurial: replace all `newerversion` call by `successorsset` call

Comments (0)

Files changed (2)

 
 
 
-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                                 ###
     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
             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:
         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:
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.