topicidx: stop assigning index number to obsolete changesets stable
authorPierre-Yves David <pierre-yves.david@octobus.net>
Wed, 17 Oct 2018 14:47:38 +0200
branchstable
changeset 4190 883e75e0a810
parent 4189 36d559ca5332
child 4191 5c734be63c3e
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.
CHANGELOG
hgext3rd/topic/__init__.py
tests/test-topic-stack-complex.t
--- a/CHANGELOG	Thu Oct 25 11:32:43 2018 +0200
+++ b/CHANGELOG	Wed Oct 17 14:47:38 2018 +0200
@@ -1,10 +1,15 @@
 Changelog
 =========
 
-8.3.0 - in pprogress
+8.4.0 - in progress
 -------------------
 
- * use "new" unstabilities vocabulary in help
+  * use "new" unstabilities vocabulary in help
+
+8.3.1 - in progress
+-------------------
+
+  * evolve+topic: fix possible crash during content-divergence evolution
 
 8.3.0 -- 2018-10-12
 -------------------
--- 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
--- a/tests/test-topic-stack-complex.t	Thu Oct 25 11:32:43 2018 +0200
+++ b/tests/test-topic-stack-complex.t	Wed Oct 17 14:47:38 2018 +0200
@@ -168,3 +168,12 @@
   s2: split1
   s1: Added a and b
   s0^ Added foo (base)
+
+  $ hg evolve --content-divergent -r ec94a1ed1330
+  merge:[s5] Added e and f
+  with: [s4] Added e and f
+  base: [s] Added e and f
+  updating to "local" side of the conflict: ec94a1ed1330
+  merging "other" content-divergent changeset 'f2eff98490d2'
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  working directory is now at 8faad6276dc6