# HG changeset patch # User Martin von Zweigbergk # Date 1489263956 28800 # Node ID 456b4a32d75fa846d0c8ec4fb840af0fff98a095 # Parent e4a4ebfd9d8ee96412ee5909b1e4d97694fd55c2 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. diff -r e4a4ebfd9d8e -r 456b4a32d75f hgext/rebase.py --- 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 into a parent of while # preserving the number of parents of rebased changesets: #