##// END OF EJS Templates
localrepo: eliminate local requirements var in init...
Drew Gottlieb -
r24918:2eac3ae0 default
parent child Browse files
Show More
@@ -206,6 +206,7 b' class localrepository(object):'
206 return ['revlogv1']
206 return ['revlogv1']
207
207
208 def __init__(self, baseui, path=None, create=False):
208 def __init__(self, baseui, path=None, create=False):
209 self.requirements = set()
209 self.wvfs = scmutil.vfs(path, expandpath=True, realpath=True)
210 self.wvfs = scmutil.vfs(path, expandpath=True, realpath=True)
210 self.wopener = self.wvfs
211 self.wopener = self.wvfs
211 self.root = self.wvfs.base
212 self.root = self.wvfs.base
@@ -242,14 +243,14 b' class localrepository(object):'
242 if not self.wvfs.exists():
243 if not self.wvfs.exists():
243 self.wvfs.makedirs()
244 self.wvfs.makedirs()
244 self.vfs.makedir(notindexed=True)
245 self.vfs.makedir(notindexed=True)
245 requirements = set(self._baserequirements(create))
246 self.requirements.update(self._baserequirements(create))
246 if self.ui.configbool('format', 'usestore', True):
247 if self.ui.configbool('format', 'usestore', True):
247 self.vfs.mkdir("store")
248 self.vfs.mkdir("store")
248 requirements.add("store")
249 self.requirements.add("store")
249 if self.ui.configbool('format', 'usefncache', True):
250 if self.ui.configbool('format', 'usefncache', True):
250 requirements.add("fncache")
251 self.requirements.add("fncache")
251 if self.ui.configbool('format', 'dotencode', True):
252 if self.ui.configbool('format', 'dotencode', True):
252 requirements.add('dotencode')
253 self.requirements.add('dotencode')
253 # create an invalid changelog
254 # create an invalid changelog
254 self.vfs.append(
255 self.vfs.append(
255 "00changelog.i",
256 "00changelog.i",
@@ -257,20 +258,20 b' class localrepository(object):'
257 ' dummy changelog to prevent using the old repo layout'
258 ' dummy changelog to prevent using the old repo layout'
258 )
259 )
259 if self.ui.configbool('format', 'generaldelta', False):
260 if self.ui.configbool('format', 'generaldelta', False):
260 requirements.add("generaldelta")
261 self.requirements.add("generaldelta")
261 if self.ui.configbool('experimental', 'manifestv2', False):
262 if self.ui.configbool('experimental', 'manifestv2', False):
262 requirements.add("manifestv2")
263 self.requirements.add("manifestv2")
263 else:
264 else:
264 raise error.RepoError(_("repository %s not found") % path)
265 raise error.RepoError(_("repository %s not found") % path)
265 elif create:
266 elif create:
266 raise error.RepoError(_("repository %s already exists") % path)
267 raise error.RepoError(_("repository %s already exists") % path)
267 else:
268 else:
268 try:
269 try:
269 requirements = scmutil.readrequires(self.vfs, self.supported)
270 self.requirements = scmutil.readrequires(
271 self.vfs, self.supported)
270 except IOError, inst:
272 except IOError, inst:
271 if inst.errno != errno.ENOENT:
273 if inst.errno != errno.ENOENT:
272 raise
274 raise
273 requirements = set()
274
275
275 self.sharedpath = self.path
276 self.sharedpath = self.path
276 try:
277 try:
@@ -285,13 +286,13 b' class localrepository(object):'
285 if inst.errno != errno.ENOENT:
286 if inst.errno != errno.ENOENT:
286 raise
287 raise
287
288
288 self.store = store.store(requirements, self.sharedpath, scmutil.vfs)
289 self.store = store.store(
290 self.requirements, self.sharedpath, scmutil.vfs)
289 self.spath = self.store.path
291 self.spath = self.store.path
290 self.svfs = self.store.vfs
292 self.svfs = self.store.vfs
291 self.sopener = self.svfs
293 self.sopener = self.svfs
292 self.sjoin = self.store.join
294 self.sjoin = self.store.join
293 self.vfs.createmode = self.store.createmode
295 self.vfs.createmode = self.store.createmode
294 self.requirements = requirements
295 self._applyopenerreqs()
296 self._applyopenerreqs()
296 if create:
297 if create:
297 self._writerequirements()
298 self._writerequirements()
General Comments 0
You need to be logged in to leave comments. Login now