mercurial/subrepo.py
changeset 21886 b9e8fdc35daf
parent 21885 fe9db58b0b2d
child 21887 9aaffb22d7d7
equal deleted inserted replaced
21885:fe9db58b0b2d 21886:b9e8fdc35daf
   584         Each remote repo requires its own store hash cache, because a subrepo
   584         Each remote repo requires its own store hash cache, because a subrepo
   585         store may be "clean" versus a given remote repo, but not versus another
   585         store may be "clean" versus a given remote repo, but not versus another
   586         '''
   586         '''
   587         cachefile = self._getstorehashcachepath(remotepath)
   587         cachefile = self._getstorehashcachepath(remotepath)
   588         lock = self._repo.lock()
   588         lock = self._repo.lock()
   589         storehash = list(self._calcstorehash(remotepath))
   589         try:
   590         cachedir = os.path.dirname(cachefile)
   590             storehash = list(self._calcstorehash(remotepath))
   591         if not os.path.exists(cachedir):
   591             cachedir = os.path.dirname(cachefile)
   592             util.makedirs(cachedir, notindexed=True)
   592             if not os.path.exists(cachedir):
   593         fd = open(cachefile, 'w')
   593                 util.makedirs(cachedir, notindexed=True)
   594         fd.writelines(storehash)
   594             fd = open(cachefile, 'w')
   595         fd.close()
   595             fd.writelines(storehash)
   596         lock.release()
   596             fd.close()
       
   597         finally:
       
   598             lock.release()
   597 
   599 
   598     @annotatesubrepoerror
   600     @annotatesubrepoerror
   599     def _initrepo(self, parentrepo, source, create):
   601     def _initrepo(self, parentrepo, source, create):
   600         self._repo._subparent = parentrepo
   602         self._repo._subparent = parentrepo
   601         self._repo._subsource = source
   603         self._repo._subsource = source