diff 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
line wrap: on
line diff
--- a/hgext3rd/topic/__init__.py	Thu Oct 25 11:32:43 2018 +0200
+++ b/hgext3rd/topic/__init__.py	Wed Oct 17 14:47:38 2018 +0200
@@ -143,7 +143,6 @@
     constants,
     destination,
     discovery,
-    evolvebits,
     flow,
     randomname,
     revset as topicrevset,
@@ -240,19 +239,13 @@
 
 def _contexttopicidx(self):
     topic = self.topic()
-    if not topic:
+    if not topic or self.obsolete():
         # XXX we might want to include s0 here,
         # however s0 is related to  'currenttopic' which has no place here.
         return None
     revlist = stack.stack(self._repo, topic=topic)
     try:
         return revlist.index(self.rev())
-    except ValueError:
-        if self.obsolete():
-            succ = evolvebits._singlesuccessor(self._repo, self)
-            if succ not in revlist:
-                return None
-            return revlist.index(succ)
     except IndexError:
         # Lets move to the last ctx of the current topic
         return None