From patchwork Sun Jul 16 08:47:47 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [2,of,8] cachevfs: add a vfs dedicated to cache From: Boris Feld X-Patchwork-Id: 22428 Message-Id: <76e3839204e5bacf6e89.1500194867@FB> To: mercurial-devel@mercurial-scm.org Cc: boris.feld@octobus.net Date: Sun, 16 Jul 2017 10:47:47 +0200 # HG changeset patch # User Boris Feld # Date 1500152704 -7200 # Sat Jul 15 23:05:04 2017 +0200 # Node ID 76e3839204e5bacf6e894a695853a9498ebe22d7 # Parent a73c1ffd2edb211d19242a60027f84cf50d88fa4 # EXP-Topic cachevfs cachevfs: add a vfs dedicated to cache Most of the cache content lives in '.hg/cache/'. Moreover they are computed exclusively from data in the '.hg/store' directory. This creates issues with the share extension as the '.hg/store' directory is shared but the '.hg/cache' is not. On large repositories, this makes this prevent some usage of the share extension inefficient as some caches can take minutes to be recomputed. To improve the situation, we introduce a new 'cachevfs' that will be dedicated to cache reading and writing. In the next patches of this series, we'll migrate the 4 existing caches to it and update the share extension. diff -r a73c1ffd2edb -r 76e3839204e5 mercurial/localrepo.py --- a/mercurial/localrepo.py Sat Jul 15 22:40:51 2017 +0200 +++ b/mercurial/localrepo.py Sat Jul 15 23:05:04 2017 +0200 @@ -423,6 +423,8 @@ self.svfs = self.store.vfs self.sjoin = self.store.join self.vfs.createmode = self.store.createmode + self.cachevfs = vfsmod.vfs(self.vfs.join('cache')) + self.cachevfs.createmode = self.store.createmode if (self.ui.configbool('devel', 'all-warnings') or self.ui.configbool('devel', 'check-locks')): if util.safehasattr(self.svfs, 'vfs'): # this is filtervfs diff -r a73c1ffd2edb -r 76e3839204e5 mercurial/statichttprepo.py --- a/mercurial/statichttprepo.py Sat Jul 15 22:40:51 2017 +0200 +++ b/mercurial/statichttprepo.py Sat Jul 15 23:05:04 2017 +0200 @@ -124,6 +124,7 @@ vfsclass = build_opener(ui, authinfo) self.vfs = vfsclass(self.path) + self.cachevfs = vfsclass(self.vfs.join('cache')) self._phasedefaults = [] self.names = namespaces.namespaces()