Mercurial > hg
comparison mercurial/subrepo.py @ 23367:115af8de76a4
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.
author | FUJIWARA Katsunori <foozy@lares.dti.ne.jp> |
---|---|
date | Wed, 19 Nov 2014 18:35:14 +0900 |
parents | 568ae89797c6 |
children | 22e00674d17e |
comparison
equal
deleted
inserted
replaced
23366:568ae89797c6 | 23367:115af8de76a4 |
---|---|
564 def _getstorehashcachepath(self, remotepath): | 564 def _getstorehashcachepath(self, remotepath): |
565 '''get a unique path for the store hash cache''' | 565 '''get a unique path for the store hash cache''' |
566 return self._repo.join(os.path.join( | 566 return self._repo.join(os.path.join( |
567 'cache', 'storehash', _getstorehashcachename(remotepath))) | 567 'cache', 'storehash', _getstorehashcachename(remotepath))) |
568 | 568 |
569 @propertycache | |
570 def _cachestorehashvfs(self): | |
571 return scmutil.vfs(self._repo.join('cache/storehash')) | |
572 | |
569 def _readstorehashcache(self, remotepath): | 573 def _readstorehashcache(self, remotepath): |
570 '''read the store hash cache for a given remote repository''' | 574 '''read the store hash cache for a given remote repository''' |
571 cachefile = self._getstorehashcachepath(remotepath) | 575 cachefile = self._getstorehashcachepath(remotepath) |
572 if not os.path.exists(cachefile): | 576 if not os.path.exists(cachefile): |
573 return '' | 577 return '' |