Show More
@@ -385,8 +385,8 b' def _calcmode(vfs):' | |||||
385 | b'requires', |
|
385 | b'requires', | |
386 | ] |
|
386 | ] | |
387 |
|
387 | |||
388 |
REVLOG_FILES_ |
|
388 | REVLOG_FILES_EXT = ( | |
389 | REVLOG_FILES_OTHER_EXT = ( |
|
389 | b'.i', | |
390 | b'.idx', |
|
390 | b'.idx', | |
391 | b'.d', |
|
391 | b'.d', | |
392 | b'.dat', |
|
392 | b'.dat', | |
@@ -415,22 +415,16 b" EXCLUDED = re.compile(br'.*undo\\.[^/]+\\." | |||||
415 |
|
415 | |||
416 | def is_revlog(f, kind, st): |
|
416 | def is_revlog(f, kind, st): | |
417 | if kind != stat.S_IFREG: |
|
417 | if kind != stat.S_IFREG: | |
418 |
return |
|
418 | return False | |
419 | return revlog_type(f) |
|
419 | if f.endswith(REVLOG_FILES_EXT): | |
|
420 | return True | |||
|
421 | return False | |||
420 |
|
422 | |||
421 |
|
423 | |||
422 |
def revlog_ |
|
424 | def is_revlog_file(f): | |
423 | # XXX we need to filter `undo.` created by the transaction here, however |
|
425 | if f.endswith(REVLOG_FILES_EXT): | |
424 | # being naive about it also filter revlog for `undo.*` files, leading to |
|
426 | return True | |
425 | # issue6542. So we no longer use EXCLUDED. |
|
427 | return False | |
426 | if f.endswith(REVLOG_FILES_MAIN_EXT): |
|
|||
427 | return FILEFLAGS_REVLOG_MAIN |
|
|||
428 | elif f.endswith(REVLOG_FILES_OTHER_EXT): |
|
|||
429 | t = FILETYPE_FILELOG_OTHER |
|
|||
430 | if f.endswith(REVLOG_FILES_VOLATILE_EXT): |
|
|||
431 | t |= FILEFLAGS_VOLATILE |
|
|||
432 | return t |
|
|||
433 | return None |
|
|||
434 |
|
428 | |||
435 |
|
429 | |||
436 | # the file is part of changelog data |
|
430 | # the file is part of changelog data | |
@@ -758,10 +752,9 b' class basicstore:' | |||||
758 | p = visit.pop() |
|
752 | p = visit.pop() | |
759 | for f, kind, st in readdir(p, stat=True): |
|
753 | for f, kind, st in readdir(p, stat=True): | |
760 | fp = p + b'/' + f |
|
754 | fp = p + b'/' + f | |
761 |
|
|
755 | if is_revlog(f, kind, st): | |
762 | if rl_type is not None: |
|
|||
763 | n = util.pconvert(fp[striplen:]) |
|
756 | n = util.pconvert(fp[striplen:]) | |
764 |
l.append((decodedir(n), |
|
757 | l.append((decodedir(n), st.st_size)) | |
765 | elif kind == stat.S_IFDIR and recurse: |
|
758 | elif kind == stat.S_IFDIR and recurse: | |
766 | visit.append(fp) |
|
759 | visit.append(fp) | |
767 |
|
760 | |||
@@ -794,20 +787,16 b' class basicstore:' | |||||
794 | ] |
|
787 | ] | |
795 | for base_dir, rl_type, strip_filename in dirs: |
|
788 | for base_dir, rl_type, strip_filename in dirs: | |
796 | files = self._walk(base_dir, True, undecodable=undecodable) |
|
789 | files = self._walk(base_dir, True, undecodable=undecodable) | |
797 | files = (f for f in files if f[1][0] is not None) |
|
|||
798 | for revlog, details in _gather_revlog(files): |
|
790 | for revlog, details in _gather_revlog(files): | |
799 | file_details = {} |
|
|||
800 | revlog_target_id = revlog.split(b'/', 1)[1] |
|
791 | revlog_target_id = revlog.split(b'/', 1)[1] | |
801 | if strip_filename and b'/' in revlog: |
|
792 | if strip_filename and b'/' in revlog: | |
802 | revlog_target_id = revlog_target_id.rsplit(b'/', 1)[0] |
|
793 | revlog_target_id = revlog_target_id.rsplit(b'/', 1)[0] | |
803 | revlog_target_id += b'/' |
|
794 | revlog_target_id += b'/' | |
804 | for ext, (t, size) in sorted(details.items()): |
|
|||
805 | file_details[ext] = size |
|
|||
806 | yield RevlogStoreEntry( |
|
795 | yield RevlogStoreEntry( | |
807 | path_prefix=revlog, |
|
796 | path_prefix=revlog, | |
808 | revlog_type=rl_type, |
|
797 | revlog_type=rl_type, | |
809 | target_id=revlog_target_id, |
|
798 | target_id=revlog_target_id, | |
810 |
details= |
|
799 | details=details, | |
811 | ) |
|
800 | ) | |
812 |
|
801 | |||
813 | def top_entries( |
|
802 | def top_entries( | |
@@ -831,17 +820,17 b' class basicstore:' | |||||
831 | changelogs = collections.defaultdict(dict) |
|
820 | changelogs = collections.defaultdict(dict) | |
832 | manifestlogs = collections.defaultdict(dict) |
|
821 | manifestlogs = collections.defaultdict(dict) | |
833 |
|
822 | |||
834 |
for u, |
|
823 | for u, s in files: | |
835 | if u.startswith(b'00changelog'): |
|
824 | if u.startswith(b'00changelog'): | |
836 | name, ext = _split_revlog_ext(u) |
|
825 | name, ext = _split_revlog_ext(u) | |
837 |
changelogs[name][ext] = |
|
826 | changelogs[name][ext] = s | |
838 | elif u.startswith(b'00manifest'): |
|
827 | elif u.startswith(b'00manifest'): | |
839 | name, ext = _split_revlog_ext(u) |
|
828 | name, ext = _split_revlog_ext(u) | |
840 |
manifestlogs[name][ext] = |
|
829 | manifestlogs[name][ext] = s | |
841 | else: |
|
830 | else: | |
842 | yield SimpleStoreEntry( |
|
831 | yield SimpleStoreEntry( | |
843 | entry_path=u, |
|
832 | entry_path=u, | |
844 |
is_volatile= |
|
833 | is_volatile=False, | |
845 | file_size=s, |
|
834 | file_size=s, | |
846 | ) |
|
835 | ) | |
847 | # yield manifest before changelog |
|
836 | # yield manifest before changelog | |
@@ -853,14 +842,11 b' class basicstore:' | |||||
853 | assert len(changelogs) <= 1 |
|
842 | assert len(changelogs) <= 1 | |
854 | for data, revlog_type in top_rl: |
|
843 | for data, revlog_type in top_rl: | |
855 | for revlog, details in sorted(data.items()): |
|
844 | for revlog, details in sorted(data.items()): | |
856 | file_details = {} |
|
|||
857 | for ext, (t, size) in details.items(): |
|
|||
858 | file_details[ext] = size |
|
|||
859 | yield RevlogStoreEntry( |
|
845 | yield RevlogStoreEntry( | |
860 | path_prefix=revlog, |
|
846 | path_prefix=revlog, | |
861 | revlog_type=revlog_type, |
|
847 | revlog_type=revlog_type, | |
862 | target_id=b'', |
|
848 | target_id=b'', | |
863 |
details= |
|
849 | details=details, | |
864 | ) |
|
850 | ) | |
865 |
|
851 | |||
866 | def walk( |
|
852 | def walk( | |
@@ -1083,7 +1069,7 b' class _fncachevfs(vfsmod.proxyvfs):' | |||||
1083 | if ( |
|
1069 | if ( | |
1084 | mode not in (b'r', b'rb') |
|
1070 | mode not in (b'r', b'rb') | |
1085 | and (path.startswith(b'data/') or path.startswith(b'meta/')) |
|
1071 | and (path.startswith(b'data/') or path.startswith(b'meta/')) | |
1086 |
and revlog_ |
|
1072 | and is_revlog_file(path) | |
1087 | ): |
|
1073 | ): | |
1088 | # do not trigger a fncache load when adding a file that already is |
|
1074 | # do not trigger a fncache load when adding a file that already is | |
1089 | # known to exist. |
|
1075 | # known to exist. | |
@@ -1136,14 +1122,12 b' class fncachestore(basicstore):' | |||||
1136 | def data_entries( |
|
1122 | def data_entries( | |
1137 | self, matcher=None, undecodable=None |
|
1123 | self, matcher=None, undecodable=None | |
1138 | ) -> Generator[BaseStoreEntry, None, None]: |
|
1124 | ) -> Generator[BaseStoreEntry, None, None]: | |
1139 | files = ((f, revlog_type(f)) for f in self.fncache) |
|
|||
1140 | # Note: all files in fncache should be revlog related, However the |
|
1125 | # Note: all files in fncache should be revlog related, However the | |
1141 | # fncache might contains such file added by previous version of |
|
1126 | # fncache might contains such file added by previous version of | |
1142 | # Mercurial. |
|
1127 | # Mercurial. | |
1143 | files = (f for f in files if f[1] is not None) |
|
1128 | files = ((f, None) for f in self.fncache if is_revlog_file(f)) | |
1144 | by_revlog = _gather_revlog(files) |
|
1129 | by_revlog = _gather_revlog(files) | |
1145 | for revlog, details in by_revlog: |
|
1130 | for revlog, details in by_revlog: | |
1146 | file_details = {} |
|
|||
1147 | if revlog.startswith(b'data/'): |
|
1131 | if revlog.startswith(b'data/'): | |
1148 | rl_type = FILEFLAGS_FILELOG |
|
1132 | rl_type = FILEFLAGS_FILELOG | |
1149 | revlog_target_id = revlog.split(b'/', 1)[1] |
|
1133 | revlog_target_id = revlog.split(b'/', 1)[1] | |
@@ -1155,13 +1139,11 b' class fncachestore(basicstore):' | |||||
1155 | else: |
|
1139 | else: | |
1156 | # unreachable |
|
1140 | # unreachable | |
1157 | assert False, revlog |
|
1141 | assert False, revlog | |
1158 | for ext in details: |
|
|||
1159 | file_details[ext] = None |
|
|||
1160 | entry = RevlogStoreEntry( |
|
1142 | entry = RevlogStoreEntry( | |
1161 | path_prefix=revlog, |
|
1143 | path_prefix=revlog, | |
1162 | revlog_type=rl_type, |
|
1144 | revlog_type=rl_type, | |
1163 | target_id=revlog_target_id, |
|
1145 | target_id=revlog_target_id, | |
1164 |
details= |
|
1146 | details=details, | |
1165 | ) |
|
1147 | ) | |
1166 | if _match_tracked_entry(entry, matcher): |
|
1148 | if _match_tracked_entry(entry, matcher): | |
1167 | yield entry |
|
1149 | yield entry |
@@ -370,7 +370,7 b' def _files_to_copy_post_revlog_clone(src' | |||||
370 | are cloned""" |
|
370 | are cloned""" | |
371 | for path, kind, st in sorted(srcrepo.store.vfs.readdir(b'', stat=True)): |
|
371 | for path, kind, st in sorted(srcrepo.store.vfs.readdir(b'', stat=True)): | |
372 | # don't copy revlogs as they are already cloned |
|
372 | # don't copy revlogs as they are already cloned | |
373 |
if store.revlog_ |
|
373 | if store.is_revlog_file(path): | |
374 | continue |
|
374 | continue | |
375 | # Skip transaction related files. |
|
375 | # Skip transaction related files. | |
376 | if path.startswith(b'undo'): |
|
376 | if path.startswith(b'undo'): |
General Comments 0
You need to be logged in to leave comments.
Login now