Mercurial > public > mercurial-scm > hg
comparison mercurial/copies.py @ 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 | b9588ff9b66a |
children | e0313b0a6f7e |
comparison
equal
deleted
inserted
replaced
46035:6c960b708ac4 | 46036:8d54944eaeb0 |
---|---|
378 # In case of conflict, parent 1 take precedence over parent 2. | 378 # In case of conflict, parent 1 take precedence over parent 2. |
379 # This is an arbitrary choice made anew when implementing | 379 # This is an arbitrary choice made anew when implementing |
380 # changeset based copies. It was made without regards with | 380 # changeset based copies. It was made without regards with |
381 # potential filelog related behavior. | 381 # potential filelog related behavior. |
382 if parent == 1: | 382 if parent == 1: |
383 if newcopies is copies: | |
384 newcopies = copies.copy() | |
383 minor, major = othercopies, newcopies | 385 minor, major = othercopies, newcopies |
384 else: | 386 else: |
385 minor, major = newcopies, othercopies | 387 # we do not know if the other dict is a copy or not, so we |
388 # need to blindly copy it. Future change should make this | |
389 # unnecessary. | |
390 minor, major = newcopies, othercopies.copy() | |
386 copies = _merge_copies_dict(minor, major, isancestor, changes) | 391 copies = _merge_copies_dict(minor, major, isancestor, changes) |
387 all_copies[c] = copies | 392 all_copies[c] = copies |
388 | 393 |
389 final_copies = {} | 394 final_copies = {} |
390 for dest, (tt, source) in all_copies[targetrev].items(): | 395 for dest, (tt, source) in all_copies[targetrev].items(): |