changeset 46000:b6b7626d3e06

copies: avoid unwanted side effect from one branch to another Without this copy, change in a one descendant branch (With "remove" change only) could affect computation on another descendant branches. This was not caugh by the test because the test graph are "too simple". I started writing more test in that regards, but I a submitting this changes earlier because I want to get more code landed to allow other optimisation work to happens. Differential Revision: https://phab.mercurial-scm.org/D9416
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Fri, 20 Nov 2020 10:38:46 +0100
parents fada33872b5b
children f9f8d8aa9a92
files mercurial/copies.py
diffstat 1 files changed, 3 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/copies.py	Thu Nov 26 09:54:16 2020 +0100
+++ b/mercurial/copies.py	Fri Nov 20 10:38:46 2020 +0100
@@ -354,7 +354,9 @@
                         source = prev[1]
                     newcopies[dest] = (c, source)
                 assert newcopies is not copies
-            if changes is not None:
+            if changes is not None and changes.removed:
+                if newcopies is copies:
+                    newcopies = copies.copy()
                 for f in changes.removed:
                     if f in newcopies:
                         if newcopies is copies: