comparison mercurial/subrepo.py @ 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 22e00674d17e
children 99a886418000
comparison
equal deleted inserted replaced
23371:1df6519eb3ab 23372:6cfa7a73b6e7
579 '''cache the current store hash 579 '''cache the current store hash
580 580
581 Each remote repo requires its own store hash cache, because a subrepo 581 Each remote repo requires its own store hash cache, because a subrepo
582 store may be "clean" versus a given remote repo, but not versus another 582 store may be "clean" versus a given remote repo, but not versus another
583 ''' 583 '''
584 cachefile = self._getstorehashcachepath(remotepath) 584 cachefile = _getstorehashcachename(remotepath)
585 lock = self._repo.lock() 585 lock = self._repo.lock()
586 try: 586 try:
587 storehash = list(self._calcstorehash(remotepath)) 587 storehash = list(self._calcstorehash(remotepath))
588 cachedir = os.path.dirname(cachefile) 588 vfs = self._cachestorehashvfs
589 if not os.path.exists(cachedir): 589 vfs.writelines(cachefile, storehash, mode='w', notindexed=True)
590 util.makedirs(cachedir, notindexed=True)
591 fd = open(cachefile, 'w')
592 try:
593 fd.writelines(storehash)
594 finally:
595 fd.close()
596 finally: 590 finally:
597 lock.release() 591 lock.release()
598 592
599 @annotatesubrepoerror 593 @annotatesubrepoerror
600 def _initrepo(self, parentrepo, source, create): 594 def _initrepo(self, parentrepo, source, create):