comparison hgext3rd/topic/evolvebits.py @ 2694:8a222745a71c

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.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Sun, 02 Jul 2017 15:02:51 +0200
parents d87fc4f749e6
children 66357d4d03b2
comparison
equal deleted inserted replaced
2693:f4b0351fa813 2694:8a222745a71c
1 import collections 1 import collections
2 from mercurial import obsolete 2 from mercurial import obsolete
3
4 successorssets = None
5 try:
6 from mercurial import obsutil
7 successorssets = getattr(obsutil, 'successorssets', None)
8 except ImportError:
9 pass
10
11 if successorssets is None:
12 successorssets = obsolete.successorssets
3 13
4 # Copied from evolve 081605c2e9b6 14 # Copied from evolve 081605c2e9b6
5 15
6 def _orderrevs(repo, revs): 16 def _orderrevs(repo, revs):
7 """Compute an ordering to solve instability for the given revs 17 """Compute an ordering to solve instability for the given revs
70 80
71 if not p.obsolete(): 81 if not p.obsolete():
72 return p.rev() 82 return p.rev()
73 obs = repo[p] 83 obs = repo[p]
74 ui = repo.ui 84 ui = repo.ui
75 newer = obsolete.successorssets(repo, obs.node()) 85 newer = successorssets(repo, obs.node())
76 # search of a parent which is not killed 86 # search of a parent which is not killed
77 while not newer: 87 while not newer:
78 ui.debug("stabilize target %s is plain dead," 88 ui.debug("stabilize target %s is plain dead,"
79 " trying to stabilize on its parent\n" % 89 " trying to stabilize on its parent\n" %
80 obs) 90 obs)
81 obs = obs.parents()[0] 91 obs = obs.parents()[0]
82 newer = obsolete.successorssets(repo, obs.node()) 92 newer = successorssets(repo, obs.node())
83 if len(newer) > 1 or len(newer[0]) > 1: 93 if len(newer) > 1 or len(newer[0]) > 1:
84 raise MultipleSuccessorsError(newer) 94 raise MultipleSuccessorsError(newer)
85 95
86 return repo[newer[0][0]].rev() 96 return repo[newer[0][0]].rev()
87 97