##// END OF EJS Templates
localrepo: move new repo requirements into standalone function (API)...
Gregory Szorc -
r28164:ad11edef default
parent child Browse files
Show More
@@ -242,9 +242,6 b' class localrepository(object):'
242 # only functions defined in module of enabled extensions are invoked
242 # only functions defined in module of enabled extensions are invoked
243 featuresetupfuncs = set()
243 featuresetupfuncs = set()
244
244
245 def _baserequirements(self, create):
246 return ['revlogv1']
247
248 def __init__(self, baseui, path=None, create=False):
245 def __init__(self, baseui, path=None, create=False):
249 self.requirements = set()
246 self.requirements = set()
250 self.wvfs = scmutil.vfs(path, expandpath=True, realpath=True)
247 self.wvfs = scmutil.vfs(path, expandpath=True, realpath=True)
@@ -282,28 +279,13 b' class localrepository(object):'
282
279
283 if not self.vfs.isdir():
280 if not self.vfs.isdir():
284 if create:
281 if create:
285 requirements = set(self._baserequirements(create))
282 self.requirements = newreporequirements(self)
286 if self.ui.configbool('format', 'usestore', True):
287 requirements.add("store")
288 if self.ui.configbool('format', 'usefncache', True):
289 requirements.add("fncache")
290 if self.ui.configbool('format', 'dotencode', True):
291 requirements.add('dotencode')
292
293 if scmutil.gdinitconfig(self.ui):
294 requirements.add("generaldelta")
295 if self.ui.configbool('experimental', 'treemanifest', False):
296 requirements.add("treemanifest")
297 if self.ui.configbool('experimental', 'manifestv2', False):
298 requirements.add("manifestv2")
299
300 self.requirements = requirements
301
283
302 if not self.wvfs.exists():
284 if not self.wvfs.exists():
303 self.wvfs.makedirs()
285 self.wvfs.makedirs()
304 self.vfs.makedir(notindexed=True)
286 self.vfs.makedir(notindexed=True)
305
287
306 if 'store' in requirements:
288 if 'store' in self.requirements:
307 self.vfs.mkdir("store")
289 self.vfs.mkdir("store")
308
290
309 # create an invalid changelog
291 # create an invalid changelog
@@ -1969,3 +1951,27 b' def instance(ui, path, create):'
1969
1951
1970 def islocal(path):
1952 def islocal(path):
1971 return True
1953 return True
1954
1955 def newreporequirements(repo):
1956 """Determine the set of requirements for a new local repository.
1957
1958 Extensions can wrap this function to specify custom requirements for
1959 new repositories.
1960 """
1961 ui = repo.ui
1962 requirements = set(['revlogv1'])
1963 if ui.configbool('format', 'usestore', True):
1964 requirements.add('store')
1965 if ui.configbool('format', 'usefncache', True):
1966 requirements.add('fncache')
1967 if ui.configbool('format', 'dotencode', True):
1968 requirements.add('dotencode')
1969
1970 if scmutil.gdinitconfig(ui):
1971 requirements.add('generaldelta')
1972 if ui.configbool('experimental', 'treemanifest', False):
1973 requirements.add('treemanifest')
1974 if ui.configbool('experimental', 'manifestv2', False):
1975 requirements.add('manifestv2')
1976
1977 return requirements
General Comments 0
You need to be logged in to leave comments. Login now