branchmap: make "closed" a set from beginning instead of converting from list
authorMartin von Zweigbergk <martinvonz@google.com>
Thu, 14 Nov 2019 21:13:46 -0800
changeset 43688 5cdc3c1292f6
parent 43687 f1dabf99db17
child 43689 f7d7f9d23a7a
branchmap: make "closed" a set from beginning instead of converting from list Differential Revision: https://phab.mercurial-scm.org/D7427
mercurial/branchmap.py
--- a/mercurial/branchmap.py	Sun Nov 17 01:34:52 2019 -0500
+++ b/mercurial/branchmap.py	Thu Nov 14 21:13:46 2019 -0800
@@ -107,14 +107,14 @@
         clrev = cl.rev
         clbranchinfo = cl.branchinfo
         rbheads = []
-        closed = []
+        closed = set()
         for bheads in pycompat.itervalues(remotebranchmap):
             rbheads += bheads
             for h in bheads:
                 r = clrev(h)
                 b, c = clbranchinfo(r)
                 if c:
-                    closed.append(h)
+                    closed.add(h)
 
         if rbheads:
             rtiprev = max((int(clrev(node)) for node in rbheads))
@@ -122,7 +122,7 @@
                 remotebranchmap,
                 repo[rtiprev].node(),
                 rtiprev,
-                closednodes=set(closed),
+                closednodes=closed,
             )
 
             # Try to stick it as low as possible