changeset 28497:002108b219e3

with: use context manager in largefiles commit
author Bryan O'Sullivan <bryano@fb.com>
date Fri, 15 Jan 2016 13:14:50 -0800
parents 83995fdde225
children b2efdb66c406
files hgext/largefiles/reposetup.py
diffstat 1 files changed, 1 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/largefiles/reposetup.py
+++ b/hgext/largefiles/reposetup.py
@@ -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():