comparison hgext3rd/topic/__init__.py @ 4190:883e75e0a810 stable

topicidx: stop assigning index number to obsolete changesets Obsolete changeset are no longer part of the stack, the old logic tried to assigns them the index of their successors but this is flacky and error prone. So we stop doing so.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Wed, 17 Oct 2018 14:47:38 +0200
parents 14e53783596c
children cae466b70bf1 b90422a11a88
comparison
equal deleted inserted replaced
4189:36d559ca5332 4190:883e75e0a810
141 from . import ( 141 from . import (
142 compat, 142 compat,
143 constants, 143 constants,
144 destination, 144 destination,
145 discovery, 145 discovery,
146 evolvebits,
147 flow, 146 flow,
148 randomname, 147 randomname,
149 revset as topicrevset, 148 revset as topicrevset,
150 stack, 149 stack,
151 topicmap, 150 topicmap,
238 return self.extra().get(constants.extrakey, '') 237 return self.extra().get(constants.extrakey, '')
239 context.basectx.topic = _contexttopic 238 context.basectx.topic = _contexttopic
240 239
241 def _contexttopicidx(self): 240 def _contexttopicidx(self):
242 topic = self.topic() 241 topic = self.topic()
243 if not topic: 242 if not topic or self.obsolete():
244 # XXX we might want to include s0 here, 243 # XXX we might want to include s0 here,
245 # however s0 is related to 'currenttopic' which has no place here. 244 # however s0 is related to 'currenttopic' which has no place here.
246 return None 245 return None
247 revlist = stack.stack(self._repo, topic=topic) 246 revlist = stack.stack(self._repo, topic=topic)
248 try: 247 try:
249 return revlist.index(self.rev()) 248 return revlist.index(self.rev())
250 except ValueError:
251 if self.obsolete():
252 succ = evolvebits._singlesuccessor(self._repo, self)
253 if succ not in revlist:
254 return None
255 return revlist.index(succ)
256 except IndexError: 249 except IndexError:
257 # Lets move to the last ctx of the current topic 250 # Lets move to the last ctx of the current topic
258 return None 251 return None
259 context.basectx.topicidx = _contexttopicidx 252 context.basectx.topicidx = _contexttopicidx
260 253