diff hgext/rebase.py @ 37021:c83e2736c6de

merge with stable
author Martin von Zweigbergk <martinvonz@google.com>
date Mon, 19 Mar 2018 08:07:18 -0700
parents 795eb53f1d3e 177f3b90335f
children 0782ac132a41
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)]