clindex: use str as input to vfs

Reviewed By: farnz

Differential Revision: D19624129

fbshipit-source-id: cbee989334d5cf114ef7b74c9143a992cee70370
This commit is contained in:
Xavier Deguillard 2020-01-29 11:05:00 -08:00 committed by Facebook Github Bot
parent 776f0fabac
commit 20459835bb
2 changed files with 4 additions and 3 deletions

View File

@ -396,6 +396,7 @@ class vfs(abstractvfs):
cases (see also issue5418 and issue5584 for detail).
"""
assert isinstance(path, str)
assert isinstance(mode, str)
if auditpath:
if self._audit:
r = util.checkosfilename(path)

View File

@ -173,7 +173,7 @@ cdef class nodemap(object):
self._overrides = {}
self._vfs = vfs
try:
index = util.buffer(util.mmapread(vfs(b'nodemap', b'rb')))
index = util.buffer(util.mmapread(vfs('nodemap', 'rb')))
if len(index) < len(self.emptyindex):
index = self.emptyindex
except IOError as ex:
@ -205,7 +205,7 @@ cdef class nodemap(object):
if lag == 0 or lag < self._config.lagthreshold:
return
_log(self._vfs, b'nodemap: updating (lag=%s)' % lag)
with self._vfs(b'nodemap', b'w', atomictemp=True) as f:
with self._vfs('nodemap', 'w', atomictemp=True) as f:
f.write(self._rustnodemap.build())
self._updated = True
@ -397,7 +397,7 @@ def _log(vfs, message):
if _logpath:
f = open(_logpath, b'ab')
else:
f = vfs(b'clindex.log', b'ab')
f = vfs('clindex.log', 'ab')
with f:
timestamp = datetime.datetime.now().strftime(b'%Y-%m-%d %H:%M:%S.%f')
pid = os.getpid()