changeset 46036:8d54944eaeb0

copies: properly copies parent dictionary before updating it This enforces the copy on write logic. Otherwise independant unrelated branches could affected each other. More testing of these case are coming, but I need that code landed to unlock other performance work in parallel. Differential Revision: https://phab.mercurial-scm.org/D9419
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Fri, 20 Nov 2020 10:51:07 +0100
parents 6c960b708ac4
children 9624bf057c2a
files mercurial/copies.py
diffstat 1 files changed, 6 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/copies.py	Mon Nov 30 14:07:23 2020 +0100
+++ b/mercurial/copies.py	Fri Nov 20 10:51:07 2020 +0100
@@ -380,9 +380,14 @@
                 # changeset based copies. It was made without regards with
                 # potential filelog related behavior.
                 if parent == 1:
+                    if newcopies is copies:
+                        newcopies = copies.copy()
                     minor, major = othercopies, newcopies
                 else:
-                    minor, major = newcopies, othercopies
+                    # we do not know if the other dict is a copy or not, so we
+                    # need to blindly copy it. Future change should make this
+                    # unnecessary.
+                    minor, major = newcopies, othercopies.copy()
                 copies = _merge_copies_dict(minor, major, isancestor, changes)
                 all_copies[c] = copies