compat: in depth cache, only use cachevfs when available
We support older version without the new vfs.
--- a/hgext3rd/evolve/depthcache.py Thu Nov 23 16:53:29 2017 +0100
+++ b/hgext3rd/evolve/depthcache.py Wed Nov 29 12:48:45 2017 -0500
@@ -196,7 +196,10 @@
"""load data from disk"""
assert repo.filtername is None
- data = repo.cachevfs.tryread(self._filepath)
+ if util.safehasattr(repo, 'cachevfs'):
+ data = repo.cachevfs.tryread(self._filepath)
+ else:
+ data = repo.vfs.tryread('cache/' + self._filepath)
self._data = array.array('l')
if not data:
self._cachekey = self.emptykey
@@ -215,7 +218,10 @@
if self._cachekey is None or self._cachekey == self._ondiskkey:
return
- cachefile = repo.cachevfs(self._filepath, 'w', atomictemp=True)
+ if util.safehasattr(repo, 'cachevfs'):
+ cachefile = repo.cachevfs(self._filepath, 'w', atomictemp=True)
+ else:
+ cachefile = repo.vfs('cache/' + self._filepath, 'w', atomictemp=True)
headerdata = self._serializecachekey()
cachefile.write(headerdata)
cachefile.write(self._data.tostring())