tests: demonstrate an orphan changeset cause "relocate node on top of itself" stable
authorAnton Shestakov <av6@dwimlabs.net>
Mon, 02 Sep 2019 11:17:23 +0700
branchstable
changeset 4824 f9d436b64b3f
parent 4823 c16fed4908d8
child 4825 9af212b8565a
tests: demonstrate an orphan changeset cause "relocate node on top of itself" See issue6097.
tests/test-evolve-issue6097.t
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-evolve-issue6097.t	Mon Sep 02 11:17:23 2019 +0700
@@ -0,0 +1,87 @@
+Orphan changeset and trying to relocate a node on top of itself (issue6097)
+https://bz.mercurial-scm.org/show_bug.cgi?id=6097
+
+  $ . $TESTDIR/testlib/common.sh
+
+  $ cat << EOF >> $HGRCPATH
+  > [extensions]
+  > rebase =
+  > evolve =
+  > EOF
+
+  $ hg init issue6097
+  $ cd issue6097
+
+  $ echo apricot > a
+  $ hg ci -qAm apricot
+
+  $ echo banana > b
+  $ hg ci -qAm banana
+
+Let's go back to amend 0 and make an orphan out of 1
+
+  $ hg up -q 0
+  $ echo coconut > c
+  $ hg add -q c
+  $ hg ci --amend -m 'apricot and coconut'
+  1 new orphan changesets
+
+Now rebase the successor of 0 on top of 1
+
+  $ hg rebase -r . -d 1
+  rebasing 2:32acf8fb1b23 "apricot and coconut" (tip)
+  1 new orphan changesets
+
+Pruning 1 just to get it out of the way
+
+  $ hg prune -q 1
+
+Note how both the regular DAG and the obsolescence graph are linear, but the
+paths from 3 to 0 are different: 3-1-0 and 3-2-0
+
+  $ hg log -G
+  @  changeset:   3:2868fe6df617
+  |  tag:         tip
+  |  parent:      1:e0486f65907d
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  instability: orphan
+  |  summary:     apricot and coconut
+  |
+  x  changeset:   1:e0486f65907d
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  obsolete:    pruned using prune
+  |  summary:     banana
+  |
+  x  changeset:   0:692cc7b6212c
+     user:        test
+     date:        Thu Jan 01 00:00:00 1970 +0000
+     obsolete:    rewritten using amend, rebase as 3:2868fe6df617
+     summary:     apricot
+  
+
+  $ hg obslog
+  @  2868fe6df617 (3) apricot and coconut
+  |
+  x  32acf8fb1b23 (2) apricot and coconut
+  |    rewritten(parent, content) as 2868fe6df617 using rebase by test (Thu Jan 01 00:00:00 1970 +0000)
+  |
+  x  692cc7b6212c (0) apricot
+       rewritten(description, content) as 32acf8fb1b23 using amend by test (Thu Jan 01 00:00:00 1970 +0000)
+  
+
+FIXME: obviously a traceback is not good
+
+  $ hg evolve -r . 2>&1 | grep '^\S'
+  move:[3] apricot and coconut
+  atop:[3] apricot and coconut
+  ** unknown exception encountered, please report by visiting
+  ** https://mercurial-scm.org/wiki/BugTracker
+  ** Python * (glob)
+  ** Mercurial Distributed SCM (*) (glob)
+  ** Extensions loaded: rebase, evolve
+  ** ProgrammingError: tried to relocate a node on top of itself
+  ** (This shouldn't happen. If you still need to move changesets, please do so manually with nothing to rebase - working directory parent is also destination)
+  Traceback (most recent call last):
+  mercurial.error.ProgrammingError: tried to relocate a node on top of itself