Patchwork [03,of,10] subrepo: add "_cachestorehashvfs" to handle cache store hash files via vfs

login
register
mail settings
Submitter Katsunori FUJIWARA
Date May 28, 2014, 3 p.m.
Message ID <7ece02ee1e7207b7894a.1401289215@juju>
Download mbox | patch
Permalink /patch/4885/
State Superseded
Commit 115af8de76a4942a87071b1a5fe19787e612948a
Headers show

Comments

Katsunori FUJIWARA - May 28, 2014, 3 p.m.
# HG changeset patch
# User FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
# Date 1401288802 -32400
#      Wed May 28 23:53:22 2014 +0900
# Node ID 7ece02ee1e7207b7894a665d0b42f807243a6ba6
# Parent  59f48202458c5236a65631c9a43425e8176245de
subrepo: add "_cachestorehashvfs" to handle cache store hash files via vfs

This patch decorates "_cachestorehashvfs" with "@propertycache" to
delay vfs creation, because it is used only for cooperation with other
repositories.

Using "/" for the relative path to the root of "_cachestorehashvfs"
even on Windows environment is reasonable enough, because "store" and
other management file handling already include such implementation,
and they work well.

Patch

diff --git a/mercurial/subrepo.py b/mercurial/subrepo.py
--- a/mercurial/subrepo.py
+++ b/mercurial/subrepo.py
@@ -556,6 +556,10 @@  class hgsubrepo(abstractsubrepo):
         return self._repo.join(os.path.join(
             'cache', 'storehash', _getstorehashcachename(remotepath)))
 
+    @propertycache
+    def _cachestorehashvfs(self):
+        return scmutil.vfs(self._repo.join('cache/storehash'))
+
     def _readstorehashcache(self, remotepath):
         '''read the store hash cache for a given remote repository'''
         cachefile = self._getstorehashcachepath(remotepath)