Patchwork D6561: copies: simplify merging of copy dicts on merge commits

login
register
mail settings
Submitter phabricator
Date June 24, 2019, 7 p.m.
Message ID <7b6390711d3e4138d94a6d7fddd6b900@localhost.localdomain>
Download mbox | patch
Permalink /patch/40668/
State Not Applicable
Headers show

Comments

phabricator - June 24, 2019, 7 p.m.
Closed by commit rHG907cef396635: copies: simplify merging of copy dicts on merge commits (authored by martinvonz).
This revision was automatically updated to reflect the committed changes.
This revision was not accepted when it landed; it landed in state "Needs Review".

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6561?vs=15625&id=15651

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

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

AFFECTED FILES
  mercurial/copies.py

CHANGE DETAILS




To: martinvonz, #hg-reviewers
Cc: mercurial-devel

Patch

diff --git a/mercurial/copies.py b/mercurial/copies.py
--- a/mercurial/copies.py
+++ b/mercurial/copies.py
@@ -272,25 +272,19 @@ 
     heapq.heapify(work)
     alwaysmatch = match.always()
     while work:
-        r, i1, copies1 = heapq.heappop(work)
+        r, i1, copies = heapq.heappop(work)
         if work and work[0][0] == r:
             # We are tracing copies from both parents
             r, i2, copies2 = heapq.heappop(work)
-            copies = {}
-            allcopies = set(copies1) | set(copies2)
-            for dst in allcopies:
+            for dst, src in copies2.items():
                 # Unlike when copies are stored in the filelog, we consider
                 # it a copy even if the destination already existed on the
                 # other branch. It's simply too expensive to check if the
                 # file existed in the manifest.
-                if dst in copies1:
-                    # If it was copied on the p1 side, mark it as copied from
+                if dst not in copies:
+                    # If it was copied on the p1 side, leave it as copied from
                     # that side, even if it was also copied on the p2 side.
-                    copies[dst] = copies1[dst]
-                else:
                     copies[dst] = copies2[dst]
-        else:
-            copies = copies1
         if r == b.rev():
             _filter(a, b, copies)
             return copies