##// END OF EJS Templates
localrepo: use propertycaches to access encode/decode filters
Nicolas Dumazet -
r12708:8a08b12a default
parent child Browse files
Show More
@@ -597,6 +597,14 b' class localrepository(repo.repository):'
597
597
598 return data
598 return data
599
599
600 @propertycache
601 def _encodefilterpats(self):
602 return self._loadfilter('encode')
603
604 @propertycache
605 def _decodefilterpats(self):
606 return self._loadfilter('decode')
607
600 def adddatafilter(self, name, filter):
608 def adddatafilter(self, name, filter):
601 self._datafilters[name] = filter
609 self._datafilters[name] = filter
602
610
@@ -605,10 +613,10 b' class localrepository(repo.repository):'
605 data = os.readlink(self.wjoin(filename))
613 data = os.readlink(self.wjoin(filename))
606 else:
614 else:
607 data = self.wopener(filename, 'r').read()
615 data = self.wopener(filename, 'r').read()
608 return self._filter(self._loadfilter("encode"), filename, data)
616 return self._filter(self._encodefilterpats, filename, data)
609
617
610 def wwrite(self, filename, data, flags):
618 def wwrite(self, filename, data, flags):
611 data = self._filter(self._loadfilter("decode"), filename, data)
619 data = self._filter(self._decodefilterpats, filename, data)
612 try:
620 try:
613 os.unlink(self.wjoin(filename))
621 os.unlink(self.wjoin(filename))
614 except OSError:
622 except OSError:
@@ -621,7 +629,7 b' class localrepository(repo.repository):'
621 util.set_flags(self.wjoin(filename), False, True)
629 util.set_flags(self.wjoin(filename), False, True)
622
630
623 def wwritedata(self, filename, data):
631 def wwritedata(self, filename, data):
624 return self._filter(self._loadfilter("decode"), filename, data)
632 return self._filter(self._decodefilterpats, filename, data)
625
633
626 def transaction(self, desc):
634 def transaction(self, desc):
627 tr = self._transref and self._transref() or None
635 tr = self._transref and self._transref() or None
General Comments 0
You need to be logged in to leave comments. Login now