Patchwork D2879: rebase: on abort, don't strip commits that didn't need rebased (issue5822)

login
register
mail settings
Submitter phabricator
Date March 16, 2018, 5:36 a.m.
Message ID <differential-rev-PHID-DREV-dyr2rvt5yhf4kzg45tdz-req@phab.mercurial-scm.org>
Download mbox | patch
Permalink /patch/29554/
State Superseded
Headers show

Comments

phabricator - March 16, 2018, 5:36 a.m.
martinvonz created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  I clearly missed adding this condition in https://phab.mercurial-scm.org/rHG78496ac300255e9996b3e282086661afc08af37c (rebase: allow
  rebase even if some revisions need no rebase (BC) (issue5422),
  2017-05-11). Perhaps I should have opted for the "revdone" solution I
  mentioned there...

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  hgext/rebase.py
  tests/test-rebase-partial.t

CHANGE DETAILS




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

Patch

diff --git a/tests/test-rebase-partial.t b/tests/test-rebase-partial.t
--- a/tests/test-rebase-partial.t
+++ b/tests/test-rebase-partial.t
@@ -87,13 +87,13 @@ 
   unresolved conflicts (see hg resolve, then hg rebase --continue)
   [1]
   $ hg rebase --abort
-  saved backup bundle to $TESTTMP/abort/.hg/strip-backup/79f6d6ab7b14-cce2340e-backup.hg
   rebase aborted
-BROKEN: C got stripped
   $ hg tglog
-  o  2: ef8c0fe0897b D
+  o  3: 79f6d6ab7b14 C
   |
-  | o  1: 594087dbaf71 B
+  | o  2: ef8c0fe0897b D
+  | |
+  o |  1: 594087dbaf71 B
   |/
   o  0: 426bada5c675 A
   
diff --git a/hgext/rebase.py b/hgext/rebase.py
--- a/hgext/rebase.py
+++ b/hgext/rebase.py
@@ -1544,7 +1544,8 @@ 
         # If the first commits in the rebased set get skipped during the rebase,
         # their values within the state mapping will be the dest rev id. The
         # rebased list must must not contain the dest rev (issue4896)
-        rebased = [s for r, s in state.items() if s >= 0 and s != destmap[r]]
+        rebased = [s for r, s in state.items()
+                   if s >= 0 and s != r and s != destmap[r]]
         immutable = [d for d in rebased if not repo[d].mutable()]
         cleanup = True
         if immutable: