with: use context manager in largefiles commit
authorBryan O'Sullivan <bryano@fb.com>
Fri, 15 Jan 2016 13:14:50 -0800
changeset 27842 002108b219e3
parent 27841 83995fdde225
child 27843 b2efdb66c406
with: use context manager in largefiles commit
hgext/largefiles/reposetup.py
--- a/hgext/largefiles/reposetup.py	Fri Jan 15 13:14:50 2016 -0800
+++ b/hgext/largefiles/reposetup.py	Fri Jan 15 13:14:50 2016 -0800
@@ -263,15 +263,12 @@
                 force=False, editor=False, extra={}):
             orig = super(lfilesrepo, self).commit
 
-            wlock = self.wlock()
-            try:
+            with self.wlock():
                 lfcommithook = self._lfcommithooks[-1]
                 match = lfcommithook(self, match)
                 result = orig(text=text, user=user, date=date, match=match,
                                 force=force, editor=editor, extra=extra)
                 return result
-            finally:
-                wlock.release()
 
         def push(self, remote, force=False, revs=None, newbranch=False):
             if remote.local():