##// END OF EJS Templates
vfs: extract the audit path logic into a submethod...
Boris Feld -
r40785:34f15db8 default
parent child Browse files
Show More
@@ -1030,12 +1030,12 class localrepository(object):
1030 1030 path = path[len(repo.path) + 1:]
1031 1031 if path.startswith('cache/'):
1032 1032 msg = 'accessing cache with vfs instead of cachevfs: "%s"'
1033 repo.ui.develwarn(msg % path, stacklevel=2, config="cache-vfs")
1033 repo.ui.develwarn(msg % path, stacklevel=3, config="cache-vfs")
1034 1034 if path.startswith('journal.') or path.startswith('undo.'):
1035 1035 # journal is covered by 'lock'
1036 1036 if repo._currentlock(repo._lockref) is None:
1037 1037 repo.ui.develwarn('write with no lock: "%s"' % path,
1038 stacklevel=2, config='check-locks')
1038 stacklevel=3, config='check-locks')
1039 1039 elif repo._currentlock(repo._wlockref) is None:
1040 1040 # rest of vfs files are covered by 'wlock'
1041 1041 #
@@ -1044,7 +1044,7 class localrepository(object):
1044 1044 if path.startswith(prefix):
1045 1045 return
1046 1046 repo.ui.develwarn('write with no wlock: "%s"' % path,
1047 stacklevel=2, config='check-locks')
1047 stacklevel=3, config='check-locks')
1048 1048 return ret
1049 1049 return checkvfs
1050 1050
@@ -1063,7 +1063,7 class localrepository(object):
1063 1063 path = path[len(repo.sharedpath) + 1:]
1064 1064 if repo._currentlock(repo._lockref) is None:
1065 1065 repo.ui.develwarn('write with no lock: "%s"' % path,
1066 stacklevel=3)
1066 stacklevel=4)
1067 1067 return ret
1068 1068 return checksvfs
1069 1069
@@ -337,6 +337,13 class vfs(abstractvfs):
337 337 return
338 338 os.chmod(name, self.createmode & 0o666)
339 339
340 def _auditpath(self, path, mode):
341 if self._audit:
342 r = util.checkosfilename(path)
343 if r:
344 raise error.Abort("%s: %r" % (r, path))
345 self.audit(path, mode=mode)
346
340 347 def __call__(self, path, mode="r", atomictemp=False, notindexed=False,
341 348 backgroundclose=False, checkambig=False, auditpath=True):
342 349 '''Open ``path`` file, which is relative to vfs root.
@@ -369,11 +376,7 class vfs(abstractvfs):
369 376 cases (see also issue5418 and issue5584 for detail).
370 377 '''
371 378 if auditpath:
372 if self._audit:
373 r = util.checkosfilename(path)
374 if r:
375 raise error.Abort("%s: %r" % (r, path))
376 self.audit(path, mode=mode)
379 self._auditpath(path, mode)
377 380 f = self.join(path)
378 381
379 382 if "b" not in mode:
General Comments 0
You need to be logged in to leave comments. Login now