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.
--- 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))