##// END OF EJS Templates
graft: don't remove from a list in a loop...
Martin von Zweigbergk -
r44497:df82c06e default
parent child Browse files
Show More
@@ -3082,14 +3082,13 b' def _dograft(ui, repo, *revs, **opts):'
3082 crev = repo[b'.'].rev()
3082 crev = repo[b'.'].rev()
3083 ancestors = repo.changelog.ancestors([crev], inclusive=True)
3083 ancestors = repo.changelog.ancestors([crev], inclusive=True)
3084 # XXX make this lazy in the future
3084 # XXX make this lazy in the future
3085 # don't mutate while iterating, create a copy
3085 for rev in revs:
3086 for rev in list(revs):
3087 if rev in ancestors:
3086 if rev in ancestors:
3088 ui.warn(
3087 ui.warn(
3089 _(b'skipping ancestor revision %d:%s\n') % (rev, repo[rev])
3088 _(b'skipping ancestor revision %d:%s\n') % (rev, repo[rev])
3090 )
3089 )
3091 # XXX remove on list is slow
3090 revs = [r for r in revs if r not in ancestors]
3092 revs.remove(rev)
3091
3093 if not revs:
3092 if not revs:
3094 return -1
3093 return -1
3095
3094
General Comments 0
You need to be logged in to leave comments. Login now