Patchwork D6422: copies: avoid calling matcher if matcher.always()

login
register
mail settings
Submitter phabricator
Date June 17, 2019, 5:33 p.m.
Message ID <05ddbb74031dc87df65156ed62cc57e9@localhost.localdomain>
Download mbox | patch
Permalink /patch/40552/
State Not Applicable
Headers show

Comments

phabricator - June 17, 2019, 5:33 p.m.
Closed by commit rHGc0b51449bf6b: copies: avoid calling matcher if matcher.always() (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/D6422?vs=15220&id=15546

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

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

AFFECTED FILES
  mercurial/copies.py

CHANGE DETAILS




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

Patch

diff --git a/mercurial/copies.py b/mercurial/copies.py
--- a/mercurial/copies.py
+++ b/mercurial/copies.py
@@ -270,6 +270,7 @@ 
     # came from.
     work = [(r, 1, {}) for r in roots]
     heapq.heapify(work)
+    alwaysmatch = match.always()
     while work:
         r, i1, copies1 = heapq.heappop(work)
         if work and work[0][0] == r:
@@ -280,7 +281,7 @@ 
             # TODO: perhaps this filtering should be done as long as ctx
             # is merge, whether or not we're tracing from both parent.
             for dst in allcopies:
-                if not match(dst):
+                if not alwaysmatch and not match(dst):
                     continue
                 # Unlike when copies are stored in the filelog, we consider
                 # it a copy even if the destination already existed on the
@@ -306,7 +307,7 @@ 
                 assert r == childctx.p2().rev()
                 parent = 2
                 childcopies = childctx.p2copies()
-            if not match.always():
+            if not alwaysmatch:
                 childcopies = {dst: src for dst, src in childcopies.items()
                                if match(dst)}
             # Copy the dict only if later iterations will also need it