changeset 36980:a046d6890761 stable

rebase: avoid defining two lists with the same contents In abort(), there's "dstates" and "rebased" that are identical, which they seem to have been since 0806823370d8 (rebase: properly calculate descendant set when aborting (issue3332), 2012-03-22). Let's de-duplicate. I don't know what "dstates" means, but "rebased" makes sense (it's the list of rebased revisions), so let's pick that. Differential Revision: https://phab.mercurial-scm.org/D2878
author Martin von Zweigbergk <martinvonz@google.com>
date Thu, 15 Mar 2018 21:40:51 -0700
parents b9a6ee2066f9
children 177f3b90335f
files hgext/rebase.py
diffstat 1 files changed, 6 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/rebase.py	Thu Mar 15 21:51:33 2018 -0700
+++ b/hgext/rebase.py	Thu Mar 15 21:40:51 2018 -0700
@@ -1543,9 +1543,9 @@
     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 != 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")
@@ -1554,17 +1554,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)]