subrepo: add "_cachestorehashvfs" to handle cache store hash files via vfs
authorFUJIWARA Katsunori <foozy@lares.dti.ne.jp>
Wed, 19 Nov 2014 18:35:14 +0900
changeset 23367 115af8de76a4
parent 23366 568ae89797c6
child 23368 bf8c3172255c
subrepo: add "_cachestorehashvfs" to handle cache store hash files via vfs This "vfs" object will be used by subsequent patches to handle cache store hash files without direct file APIs. This patch decorates "_cachestorehashvfs" with "@propertycache" to delay vfs creation, because it is used only for cooperation with other repositories. In this patch, "/" is used as the path separator, even though "self._repo.join" uses platform specific path separator (e.g. "\\" on Windows). But it is reasonable enough, because "store" and other management file handling already include such implementation, and they work well.
mercurial/subrepo.py
--- a/mercurial/subrepo.py	Wed Nov 19 18:35:14 2014 +0900
+++ b/mercurial/subrepo.py	Wed Nov 19 18:35:14 2014 +0900
@@ -566,6 +566,10 @@
         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)