cleanupnode: do not use generator for node mapping
authorOctobus <contact@octobus.net>
Sun, 09 Jul 2017 15:11:19 +0200
changeset 33352 967ac37f3d45
parent 33351 154298576d44
child 33353 160efb559f67
cleanupnode: do not use generator for node mapping The 'successors' part of the mappings used of be a tuple. This avoid issue from code consuming the generator "by mistake". For example, an extension inspecting the mapping content used to be able to iterate over the successors mapping without consequence. Since the mapping are small we do not expect any performance impact we use tuple again for this.
mercurial/scmutil.py
--- a/mercurial/scmutil.py	Sat Jul 08 16:50:31 2017 -0700
+++ b/mercurial/scmutil.py	Sun Jul 09 15:11:19 2017 +0200
@@ -638,7 +638,7 @@
             isobs = unfi.obsstore.successors.__contains__
             torev = unfi.changelog.rev
             sortfunc = lambda ns: torev(ns[0])
-            rels = [(unfi[n], (unfi[m] for m in s))
+            rels = [(unfi[n], tuple(unfi[m] for m in s))
                     for n, s in sorted(mapping.items(), key=sortfunc)
                     if s or not isobs(n)]
             obsolete.createmarkers(repo, rels, operation=operation)