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