branching: merge stable into default
authorPierre-Yves David <pierre-yves.david@octobus.net>
Thu, 25 Oct 2018 12:49:48 +0200
changeset 4194 cae466b70bf1
parent 4188 326c043bf89c (current diff)
parent 4192 e527df0f2a68 (diff)
child 4208 7d4c80c3f386
branching: merge stable into default
CHANGELOG
hgext3rd/evolve/cmdrewrite.py
hgext3rd/evolve/evolvecmd.py
hgext3rd/evolve/rewind.py
hgext3rd/topic/__init__.py
hgext3rd/topic/discovery.py
--- a/CHANGELOG	Thu Oct 25 10:01:58 2018 +0200
+++ b/CHANGELOG	Thu Oct 25 12:49:48 2018 +0200
@@ -1,10 +1,12 @@
 Changelog
 =========
 
-8.3.0 - in progress
+
+8.3.1 - in progress
 -------------------
 
- * use "new" unstabilities vocabulary in help
+  * evolve+topic: fix possible crash during content-divergence evolution
+  * use "new" unstabilities vocabulary in help
   * compat: compatibility with Mercurial 4.8rc0
 
 8.3.0 -- 2018-10-12
--- a/hgext3rd/topic/__init__.py	Thu Oct 25 10:01:58 2018 +0200
+++ b/hgext3rd/topic/__init__.py	Thu Oct 25 12:49:48 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/hgext3rd/topic/discovery.py	Thu Oct 25 10:01:58 2018 +0200
+++ b/hgext3rd/topic/discovery.py	Thu Oct 25 12:49:48 2018 +0200
@@ -81,8 +81,11 @@
 
         def revbranchcache(self):
             rbc = super(repocls, self).revbranchcache()
+            localchangelog = self.changelog
 
             def branchinfo(rev, changelog=None):
+                if changelog is None:
+                    changelog = localchangelog
                 branch, close = changelog.branchinfo(rev)
                 if rev in publishedset:
                     return branch, close
--- a/tests/test-topic-stack-complex.t	Thu Oct 25 10:01:58 2018 +0200
+++ b/tests/test-topic-stack-complex.t	Thu Oct 25 12:49:48 2018 +0200
@@ -134,3 +134,46 @@
   s2@ split1 (current)
   s1: Added a and b
   s0^ Added foo (base)
+
+Test case with divergence
+-------------------------
+
+  $ hg evolve --all
+  move:[s3] split2
+  atop:[s2] split1
+  move:[s4] Added e and f
+  working directory is now at ec94a1ed1330
+  $ hg up s4
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ hg id -r .
+  ec94a1ed1330 tip
+  $ hg up --hidden 'min(precursors(.))'
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  updated to hidden changeset f1d3649d6a8b
+  (hidden revision 'f1d3649d6a8b' was rewritten as: ec94a1ed1330)
+  working directory parent is obsolete! (f1d3649d6a8b)
+  (use 'hg evolve' to update to its successor: ec94a1ed1330)
+  $ hg amend -d '0 1'
+  1 new orphan changesets
+  2 new content-divergent changesets
+  $ hg rebase -r . -d ec94a1ed1330~1
+  rebasing 9:eb3b16fef8ea "Added e and f" (tip foo)
+  $ hg stack
+  ### topic: foo (2 heads)
+  ### target: default (branch)
+  s5: Added e and f
+  s3^ split2 (base)
+  s4@ Added e and f (current)
+  s3: split2
+  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