mercurial/commands.py
changeset 44045 df82c06e1a05
parent 44031 1864efbe90d9
child 44046 4322de8f7016
--- a/mercurial/commands.py	Fri Dec 27 22:40:52 2019 -0800
+++ b/mercurial/commands.py	Fri Dec 27 21:11:33 2019 -0800
@@ -3082,14 +3082,13 @@
         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