changeset 12707:2216ab103ea8

localrepo: load filter patterns outside of _filter
author Nicolas Dumazet <nicdumz.commits@gmail.com>
date Sun, 10 Oct 2010 19:10:16 +0200
parents 9ca08fbb750a
children 8a08b12ae88e
files mercurial/localrepo.py
diffstat 1 files changed, 5 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/localrepo.py	Sun Oct 10 19:07:58 2010 +0200
+++ b/mercurial/localrepo.py	Sun Oct 10 19:10:16 2010 +0200
@@ -588,8 +588,8 @@
             self.filterpats[filter] = l
         return self.filterpats[filter]
 
-    def _filter(self, filter, filename, data):
-        for mf, fn, cmd in self._loadfilter[filter]:
+    def _filter(self, filterpats, filename, data):
+        for mf, fn, cmd in filterpats:
             if mf(filename):
                 self.ui.debug("filtering %s through %s\n" % (filename, cmd))
                 data = fn(data, cmd, ui=self.ui, repo=self, filename=filename)
@@ -605,10 +605,10 @@
             data = os.readlink(self.wjoin(filename))
         else:
             data = self.wopener(filename, 'r').read()
-        return self._filter("encode", filename, data)
+        return self._filter(self._loadfilter("encode"), filename, data)
 
     def wwrite(self, filename, data, flags):
-        data = self._filter("decode", filename, data)
+        data = self._filter(self._loadfilter("decode"), filename, data)
         try:
             os.unlink(self.wjoin(filename))
         except OSError:
@@ -621,7 +621,7 @@
                 util.set_flags(self.wjoin(filename), False, True)
 
     def wwritedata(self, filename, data):
-        return self._filter("decode", filename, data)
+        return self._filter(self._loadfilter("decode"), filename, data)
 
     def transaction(self, desc):
         tr = self._transref and self._transref() or None