[Commented On] D9608: copies: stop attempt to avoid extra dict copies around branching

baymax (Baymax, Your Personal Patch-care Companion) phabricator at mercurial-scm.org
Mon Dec 21 08:00:35 UTC 2020


baymax added a comment.
baymax updated this revision to Diff 24451.


  ✅ refresh by Heptapod after a successful CI run (🐙 💚)

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D9608?vs=24413&id=24451

BRANCH
  default

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D9608/new/

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

AFFECTED FILES
  mercurial/copies.py

CHANGE DETAILS

diff --git a/mercurial/copies.py b/mercurial/copies.py
--- a/mercurial/copies.py
+++ b/mercurial/copies.py
@@ -383,9 +383,11 @@
 
                 if copies is None:
                     # this is a root
-                    copies = {}
-
-                newcopies = copies
+                    newcopies = copies = {}
+                elif remaining_children:
+                    newcopies = copies.copy()
+                else:
+                    newcopies = copies
                 # chain the data in the edge with the existing data
                 if changes is not None:
                     childcopies = {}
@@ -403,8 +405,6 @@
                             newcopies[dest] = (current_rev, source)
                         assert newcopies is not copies
                     if changes.removed:
-                        if newcopies is copies:
-                            newcopies = copies.copy()
                         for f in changes.removed:
                             if f in newcopies:
                                 if newcopies is copies:
@@ -417,9 +417,6 @@
                 # that child). See comment below for details.
                 if current_copies is None:
                     current_copies = newcopies
-                elif current_copies is newcopies:
-                    # nothing to merge:
-                    pass
                 else:
                     # we are the second parent to work on c, we need to merge our
                     # work with the other.



To: marmoute, #hg-reviewers
Cc: mercurial-patches
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurial-scm.org/pipermail/mercurial-patches/attachments/20201221/d9d90c08/attachment-0002.html>


More information about the Mercurial-patches mailing list