##// END OF EJS Templates
localrepo: support marking repos as having shallow file storage...
Gregory Szorc -
r40426:7e3b6c4f default
parent child Browse files
Show More
@@ -101,6 +101,7 b" REQUIREMENT = b'exp-sqlite-001'"
101 101 REQUIREMENT_ZSTD = b'exp-sqlite-comp-001=zstd'
102 102 REQUIREMENT_ZLIB = b'exp-sqlite-comp-001=zlib'
103 103 REQUIREMENT_NONE = b'exp-sqlite-comp-001=none'
104 REQUIREMENT_SHALLOW_FILES = b'exp-sqlite-shallow-files'
104 105
105 106 CURRENT_SCHEMA_VERSION = 1
106 107
@@ -1014,6 +1015,8 b' def featuresetup(ui, supported):'
1014 1015
1015 1016 supported.add(REQUIREMENT_ZLIB)
1016 1017 supported.add(REQUIREMENT_NONE)
1018 supported.add(REQUIREMENT_SHALLOW_FILES)
1019 supported.add(repository.NARROW_REQUIREMENT)
1017 1020
1018 1021 def newreporequirements(orig, ui, createopts):
1019 1022 if createopts['backend'] != 'sqlite':
@@ -1030,6 +1033,7 b' def newreporequirements(orig, ui, create'
1030 1033 known = {
1031 1034 'narrowfiles',
1032 1035 'backend',
1036 'shallowfilestore',
1033 1037 }
1034 1038
1035 1039 unsupported = set(createopts) - known
@@ -1061,6 +1065,9 b' def newreporequirements(orig, ui, create'
1061 1065 raise error.Abort(_('unknown compression engine defined in '
1062 1066 'storage.sqlite.compression: %s') % compression)
1063 1067
1068 if createopts.get('shallowfilestore'):
1069 requirements.add(REQUIREMENT_SHALLOW_FILES)
1070
1064 1071 return requirements
1065 1072
1066 1073 @interfaceutil.implementer(repository.ilocalrepositoryfilestorage)
@@ -1082,12 +1089,15 b' class sqlitefilestorage(object):'
1082 1089
1083 1090 return sqlitefilestore(self._dbconn, path, compression)
1084 1091
1085 def makefilestorage(orig, requirements, **kwargs):
1092 def makefilestorage(orig, requirements, features, **kwargs):
1086 1093 """Produce a type conforming to ``ilocalrepositoryfilestorage``."""
1087 1094 if REQUIREMENT in requirements:
1095 if REQUIREMENT_SHALLOW_FILES in requirements:
1096 features.add(repository.REPO_FEATURE_SHALLOW_FILE_STORAGE)
1097
1088 1098 return sqlitefilestorage
1089 1099 else:
1090 return orig(requirements=requirements, **kwargs)
1100 return orig(requirements=requirements, features=features, **kwargs)
1091 1101
1092 1102 def makemain(orig, ui, requirements, **kwargs):
1093 1103 if REQUIREMENT in requirements:
@@ -578,6 +578,9 b' def clone(ui, peeropts, source, dest=Non'
578 578
579 579 createopts['narrowfiles'] = True
580 580
581 if depth:
582 createopts['shallowfilestore'] = True
583
581 584 if srcpeer.capable(b'lfs-serve'):
582 585 # Repository creation honors the config if it disabled the extension, so
583 586 # we can't just announce that lfs will be enabled. This check avoids
@@ -2922,6 +2922,7 b' def filterknowncreateopts(ui, createopts'
2922 2922 'sharedrepo',
2923 2923 'sharedrelative',
2924 2924 'shareditems',
2925 'shallowfilestore',
2925 2926 }
2926 2927
2927 2928 return {k: v for k, v in createopts.items() if k not in known}
@@ -2949,6 +2950,9 b' def createrepository(ui, path, createopt'
2949 2950 is stored as an absolute path.
2950 2951 shareditems
2951 2952 Set of items to share to the new repository (in addition to storage).
2953 shallowfilestore
2954 Indicates that storage for files should be shallow (not all ancestor
2955 revisions are known).
2952 2956 """
2953 2957 createopts = defaultcreateopts(ui, createopts=createopts)
2954 2958
@@ -29,6 +29,8 b" REPO_FEATURE_SHARED_STORAGE = b'sharedst"
29 29 REPO_FEATURE_LFS = b'lfs'
30 30 # Repository supports being stream cloned.
31 31 REPO_FEATURE_STREAM_CLONE = b'streamclone'
32 # Files storage may lack data for all ancestors.
33 REPO_FEATURE_SHALLOW_FILE_STORAGE = b'shallowfilestorage'
32 34
33 35 REVISION_FLAG_CENSORED = 1 << 15
34 36 REVISION_FLAG_ELLIPSIS = 1 << 14
General Comments 0
You need to be logged in to leave comments. Login now