comparison mercurial/subrepo.py @ 27843:b2efdb66c406

with: use context manager in subrepo _cachestorehash
author Bryan O'Sullivan <bryano@fb.com>
date Fri, 15 Jan 2016 13:14:50 -0800
parents 07fc2f2134ba
children 469b86c49503
comparison
equal deleted inserted replaced
27842:002108b219e3 27843:b2efdb66c406
677 677
678 Each remote repo requires its own store hash cache, because a subrepo 678 Each remote repo requires its own store hash cache, because a subrepo
679 store may be "clean" versus a given remote repo, but not versus another 679 store may be "clean" versus a given remote repo, but not versus another
680 ''' 680 '''
681 cachefile = _getstorehashcachename(remotepath) 681 cachefile = _getstorehashcachename(remotepath)
682 lock = self._repo.lock() 682 with self._repo.lock():
683 try:
684 storehash = list(self._calcstorehash(remotepath)) 683 storehash = list(self._calcstorehash(remotepath))
685 vfs = self._cachestorehashvfs 684 vfs = self._cachestorehashvfs
686 vfs.writelines(cachefile, storehash, mode='w', notindexed=True) 685 vfs.writelines(cachefile, storehash, mode='w', notindexed=True)
687 finally:
688 lock.release()
689 686
690 def _getctx(self): 687 def _getctx(self):
691 '''fetch the context for this subrepo revision, possibly a workingctx 688 '''fetch the context for this subrepo revision, possibly a workingctx
692 ''' 689 '''
693 if self._ctx.rev() is None: 690 if self._ctx.rev() is None: