changeset 43805:3b039e43a1e6

copies: do not initialize the dictionary with root in changeset copies We don't strictly need the dict to be prefiled with `{}`. Not doing so will make the next changeset simpler. This part of a preparation to use native code for this part of copy tracing.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Wed, 13 Nov 2019 09:39:44 +0100
parents 995066c41bb2
children 421ea5772039
files mercurial/copies.py
diffstat 1 files changed, 5 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/copies.py	Wed Nov 13 20:42:08 2019 +0100
+++ b/mercurial/copies.py	Wed Nov 13 09:39:44 2019 +0100
@@ -281,10 +281,13 @@
     iterrevs &= mrset
     iterrevs.update(roots)
     iterrevs.remove(b.rev())
-    all_copies = {r: {} for r in roots}
+    all_copies = {}
     alwaysmatch = match.always()
     for r in sorted(iterrevs):
-        copies = all_copies.pop(r)
+        copies = all_copies.pop(r, None)
+        if copies is None:
+            # this is a root
+            copies = {}
         for i, c in enumerate(children[r]):
             p1, p2, p1copies, p2copies, removed = revinfo(c)
             if r == p1: