comparison hgext3rd/topic/evolvebits.py @ 3017:0884856a4143 stable

stack: handle basic case of splitting with crash hg stack used to crash horribly whenever a split was encountered. This is no longer the case. If the result of the split (or there successors) produce a sensible linear result with on final head, we can just assume that head is the evolution destination.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Sat, 30 Sep 2017 11:11:04 +0100
parents 66357d4d03b2
children 6aff4bb3970d
comparison
equal deleted inserted replaced
3012:081070828703 3017:0884856a4143
79 ui.debug("stabilize target %s is plain dead," 79 ui.debug("stabilize target %s is plain dead,"
80 " trying to stabilize on its parent\n" % 80 " trying to stabilize on its parent\n" %
81 obs) 81 obs)
82 obs = obs.parents()[0] 82 obs = obs.parents()[0]
83 newer = compat.successorssets(repo, obs.node()) 83 newer = compat.successorssets(repo, obs.node())
84 if len(newer) > 1 or len(newer[0]) > 1: 84 if 1 < len(newer):
85 # divergence case
86 # we should pick as arbitrary one
85 raise MultipleSuccessorsError(newer) 87 raise MultipleSuccessorsError(newer)
88 elif 1 < len(newer[0]):
89 splitheads = list(repo.revs('heads(%ln::%ln)', newer[0], newer[0]))
90 if 1 < len(splitheads):
91 # split case, See if we can make sense of it.
92 raise MultipleSuccessorsError(newer)
93 return splitheads[0]
86 94
87 return repo[newer[0][0]].rev() 95 return repo[newer[0][0]].rev()
88 96
89 class MultipleSuccessorsError(RuntimeError): 97 class MultipleSuccessorsError(RuntimeError):
90 """Exception raised by _singlesuccessor when multiple successor sets exists 98 """Exception raised by _singlesuccessor when multiple successor sets exists