Patchwork [3,of,5] match: make basematcher._files a @propertycache

login
register
mail settings
Submitter via Mercurial-devel
Date May 24, 2017, 12:04 a.m.
Message ID <21907ffdb1183eee1659.1495584275@martinvonz.svl.corp.google.com>
Download mbox | patch
Permalink /patch/20873/
State Accepted
Headers show

Comments

via Mercurial-devel - May 24, 2017, 12:04 a.m.
# HG changeset patch
# User Martin von Zweigbergk <martinvonz@google.com>
# Date 1495214228 25200
#      Fri May 19 10:17:08 2017 -0700
# Node ID 21907ffdb1183eee1659b439efeb7bc737287d32
# Parent  d87d3fba9d29df0fc13681cbd69d8dc5e0a5ff51
match: make basematcher._files a @propertycache

This will make it easier to override in subclasses (otherwise the
function @propertycache object will be replaced by the
super-constructor call)..

Patch

diff --git a/mercurial/match.py b/mercurial/match.py
--- a/mercurial/match.py
+++ b/mercurial/match.py
@@ -208,7 +208,6 @@ 
         self._cwd = cwd
         if badfn is not None:
             self.bad = badfn
-        self._files = [] # exact files and roots of patterns
         self.matchfn = lambda f: False
 
     def __call__(self, fn):
@@ -246,6 +245,10 @@ 
         Otherwise it is relative to the root of the repo.'''
         return self.rel(f)
 
+    @propertycache
+    def _files(self):
+        return []
+
     def files(self):
         '''Explicitly listed files or patterns or roots:
         if no patterns or .always(): empty list,