changeset 11698:9df481f8036d

localrepo: refactor filter computation Separate loading part from access part to be able to tell with: repo._loadfilter(name) bool(name in repo.filterpats) if there is a 'name' filter available.
author Nicolas Dumazet <nicdumz.commits@gmail.com>
date Sat, 24 Jul 2010 00:28:20 +0900
parents fc360de66217
children da0b9109186d
files mercurial/localrepo.py
diffstat 1 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/localrepo.py	Mon Jul 26 23:26:15 2010 +0200
+++ b/mercurial/localrepo.py	Sat Jul 24 00:28:20 2010 +0900
@@ -510,7 +510,7 @@
     def _link(self, f):
         return os.path.islink(self.wjoin(f))
 
-    def _filter(self, filter, filename, data):
+    def _loadfilter(self, filter):
         if filter not in self.filterpats:
             l = []
             for pat, cmd in self.ui.configitems(filter):
@@ -533,6 +533,9 @@
                 l.append((mf, fn, params))
             self.filterpats[filter] = l
 
+    def _filter(self, filter, filename, data):
+        self._loadfilter(filter)
+
         for mf, fn, cmd in self.filterpats[filter]:
             if mf(filename):
                 self.ui.debug("filtering %s through %s\n" % (filename, cmd))