diff -r 002108b219e3 -r b2efdb66c406 mercurial/subrepo.py --- a/mercurial/subrepo.py Fri Jan 15 13:14:50 2016 -0800 +++ b/mercurial/subrepo.py Fri Jan 15 13:14:50 2016 -0800 @@ -679,13 +679,10 @@ store may be "clean" versus a given remote repo, but not versus another ''' cachefile = _getstorehashcachename(remotepath) - lock = self._repo.lock() - try: + with self._repo.lock(): storehash = list(self._calcstorehash(remotepath)) vfs = self._cachestorehashvfs vfs.writelines(cachefile, storehash, mode='w', notindexed=True) - finally: - lock.release() def _getctx(self): '''fetch the context for this subrepo revision, possibly a workingctx