Patchwork D9416: copies: avoid unwanted side effect from one branch to another

login
register
mail settings
Submitter phabricator
Date Nov. 27, 2020, 4:11 p.m.
Message ID <differential-rev-PHID-DREV-5iacjggvkfflk2l2dvx4-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/47695/
State Superseded
Headers show

Comments

phabricator - Nov. 27, 2020, 4:11 p.m.
Alphare created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  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.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D9416

AFFECTED FILES
  mercurial/copies.py

CHANGE DETAILS




To: Alphare, #hg-reviewers
Cc: mercurial-patches, mercurial-devel

Patch

diff --git a/mercurial/copies.py b/mercurial/copies.py
--- a/mercurial/copies.py
+++ b/mercurial/copies.py
@@ -379,7 +379,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: