Patchwork D8355: tests: demonstrate how continuing rebase after upgrade can result in merge

login
register
mail settings
Submitter phabricator
Date April 1, 2020, 9:46 p.m.
Message ID <differential-rev-PHID-DREV-zbeaf7gvuiqgfaw5d4v7-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/45987/
State Superseded
Headers show

Comments

phabricator - April 1, 2020, 9:46 p.m.
martinvonz created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  If the user starts a rebase with an hg version before 9c9cfecd4600 <https://phab.mercurial-scm.org/rHG9c9cfecd46000948f442c7585594dedeef5d663a>
  (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.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D8355

AFFECTED FILES
  tests/test-rebase-interruptions.t

CHANGE DETAILS




To: martinvonz, #hg-reviewers
Cc: mercurial-devel

Patch

diff --git a/tests/test-rebase-interruptions.t b/tests/test-rebase-interruptions.t
--- a/tests/test-rebase-interruptions.t
+++ b/tests/test-rebase-interruptions.t
@@ -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