# HG changeset patch # User Joerg Sonnenberger # Date 1554660016 -7200 # Node ID 6c0992ce05f7bcbd162164c29243d2e4e9f9d864 # Parent d972041022cbd2e2f68133b7285e64f2cbfdca47 compat: drop getcachevfs, repo.cachevfs is supported in hg 4.4 diff -r d972041022cb -r 6c0992ce05f7 hgext3rd/evolve/compat.py --- a/hgext3rd/evolve/compat.py Sun Apr 07 19:53:53 2019 +0200 +++ b/hgext3rd/evolve/compat.py Sun Apr 07 20:00:16 2019 +0200 @@ -19,7 +19,6 @@ scmutil, util, ui as uimod, - vfs as vfsmod, ) from mercurial.hgweb import hgweb_mod @@ -100,13 +99,6 @@ copied=copied.get(path)) return mctx -def getcachevfs(repo): - cachevfs = getattr(repo, 'cachevfs', None) - if cachevfs is None: - cachevfs = vfsmod.vfs(repo.vfs.join('cache')) - cachevfs.createmode = repo.store.createmode - return cachevfs - def strdiff(a, b, fn1, fn2): """ A version of mdiff.unidiff for comparing two strings """ diff -r d972041022cb -r 6c0992ce05f7 hgext3rd/evolve/depthcache.py --- a/hgext3rd/evolve/depthcache.py Sun Apr 07 19:53:53 2019 +0200 +++ b/hgext3rd/evolve/depthcache.py Sun Apr 07 20:00:16 2019 +0200 @@ -178,8 +178,7 @@ """load data from disk""" assert repo.filtername is None - cachevfs = compat.getcachevfs(repo) - data = cachevfs.tryread(self._filepath) + data = repo.cachevfs.tryread(self._filepath) self._data = array.array('l') if not data: self._cachekey = self.emptykey @@ -199,8 +198,7 @@ return try: - cachevfs = compat.getcachevfs(repo) - cachefile = cachevfs(self._filepath, 'w', atomictemp=True) + cachefile = repo.cachevfs(self._filepath, 'w', atomictemp=True) headerdata = self._serializecachekey() cachefile.write(headerdata) cachefile.write(self._data.tostring()) diff -r d972041022cb -r 6c0992ce05f7 hgext3rd/evolve/firstmergecache.py --- a/hgext3rd/evolve/firstmergecache.py Sun Apr 07 19:53:53 2019 +0200 +++ b/hgext3rd/evolve/firstmergecache.py Sun Apr 07 20:00:16 2019 +0200 @@ -115,8 +115,7 @@ """load data from disk""" assert repo.filtername is None - cachevfs = compat.getcachevfs(repo) - data = cachevfs.tryread(self._filepath) + data = repo.cachevfs.tryread(self._filepath) self._data = array.array('l') if not data: self._cachekey = self.emptykey @@ -136,8 +135,7 @@ return try: - cachevfs = compat.getcachevfs(repo) - cachefile = cachevfs(self._filepath, 'w', atomictemp=True) + cachefile = repo.cachevfs(self._filepath, 'w', atomictemp=True) headerdata = self._serializecachekey() cachefile.write(headerdata) cachefile.write(self._data.tostring()) diff -r d972041022cb -r 6c0992ce05f7 hgext3rd/evolve/obscache.py --- a/hgext3rd/evolve/obscache.py Sun Apr 07 19:53:53 2019 +0200 +++ b/hgext3rd/evolve/obscache.py Sun Apr 07 20:00:16 2019 +0200 @@ -20,7 +20,6 @@ ) from . import ( - compat, exthelper, ) @@ -323,7 +322,6 @@ def __init__(self, repo): super(obscache, self).__init__() self._ondiskkey = None - self._vfs = compat.getcachevfs(repo) @util.propertycache def get(self): @@ -405,7 +403,7 @@ return try: - cachefile = self._vfs(self._filepath, 'w', atomictemp=True) + cachefile = repo.cachevfs(self._filepath, 'w', atomictemp=True) headerdata = struct.pack(self._headerformat, *self._cachekey) cachefile.write(headerdata) cachefile.write(self._data) @@ -419,7 +417,7 @@ """load data from disk""" assert repo.filtername is None - data = self._vfs.tryread(self._filepath) + data = repo.cachevfs.tryread(self._filepath) if not data: self._cachekey = self.emptykey self._setdata(bytearray()) diff -r d972041022cb -r 6c0992ce05f7 hgext3rd/evolve/stablesort.py --- a/hgext3rd/evolve/stablesort.py Sun Apr 07 19:53:53 2019 +0200 +++ b/hgext3rd/evolve/stablesort.py Sun Apr 07 20:00:16 2019 +0200 @@ -608,8 +608,7 @@ """ assert repo.filtername is None - cachevfs = compat.getcachevfs(repo) - data = cachevfs.tryread(self._filepath) + data = repo.cachevfs.tryread(self._filepath) self._index = array.array('l') self._data = array.array('l') if not data: @@ -635,8 +634,7 @@ if self._cachekey is None or self._cachekey == self._ondiskkey: return try: - cachevfs = compat.getcachevfs(repo) - cachefile = cachevfs(self._filepath, 'w', atomictemp=True) + cachefile = repo.cachevfs(self._filepath, 'w', atomictemp=True) # data to write headerdata = self._serializecachekey() diff -r d972041022cb -r 6c0992ce05f7 tests/test-share.t --- a/tests/test-share.t Sun Apr 07 19:53:53 2019 +0200 +++ b/tests/test-share.t Sun Apr 07 20:00:16 2019 +0200 @@ -1,5 +1,7 @@ Test that share-clones use the cache in the original repository. + $ . $TESTDIR/testlib/common.sh + $ hg init share-base $ cd share-base/ $ cat >> .hg/hgrc <