comparison mercurial/copies.py @ 45985: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 7d3c51c728c9
children f9f8d8aa9a92
comparison
equal deleted inserted replaced
45984:fada33872b5b 45985:b6b7626d3e06
352 prev = copies.get(source) 352 prev = copies.get(source)
353 if prev is not None and prev[1] is not None: 353 if prev is not None and prev[1] is not None:
354 source = prev[1] 354 source = prev[1]
355 newcopies[dest] = (c, source) 355 newcopies[dest] = (c, source)
356 assert newcopies is not copies 356 assert newcopies is not copies
357 if changes is not None: 357 if changes is not None and changes.removed:
358 if newcopies is copies:
359 newcopies = copies.copy()
358 for f in changes.removed: 360 for f in changes.removed:
359 if f in newcopies: 361 if f in newcopies:
360 if newcopies is copies: 362 if newcopies is copies:
361 # copy on write to avoid affecting potential other 363 # copy on write to avoid affecting potential other
362 # branches. when there are no other branches, this 364 # branches. when there are no other branches, this