hgext3rd/topic/__init__.py
branchstable
changeset 3532 68e99d2c6267
parent 3447 6565eac61ebf
child 3534 cd4db75413a2
--- a/hgext3rd/topic/__init__.py	Fri Mar 16 14:59:10 2018 +0530
+++ b/hgext3rd/topic/__init__.py	Fri Mar 16 15:01:44 2018 +0530
@@ -134,13 +134,14 @@
 from . import (
     compat,
     constants,
+    destination,
+    discovery,
+    evolvebits,
     flow,
+    randomname,
     revset as topicrevset,
-    destination,
     stack,
     topicmap,
-    discovery,
-    randomname
 )
 
 if util.safehasattr(registrar, 'command'):
@@ -240,6 +241,10 @@
     revlist = stack.stack(self._repo, topic=topic)
     try:
         return revlist.index(self.rev())
+    except ValueError:
+        if self.obsolete():
+            succ = evolvebits._singlesuccessor(self._repo, self)
+            return revlist.index(succ)
     except IndexError:
         # Lets move to the last ctx of the current topic
         return None