Mercurial > evolve
changeset 3242:55e1ad0d7174
compat: in depth cache, only use cachevfs when available
We support older version without the new vfs.
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Wed, 29 Nov 2017 12:48:45 -0500 |
parents | 0d2c095aeb2a |
children | 556316fe4b4f |
files | hgext3rd/evolve/depthcache.py |
diffstat | 1 files changed, 8 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- 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())