topic: adapt to function migrate to obsutil
authorPierre-Yves David <pierre-yves.david@octobus.net>
Sun, 02 Jul 2017 15:02:51 +0200
changeset 2694 8a222745a71c
parent 2693 f4b0351fa813
child 2695 b4824e169f18
topic: adapt to function migrate to obsutil Mercurial 4.3 has a new module "obsutil" and multiple functions moved there. We handle the move for the one we care about.
hgext3rd/topic/evolvebits.py
--- a/hgext3rd/topic/evolvebits.py	Sun Jul 02 15:02:11 2017 +0200
+++ b/hgext3rd/topic/evolvebits.py	Sun Jul 02 15:02:51 2017 +0200
@@ -1,6 +1,16 @@
 import collections
 from mercurial import obsolete
 
+successorssets = None
+try:
+    from mercurial import obsutil
+    successorssets = getattr(obsutil, 'successorssets', None)
+except ImportError:
+    pass
+
+if successorssets is None:
+    successorssets = obsolete.successorssets
+
 # Copied from evolve 081605c2e9b6
 
 def _orderrevs(repo, revs):
@@ -72,14 +82,14 @@
         return p.rev()
     obs = repo[p]
     ui = repo.ui
-    newer = obsolete.successorssets(repo, obs.node())
+    newer = successorssets(repo, obs.node())
     # search of a parent which is not killed
     while not newer:
         ui.debug("stabilize target %s is plain dead,"
                  " trying to stabilize on its parent\n" %
                  obs)
         obs = obs.parents()[0]
-        newer = obsolete.successorssets(repo, obs.node())
+        newer = successorssets(repo, obs.node())
     if len(newer) > 1 or len(newer[0]) > 1:
         raise MultipleSuccessorsError(newer)