changeset 37024:c83e2736c6de

merge with stable
author Martin von Zweigbergk <martinvonz@google.com>
date Mon, 19 Mar 2018 08:07:18 -0700
parents 16bbb15406c9 (current diff) 177f3b90335f (diff)
children f2b5c2b7d2e5
files hgext/rebase.py
diffstat 2 files changed, 37 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/rebase.py	Sun Apr 03 14:16:47 2016 +0900
+++ b/hgext/rebase.py	Mon Mar 19 08:07:18 2018 -0700
@@ -1533,9 +1533,10 @@
     try:
         # 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
-        # dstates list must must not contain the dest rev (issue4896)
-        dstates = [s for r, s in state.items() if s >= 0 and s != destmap[r]]
-        immutable = [d for d in dstates if not repo[d].mutable()]
+        # rebased list must must not contain the dest rev (issue4896)
+        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:
             repo.ui.warn(_("warning: can't clean up public changesets %s\n")
@@ -1544,17 +1545,15 @@
             cleanup = False
 
         descendants = set()
-        if dstates:
-            descendants = set(repo.changelog.descendants(dstates))
-        if descendants - set(dstates):
+        if rebased:
+            descendants = set(repo.changelog.descendants(rebased))
+        if descendants - set(rebased):
             repo.ui.warn(_("warning: new changesets detected on destination "
                            "branch, can't strip\n"))
             cleanup = False
 
         if cleanup:
             shouldupdate = False
-            rebased = [s for r, s in state.items()
-                       if s >= 0 and s != destmap[r]]
             if rebased:
                 strippoints = [
                         c.node() for c in repo.set('roots(%ld)', rebased)]
--- a/tests/test-rebase-partial.t	Sun Apr 03 14:16:47 2016 +0900
+++ b/tests/test-rebase-partial.t	Mon Mar 19 08:07:18 2018 -0700
@@ -69,6 +69,36 @@
   |/
   o  0: 426bada5c675 A
   
+Abort doesn't lose the commits that were already in the right place
+
+  $ hg init abort
+  $ cd abort
+  $ hg debugdrawdag <<EOF
+  > C
+  > |
+  > B D  # B/file = B
+  > |/   # D/file = D
+  > A
+  > EOF
+  $ hg rebase -r C+D -d B
+  rebasing 2:ef8c0fe0897b "D" (D)
+  merging file
+  warning: conflicts while merging file! (edit, then use 'hg resolve --mark')
+  unresolved conflicts (see hg resolve, then hg rebase --continue)
+  [1]
+  $ hg rebase --abort
+  rebase aborted
+  $ hg tglog
+  o  3: 79f6d6ab7b14 C
+  |
+  | o  2: ef8c0fe0897b D
+  | |
+  o |  1: 594087dbaf71 B
+  |/
+  o  0: 426bada5c675 A
+  
+  $ cd ..
+
 Rebase with "holes". The commits after the hole should end up on the parent of
 the hole (B below), not on top of the destination (A).