Mercurial > hg-stable
diff mercurial/localrepo.py @ 12708:8a08b12ae88e
localrepo: use propertycaches to access encode/decode filters
author | Nicolas Dumazet <nicdumz.commits@gmail.com> |
---|---|
date | Sun, 10 Oct 2010 18:58:45 +0200 |
parents | 2216ab103ea8 |
children | 18b5b6392fcf |
line wrap: on
line diff
--- a/mercurial/localrepo.py Sun Oct 10 19:10:16 2010 +0200 +++ b/mercurial/localrepo.py Sun Oct 10 18:58:45 2010 +0200 @@ -597,6 +597,14 @@ return data + @propertycache + def _encodefilterpats(self): + return self._loadfilter('encode') + + @propertycache + def _decodefilterpats(self): + return self._loadfilter('decode') + def adddatafilter(self, name, filter): self._datafilters[name] = filter @@ -605,10 +613,10 @@ data = os.readlink(self.wjoin(filename)) else: data = self.wopener(filename, 'r').read() - return self._filter(self._loadfilter("encode"), filename, data) + return self._filter(self._encodefilterpats, filename, data) def wwrite(self, filename, data, flags): - data = self._filter(self._loadfilter("decode"), filename, data) + data = self._filter(self._decodefilterpats, filename, data) try: os.unlink(self.wjoin(filename)) except OSError: @@ -621,7 +629,7 @@ util.set_flags(self.wjoin(filename), False, True) def wwritedata(self, filename, data): - return self._filter(self._loadfilter("decode"), filename, data) + return self._filter(self._decodefilterpats, filename, data) def transaction(self, desc): tr = self._transref and self._transref() or None