compat: handle lack of allpredecessors for Mercurial 4.3 stable
authorPierre-Yves David <pierre-yves.david@octobus.net>
Tue, 24 Apr 2018 12:07:35 +0100
branchstable
changeset 3707 95ee7bf46ade
parent 3706 47e6776c2ef0
child 3708 d7a89d5b3684
compat: handle lack of allpredecessors for Mercurial 4.3
hgext3rd/evolve/evolvecmd.py
--- a/hgext3rd/evolve/evolvecmd.py	Mon Apr 23 12:03:05 2018 +0100
+++ b/hgext3rd/evolve/evolvecmd.py	Tue Apr 24 12:07:35 2018 +0100
@@ -1020,7 +1020,10 @@
     """Compute sets of commits divergent with a given one"""
     cache = {}
     base = {}
-    for n in obsutil.allpredecessors(repo.obsstore, [ctx.node()]):
+    allpredecessors = getattr(obsutil, 'allpredecessors', None)
+    if allpredecessors is None: # <= Mercurial 4.3
+        allpredecessors = obsutil.allprecursors
+    for n in allpredecessors(repo.obsstore, [ctx.node()]):
         if n == ctx.node():
             # a node can't be a base for divergence with itself
             continue