This instance will be upgraded to Heptapod 0.26.0rc1 on 2021-10-26 at 14:00 UTC+2 (a few minutes of down time)

Commit 62fe7bb9 authored by Martin von Zweigbergk's avatar Martin von Zweigbergk
Browse files

graft: don't remove from a list in a loop

This addresses a TODO added in a1381eea7c7d (graft: do not use
`.remove` on a smart set (regression), 2014-04-28). I couldn't measure
any speedup.

Differential Revision: https://phab.mercurial-scm.org/D7805
parent f3ad014b6a53
......@@ -3082,14 +3082,13 @@ def _dograft(ui, repo, *revs, **opts):
crev = repo[b'.'].rev()
ancestors = repo.changelog.ancestors([crev], inclusive=True)
# XXX make this lazy in the future
# don't mutate while iterating, create a copy
for rev in list(revs):
for rev in revs:
if rev in ancestors:
ui.warn(
_(b'skipping ancestor revision %d:%s\n') % (rev, repo[rev])
)
# XXX remove on list is slow
revs.remove(rev)
revs = [r for r in revs if r not in ancestors]
if not revs:
return -1
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment