Patchwork [1,of,4] largefiles: drop unnecessary setting of matcher._always

login
register
mail settings
Submitter Martin von Zweigbergk
Date Nov. 2, 2014, 9:43 p.m.
Message ID <b18b2bba8ab399fa1500.1414964593@handduk2.mtv.corp.google.com>
Download mbox | patch
Permalink /patch/6536/
State Accepted
Headers show

Comments

Martin von Zweigbergk - Nov. 2, 2014, 9:43 p.m.
# HG changeset patch
# User Martin von Zweigbergk <martinvonz@google.com>
# Date 1414733559 25200
#      Thu Oct 30 22:32:39 2014 -0700
# Branch stable
# Node ID b18b2bba8ab399fa150015d9d64549687d4c7972
# Parent  cc1cbb0bba8ed1d95c8f1b8e27d4d2893e0dcca7
largefiles: drop unnecessary setting of matcher._always

In two very similar segments of code, an existing matcher is modified
by changing its _files attribute through a map and a filter
operation. Neither operation can cause an empty list to become
non-empty, so a matcher that always matches can not stop always
matching. Drop the setting of the attribute, so we don't unnecessarily
prevent the fast paths to be taken where these matchers end up being
used.

Patch

diff --git a/hgext/largefiles/overrides.py b/hgext/largefiles/overrides.py
--- a/hgext/largefiles/overrides.py
+++ b/hgext/largefiles/overrides.py
@@ -576,7 +576,6 @@ 
                 lfile = lambda f: lfutil.standin(f) in manifest
                 m._files = [lfutil.standin(f) for f in m._files if lfile(f)]
                 m._fmap = set(m._files)
-                m._always = False
                 origmatchfn = m.matchfn
                 m.matchfn = lambda f: (lfutil.isstandin(f) and
                                     (f in manifest) and
@@ -684,7 +683,6 @@ 
             m._files = [tostandin(f) for f in m._files]
             m._files = [f for f in m._files if f is not None]
             m._fmap = set(m._files)
-            m._always = False
             origmatchfn = m.matchfn
             def matchfn(f):
                 if lfutil.isstandin(f):