changeset 32224:456b4a32d75f

rebase: don't update state dict same way for each root The update statement does not depend on anything in the loop, so just move it before the loop and do it once. There are no cases where update would happen 0 times before (and 1 now); the function returns early in all such cases.
author Martin von Zweigbergk <martinvonz@google.com>
date Sat, 11 Mar 2017 12:25:56 -0800
parents e4a4ebfd9d8e
children cf042543afa2
files hgext/rebase.py
diffstat 1 files changed, 1 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/rebase.py	Thu May 04 21:11:40 2017 -0700
+++ b/hgext/rebase.py	Sat Mar 11 12:25:56 2017 -0800
@@ -1246,7 +1246,7 @@
     if not roots:
         raise error.Abort(_('no matching revisions'))
     roots.sort()
-    state = {}
+    state = dict.fromkeys(rebaseset, revtodo)
     detachset = set()
     for root in roots:
         commonbase = root.ancestor(dest)
@@ -1264,7 +1264,6 @@
                 return None
 
         repo.ui.debug('rebase onto %s starting from %s\n' % (dest, root))
-        state.update(dict.fromkeys(rebaseset, revtodo))
         # Rebase tries to turn <dest> into a parent of <root> while
         # preserving the number of parents of rebased changesets:
         #