equal
deleted
inserted
replaced
272 return ef |
272 return ef |
273 |
273 |
274 def _plainhybridencode(f): |
274 def _plainhybridencode(f): |
275 return _hybridencode(f, False) |
275 return _hybridencode(f, False) |
276 |
276 |
277 def _calcmode(path): |
277 def _calcmode(vfs): |
278 try: |
278 try: |
279 # files in .hg/ will be created using this mode |
279 # files in .hg/ will be created using this mode |
280 mode = os.stat(path).st_mode |
280 mode = vfs.stat().st_mode |
281 # avoid some useless chmods |
281 # avoid some useless chmods |
282 if (0777 & ~util.umask) == (0777 & mode): |
282 if (0777 & ~util.umask) == (0777 & mode): |
283 mode = None |
283 mode = None |
284 except OSError: |
284 except OSError: |
285 mode = None |
285 mode = None |
291 class basicstore(object): |
291 class basicstore(object): |
292 '''base class for local repository stores''' |
292 '''base class for local repository stores''' |
293 def __init__(self, path, vfstype): |
293 def __init__(self, path, vfstype): |
294 vfs = vfstype(path) |
294 vfs = vfstype(path) |
295 self.path = vfs.base |
295 self.path = vfs.base |
296 self.createmode = _calcmode(path) |
296 self.createmode = _calcmode(vfs) |
297 vfs.createmode = self.createmode |
297 vfs.createmode = self.createmode |
298 self.vfs = scmutil.filtervfs(vfs, encodedir) |
298 self.vfs = scmutil.filtervfs(vfs, encodedir) |
299 self.opener = self.vfs |
299 self.opener = self.vfs |
300 |
300 |
301 def join(self, f): |
301 def join(self, f): |
342 |
342 |
343 class encodedstore(basicstore): |
343 class encodedstore(basicstore): |
344 def __init__(self, path, vfstype): |
344 def __init__(self, path, vfstype): |
345 vfs = vfstype(path + '/store') |
345 vfs = vfstype(path + '/store') |
346 self.path = vfs.base |
346 self.path = vfs.base |
347 self.createmode = _calcmode(self.path) |
347 self.createmode = _calcmode(vfs) |
348 vfs.createmode = self.createmode |
348 vfs.createmode = self.createmode |
349 self.vfs = scmutil.filtervfs(vfs, encodefilename) |
349 self.vfs = scmutil.filtervfs(vfs, encodefilename) |
350 self.opener = self.vfs |
350 self.opener = self.vfs |
351 |
351 |
352 def datafiles(self): |
352 def datafiles(self): |
455 encode = _plainhybridencode |
455 encode = _plainhybridencode |
456 self.encode = encode |
456 self.encode = encode |
457 vfs = vfstype(path + '/store') |
457 vfs = vfstype(path + '/store') |
458 self.path = vfs.base |
458 self.path = vfs.base |
459 self.pathsep = self.path + '/' |
459 self.pathsep = self.path + '/' |
460 self.createmode = _calcmode(self.path) |
460 self.createmode = _calcmode(vfs) |
461 vfs.createmode = self.createmode |
461 vfs.createmode = self.createmode |
462 fnc = fncache(vfs) |
462 fnc = fncache(vfs) |
463 self.fncache = fnc |
463 self.fncache = fnc |
464 self.vfs = _fncachevfs(vfs, fnc, encode) |
464 self.vfs = _fncachevfs(vfs, fnc, encode) |
465 self.opener = self.vfs |
465 self.opener = self.vfs |