# HG changeset patch # User Pierre-Yves David # Date 2019-11-13 08:39:44 # Node ID fb8f10c0fe88170da52c6a8f031e3c75a56cdf2a # Parent b0f5d8eb703b5d0d908428549fbdadfefa67e153 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. diff --git a/mercurial/copies.py b/mercurial/copies.py --- a/mercurial/copies.py +++ b/mercurial/copies.py @@ -281,10 +281,13 @@ def _changesetforwardcopies(a, b, match) 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: