Mercurial > hg-stable
changeset 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 | 002108b219e3 |
children | 469b86c49503 |
files | mercurial/subrepo.py |
diffstat | 1 files changed, 1 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- 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