changeset 3697:6aff4bb3970d

compat: drop compatibility layer for successorssets We support down to Mercurial 4.3 now.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Thu, 19 Apr 2018 16:12:37 +0200
parents 39231f02902b
children 4819656d1134
files hgext3rd/evolve/cmdrewrite.py hgext3rd/evolve/compat.py hgext3rd/evolve/evolvecmd.py hgext3rd/evolve/obshistory.py hgext3rd/evolve/utility.py hgext3rd/topic/evolvebits.py
diffstat 6 files changed, 21 insertions(+), 24 deletions(-) [+]
line wrap: on
line diff
--- a/hgext3rd/evolve/cmdrewrite.py	Thu Apr 19 16:08:01 2018 +0200
+++ b/hgext3rd/evolve/cmdrewrite.py	Thu Apr 19 16:12:37 2018 +0200
@@ -26,6 +26,7 @@
     merge,
     node,
     obsolete,
+    obsutil,
     patch,
     phases,
     scmutil,
@@ -1268,7 +1269,7 @@
             if not (duplicate or allowdivergence):
                 # The user hasn't yet decided what to do with the revived
                 # cset, let's ask
-                sset = compat.successorssets(repo, ctx.node())
+                sset = obsutil.successorssets(repo, ctx.node())
                 nodivergencerisk = (len(sset) == 0 or
                                     (len(sset) == 1 and
                                      len(sset[0]) == 1 and
--- a/hgext3rd/evolve/compat.py	Thu Apr 19 16:08:01 2018 +0200
+++ b/hgext3rd/evolve/compat.py	Thu Apr 19 16:12:37 2018 +0200
@@ -38,13 +38,6 @@
 
 eh = exthelper.exthelper()
 
-# successors set move from mercurial.obsolete to mercurial.obsutil in 4.3
-def successorssets(*args, **kwargs):
-    func = getattr(obsutil, 'successorssets', None)
-    if func is None:
-        func = obsolete.successorssets
-    return func(*args, **kwargs)
-
 # allprecursors set move from mercurial.obsolete to mercurial.obsutil in 4.3
 # allprecursors  was renamed into allpredecessors in 4.4
 def allprecursors(*args, **kwargs):
--- a/hgext3rd/evolve/evolvecmd.py	Thu Apr 19 16:08:01 2018 +0200
+++ b/hgext3rd/evolve/evolvecmd.py	Thu Apr 19 16:12:37 2018 +0200
@@ -23,6 +23,7 @@
     merge,
     node,
     obsolete,
+    obsutil,
     phases,
     repair,
     scmutil,
@@ -113,14 +114,14 @@
         ui.warn(_("cannot solve instability of %s, skipping\n") % orig)
         return (False, '')
     obs = pctx
-    newer = compat.successorssets(repo, obs.node())
+    newer = obsutil.successorssets(repo, obs.node())
     # search of a parent which is not killed
     while not newer or newer == [()]:
         ui.debug("stabilize target %s is plain dead,"
                  " trying to stabilize on its parent\n" %
                  obs)
         obs = obs.parents()[0]
-        newer = compat.successorssets(repo, obs.node())
+        newer = obsutil.successorssets(repo, obs.node())
     if len(newer) > 1:
         msg = _("skipping %s: divergent rewriting. can't choose "
                 "destination\n") % obs
@@ -518,7 +519,7 @@
         if not ctx.obsolete():
             continue
 
-        successors = compat.successorssets(repo, ctx.node(), cache)
+        successors = obsutil.successorssets(repo, ctx.node(), cache)
 
         # We can't make any assumptions about how to update the hash if the
         # cset in question was split or diverged.
@@ -684,7 +685,7 @@
     """
     repo = ctx._repo.unfiltered()
     for base in repo.set('reverse(allprecursors(%d))', ctx.rev()):
-        newer = compat.successorssets(ctx._repo, base.node())
+        newer = obsutil.successorssets(ctx._repo, base.node())
         # drop filter and solution including the original ctx
         newer = [n for n in newer if n and ctx.node() not in n]
         if newer:
@@ -732,7 +733,7 @@
     tovisit = list(parents(rev))
     while tovisit:
         r = tovisit.pop()
-        succsets = compat.successorssets(repo, tonode(r))
+        succsets = obsutil.successorssets(repo, tonode(r))
         if not succsets:
             tovisit.extend(parents(r))
         else:
@@ -1022,7 +1023,7 @@
         if n == ctx.node():
             # a node can't be a base for divergence with itself
             continue
-        nsuccsets = compat.successorssets(repo, n, cache)
+        nsuccsets = obsutil.successorssets(repo, n, cache)
         for nsuccset in nsuccsets:
             if ctx.node() in nsuccset:
                 # we are only interested in *other* successor sets
--- a/hgext3rd/evolve/obshistory.py	Thu Apr 19 16:08:01 2018 +0200
+++ b/hgext3rd/evolve/obshistory.py	Thu Apr 19 16:12:37 2018 +0200
@@ -720,7 +720,7 @@
     or has diverged
     """
     if successorssets is None:
-        successorssets = compat.successorssets(repo, revnode)
+        successorssets = obsutil.successorssets(repo, revnode)
 
     fate = _getobsfate(successorssets)
 
--- a/hgext3rd/evolve/utility.py	Thu Apr 19 16:08:01 2018 +0200
+++ b/hgext3rd/evolve/utility.py	Thu Apr 19 16:12:37 2018 +0200
@@ -7,14 +7,14 @@
 
 import collections
 
+from mercurial import (
+    obsutil,
+)
+
 from mercurial.i18n import _
 
 from mercurial.node import nullrev
 
-from . import (
-    compat,
-)
-
 shorttemplate = "[{label('evolve.rev', rev)}] {desc|firstline}\n"
 
 def obsexcmsg(ui, message, important=False):
@@ -122,14 +122,14 @@
         return p.rev()
     obs = repo[p]
     ui = repo.ui
-    newer = compat.successorssets(repo, obs.node())
+    newer = obsutil.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 = compat.successorssets(repo, obs.node())
+        newer = obsutil.successorssets(repo, obs.node())
     if len(newer) > 1 or len(newer[0]) > 1:
         raise MultipleSuccessorsError(newer)
 
--- a/hgext3rd/topic/evolvebits.py	Thu Apr 19 16:08:01 2018 +0200
+++ b/hgext3rd/topic/evolvebits.py	Thu Apr 19 16:12:37 2018 +0200
@@ -1,6 +1,8 @@
 import collections
 
-from . import compat
+from mercurial import (
+    obsutil,
+)
 
 # Copied from evolve 081605c2e9b6
 
@@ -73,14 +75,14 @@
         return p.rev()
     obs = repo[p]
     ui = repo.ui
-    newer = compat.successorssets(repo, obs.node())
+    newer = obsutil.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 = compat.successorssets(repo, obs.node())
+        newer = obsutil.successorssets(repo, obs.node())
     if 1 < len(newer):
         # divergence case
         # we should pick as arbitrary one