comparison hgext3rd/topic/stack.py @ 6935:954d7ea5cd67 stable tip

stack: when stack base is obsolete, pick any successor, even if at random There are situations when s0 is obsolete and we also cannot pick just one successor for it to use in stack. In such a case, let's pick the "latest" successor from the first set. We're assuming that obsutil.successorssets() returns data in the same order (it should, since it makes sure to sort data internally). Keeping that in mind, while the successor picked for s0 by this code is not based on any sort of sophisticated logic, it should nonetheless be the same every time. This patch is probably not going to completely break anything that was previously working fine, because the previous behavior was to just abort with an exception.
author Anton Shestakov <av6@dwimlabs.net>
date Sat, 16 Nov 2024 17:01:02 +0400
parents 86736040b0ec
children
comparison
equal deleted inserted replaced
6934:dd518437d4e0 6935:954d7ea5cd67
179 pt1 = self._repo[revs[0]].p1() 179 pt1 = self._repo[revs[0]].p1()
180 else: 180 else:
181 pt1 = self._repo[b'.'] 181 pt1 = self._repo[b'.']
182 182
183 if pt1.obsolete(): 183 if pt1.obsolete():
184 pt1 = self._repo[_singlesuccessor(self._repo, pt1)] 184 try:
185 pt1 = self._repo[_singlesuccessor(self._repo, pt1)]
186 except MultipleSuccessorsError as e:
187 # here, taking a random successor is better than failing
188 pt1 = self._repo[e.successorssets[0][-1]]
185 revs.insert(0, pt1.rev()) 189 revs.insert(0, pt1.rev())
186 return revs 190 return revs
187 191
188 @util.propertycache 192 @util.propertycache
189 def changesetcount(self): 193 def changesetcount(self):