Mercurial > hg-stable
changeset 23372:6cfa7a73b6e7
subrepo: replace direct file APIs around "writelines" by "vfs.writelines"
This patch also replaces "self._getstorehashcachepath" (building
absolute path up) by "self._getstorehashcachename" (building relative
path up), because "vfs.writelines" requires relative path.
author | FUJIWARA Katsunori <foozy@lares.dti.ne.jp> |
---|---|
date | Wed, 19 Nov 2014 18:35:14 +0900 |
parents | 1df6519eb3ab |
children | 99a886418000 |
files | mercurial/subrepo.py |
diffstat | 1 files changed, 3 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/subrepo.py Wed Nov 19 18:35:14 2014 +0900 +++ b/mercurial/subrepo.py Wed Nov 19 18:35:14 2014 +0900 @@ -581,18 +581,12 @@ Each remote repo requires its own store hash cache, because a subrepo store may be "clean" versus a given remote repo, but not versus another ''' - cachefile = self._getstorehashcachepath(remotepath) + cachefile = _getstorehashcachename(remotepath) lock = self._repo.lock() try: storehash = list(self._calcstorehash(remotepath)) - cachedir = os.path.dirname(cachefile) - if not os.path.exists(cachedir): - util.makedirs(cachedir, notindexed=True) - fd = open(cachefile, 'w') - try: - fd.writelines(storehash) - finally: - fd.close() + vfs = self._cachestorehashvfs + vfs.writelines(cachefile, storehash, mode='w', notindexed=True) finally: lock.release()