tests: demonstrate how continuing rebase after upgrade can result in merge
authorMartin von Zweigbergk <martinvonz@google.com>
Wed, 01 Apr 2020 13:27:28 -0700
changeset 44665 e89b3603d3da
parent 44664 8c66a680f396
child 44666 e7af56a0733e
tests: demonstrate how continuing rebase after upgrade can result in merge If the user starts a rebase with an hg version before 9c9cfecd4600 (rebase: don't use rebased node as dirstate p2 (BC), 2020-01-10) and then runs into conflicts, they will be dropped out to the shell with the rebased node set as the dirstate's second parent. If they then upgrade to a later hg version, it will respect the dirstate's parents and will create a merge commit even if the user was rebasing a non-merge commit. Differential Revision: https://phab.mercurial-scm.org/D8355
tests/test-rebase-interruptions.t
--- a/tests/test-rebase-interruptions.t	Mon Feb 03 22:17:19 2020 -0500
+++ b/tests/test-rebase-interruptions.t	Wed Apr 01 13:27:28 2020 -0700
@@ -281,6 +281,71 @@
 
   $ cd ..
 
+Continue rebase after upgrading from an hg version before 9c9cfecd4600:
+
+  $ hg clone -q -u . a a4
+  $ cd a4
+
+  $ hg tglog
+  @  4: ae36e8e3dfd7 'E'
+  |
+  o  3: 46b37eabc604 'D'
+  |
+  | o  2: 965c486023db 'C'
+  | |
+  | o  1: 27547f69f254 'B'
+  |/
+  o  0: 4a2df7238c3b 'A'
+  
+  $ hg rebase -s 1 -d 4
+  rebasing 1:27547f69f254 "B"
+  rebasing 2:965c486023db "C"
+  merging A
+  warning: conflicts while merging A! (edit, then use 'hg resolve --mark')
+  unresolved conflicts (see hg resolve, then hg rebase --continue)
+  [1]
+  $ hg tglog
+  @  5: 45396c49d53b 'B'
+  |
+  o  4: ae36e8e3dfd7 'E'
+  |
+  o  3: 46b37eabc604 'D'
+  |
+  | %  2: 965c486023db 'C'
+  | |
+  | o  1: 27547f69f254 'B'
+  |/
+  o  0: 4a2df7238c3b 'A'
+  
+Simulate having run the above with an older hg version by manually setting
+two dirstate parents. We should not get a merge commit when we continue.
+  $ hg debugsetparents 5 2
+  $ echo 'conflict solved' > A
+  $ hg resolve -m A
+  (no more unresolved files)
+  continue: hg rebase --continue
+  $ hg rebase --continue
+  already rebased 1:27547f69f254 "B" as 45396c49d53b
+  rebasing 2:965c486023db "C"
+  warning: orphaned descendants detected, not stripping 27547f69f254, 965c486023db
+BROKEN: we should not have a merge commit here
+  $ hg tglog
+  o    6: 567335b578a0 'C'
+  |\
+  | o  5: 45396c49d53b 'B'
+  | |
+  | @  4: ae36e8e3dfd7 'E'
+  | |
+  | o  3: 46b37eabc604 'D'
+  | |
+  o |  2: 965c486023db 'C'
+  | |
+  o |  1: 27547f69f254 'B'
+  |/
+  o  0: 4a2df7238c3b 'A'
+  
+  $ cd ..
+
 (precommit version)
 
   $ cp -R a3 hook-precommit