with: use context manager in subrepo storeclean
authorBryan O'Sullivan <bryano@fb.com>
Fri, 15 Jan 2016 13:14:50 -0800
changeset 27844 469b86c49503
parent 27843 b2efdb66c406
child 27845 7417e1c10253
with: use context manager in subrepo storeclean
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
@@ -631,11 +631,8 @@
         self._initrepo(r, state[0], create)
 
     def storeclean(self, path):
-        lock = self._repo.lock()
-        try:
+        with self._repo.lock():
             return self._storeclean(path)
-        finally:
-            lock.release()
 
     def _storeclean(self, path):
         clean = True