commitctx: simplify locking
authorMatt Mackall <mpm@selenic.com>
Thu, 14 May 2009 13:20:40 -0500
changeset 8398 a45eb410e0f2
parent 8397 613ac2856535
child 8399 1c3d5c54cf1c
commitctx: simplify locking (spotted by Simon Heimberg)
mercurial/localrepo.py
--- a/mercurial/localrepo.py	Thu May 14 13:20:40 2009 -0500
+++ b/mercurial/localrepo.py	Thu May 14 13:20:40 2009 -0500
@@ -830,15 +830,13 @@
         Revision information is passed in the context.memctx argument.
         commitctx() does not touch the working directory.
         """
-        wlock = lock = None
+        lock = self.lock()
         try:
-            wlock = self.wlock()
-            lock = self.lock()
             return self._commitctx(ctx, force=True, force_editor=False,
                                    empty_ok=True, use_dirstate=False,
                                    update_dirstate=False)
         finally:
-            release(lock, wlock)
+            lock.release()
 
     def _commitctx(self, wctx, force=False, force_editor=False, empty_ok=False,
                   use_dirstate=True, update_dirstate=True):