Patchwork D8356: rebase: don't create merge when continuing rebase interrupted by old hg

login
register
mail settings
Submitter phabricator
Date April 1, 2020, 9:46 p.m.
Message ID <differential-rev-PHID-DREV-vb4tquage726xnqlan76-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/45988/
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
  This fixes the bug described and demonstrated in the previous
  commit. It does so by practically undoing 8082a77cc3a2 <https://phab.mercurial-scm.org/rHG8082a77cc3a2b4db9a080d41bb50e1ebbf00cdf5> (rebase: remove
  some redundant setting of dirstate parents, 2020-01-10).

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  hgext/rebase.py
  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
@@ -327,21 +327,16 @@ 
   $ 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
+  saved backup bundle to $TESTTMP/a4/.hg/strip-backup/27547f69f254-359abdd7-rebase.hg
   $ 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  4: d2d25e26288e 'C'
+  |
+  o  3: 45396c49d53b 'B'
+  |
+  @  2: ae36e8e3dfd7 'E'
+  |
+  o  1: 46b37eabc604 'D'
+  |
   o  0: 4a2df7238c3b 'A'
   
   $ cd ..
diff --git a/hgext/rebase.py b/hgext/rebase.py
--- a/hgext/rebase.py
+++ b/hgext/rebase.py
@@ -631,6 +631,12 @@ 
                 editor = cmdutil.getcommiteditor(
                     editform=editform, **pycompat.strkwargs(opts)
                 )
+                # We need to set parents again here just in case we're continuing
+                # a rebase started with an old hg version (before 9c9cfecd4600),
+                # because those old versions would have left us with two dirstate
+                # parents, and we don't want to create a merge commit here (unless
+                # we're rebasing a merge commit).
+                self.wctx.setparents(repo[p1].node(), repo[p2].node())
                 newnode = self._concludenode(rev, p1, editor)
             else:
                 # Skip commit if we are collapsing