##// END OF EJS Templates
store: split the wrapping of encodedstore between _wrap and datafiles...
marmoute -
r51386:816e8bc6 default
parent child Browse files
Show More
@@ -602,7 +602,7 b' class basicstore:'
602 def join(self, f):
602 def join(self, f):
603 return self.path + b'/' + encodedir(f)
603 return self.path + b'/' + encodedir(f)
604
604
605 def _walk(self, relpath, recurse):
605 def _walk(self, relpath, recurse, undecodable=None):
606 '''yields (revlog_type, unencoded, size)'''
606 '''yields (revlog_type, unencoded, size)'''
607 path = self.path
607 path = self.path
608 if relpath:
608 if relpath:
@@ -651,7 +651,7 b' class basicstore:'
651 (b'meta', FILEFLAGS_MANIFESTLOG),
651 (b'meta', FILEFLAGS_MANIFESTLOG),
652 ]
652 ]
653 for base_dir, rl_type in dirs:
653 for base_dir, rl_type in dirs:
654 files = self._walk(base_dir, True)
654 files = self._walk(base_dir, True, undecodable=undecodable)
655 files = (f for f in files if f[1][0] is not None)
655 files = (f for f in files if f[1][0] is not None)
656 for revlog, details in _gather_revlog(files):
656 for revlog, details in _gather_revlog(files):
657 for ext, (t, s) in sorted(details.items()):
657 for ext, (t, s) in sorted(details.items()):
@@ -755,17 +755,11 b' class encodedstore(basicstore):'
755 self.vfs = vfsmod.filtervfs(vfs, encodefilename)
755 self.vfs = vfsmod.filtervfs(vfs, encodefilename)
756 self.opener = self.vfs
756 self.opener = self.vfs
757
757
758 # note: topfiles would also need a decode phase. It is just that in
758 def _walk(self, relpath, recurse, undecodable=None):
759 # practice we do not have any file outside of `data/` that needs encoding.
759 old = super()._walk(relpath, recurse)
760 # However that might change so we should probably add a test and encoding
760 new = []
761 # decoding for it too. see issue6548
761 for f1, value in old:
762
763 def datafiles(
764 self, matcher=None, undecodable=None
765 ) -> Generator[BaseStoreEntry, None, None]:
766 for entry in super(encodedstore, self).datafiles():
767 try:
762 try:
768 f1 = entry.unencoded_path
769 f2 = decodefilename(f1)
763 f2 = decodefilename(f1)
770 except KeyError:
764 except KeyError:
771 if undecodable is None:
765 if undecodable is None:
@@ -774,10 +768,16 b' class encodedstore(basicstore):'
774 else:
768 else:
775 undecodable.append(f1)
769 undecodable.append(f1)
776 continue
770 continue
777 if not _matchtrackedpath(f2, matcher):
771 new.append((f2, value))
778 continue
772 return new
779 entry.unencoded_path = f2
773
780 yield entry
774 def datafiles(
775 self, matcher=None, undecodable=None
776 ) -> Generator[BaseStoreEntry, None, None]:
777 entries = super(encodedstore, self).datafiles(undecodable=undecodable)
778 for entry in entries:
779 if _matchtrackedpath(entry.unencoded_path, matcher):
780 yield entry
781
781
782 def join(self, f):
782 def join(self, f):
783 return self.path + b'/' + encodefilename(f)
783 return self.path + b'/' + encodefilename(f)
General Comments 0
You need to be logged in to leave comments. Login now