Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/localrepo.py @ 40788:34f15db81cf0
vfs: extract the audit path logic into a submethod
This will make it possible to apply it in more cases.
author | Boris Feld <boris.feld@octobus.net> |
---|---|
date | Sun, 02 Jul 2017 04:06:24 +0200 |
parents | 41b6245c3fc4 |
children | 875d2af8cb4e |
comparison
equal
deleted
inserted
replaced
40787:9199548525fc | 40788:34f15db81cf0 |
---|---|
1028 if path.startswith(repo.path): | 1028 if path.startswith(repo.path): |
1029 # truncate name relative to the repository (.hg) | 1029 # truncate name relative to the repository (.hg) |
1030 path = path[len(repo.path) + 1:] | 1030 path = path[len(repo.path) + 1:] |
1031 if path.startswith('cache/'): | 1031 if path.startswith('cache/'): |
1032 msg = 'accessing cache with vfs instead of cachevfs: "%s"' | 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 if path.startswith('journal.') or path.startswith('undo.'): | 1034 if path.startswith('journal.') or path.startswith('undo.'): |
1035 # journal is covered by 'lock' | 1035 # journal is covered by 'lock' |
1036 if repo._currentlock(repo._lockref) is None: | 1036 if repo._currentlock(repo._lockref) is None: |
1037 repo.ui.develwarn('write with no lock: "%s"' % path, | 1037 repo.ui.develwarn('write with no lock: "%s"' % path, |
1038 stacklevel=2, config='check-locks') | 1038 stacklevel=3, config='check-locks') |
1039 elif repo._currentlock(repo._wlockref) is None: | 1039 elif repo._currentlock(repo._wlockref) is None: |
1040 # rest of vfs files are covered by 'wlock' | 1040 # rest of vfs files are covered by 'wlock' |
1041 # | 1041 # |
1042 # exclude special files | 1042 # exclude special files |
1043 for prefix in self._wlockfreeprefix: | 1043 for prefix in self._wlockfreeprefix: |
1044 if path.startswith(prefix): | 1044 if path.startswith(prefix): |
1045 return | 1045 return |
1046 repo.ui.develwarn('write with no wlock: "%s"' % path, | 1046 repo.ui.develwarn('write with no wlock: "%s"' % path, |
1047 stacklevel=2, config='check-locks') | 1047 stacklevel=3, config='check-locks') |
1048 return ret | 1048 return ret |
1049 return checkvfs | 1049 return checkvfs |
1050 | 1050 |
1051 def _getsvfsward(self, origfunc): | 1051 def _getsvfsward(self, origfunc): |
1052 """build a ward for self.svfs""" | 1052 """build a ward for self.svfs""" |
1061 if path.startswith(repo.sharedpath): | 1061 if path.startswith(repo.sharedpath): |
1062 # truncate name relative to the repository (.hg) | 1062 # truncate name relative to the repository (.hg) |
1063 path = path[len(repo.sharedpath) + 1:] | 1063 path = path[len(repo.sharedpath) + 1:] |
1064 if repo._currentlock(repo._lockref) is None: | 1064 if repo._currentlock(repo._lockref) is None: |
1065 repo.ui.develwarn('write with no lock: "%s"' % path, | 1065 repo.ui.develwarn('write with no lock: "%s"' % path, |
1066 stacklevel=3) | 1066 stacklevel=4) |
1067 return ret | 1067 return ret |
1068 return checksvfs | 1068 return checksvfs |
1069 | 1069 |
1070 def close(self): | 1070 def close(self): |
1071 self._writecaches() | 1071 self._writecaches() |