# HG changeset patch # User Pierre-Yves David # Date 1511977725 18000 # Node ID 55e1ad0d71748234fbb382c7f5891e7afb131bf2 # Parent 0d2c095aeb2a76da81449fe615ed4edf1b9c1615 compat: in depth cache, only use cachevfs when available We support older version without the new vfs. diff -r 0d2c095aeb2a -r 55e1ad0d7174 hgext3rd/evolve/depthcache.py --- 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())