mercurial/localrepo.py
changeset 41362 57c462db87fd
parent 41361 092c5d05ba01
child 41363 b87a009d1b3b
--- a/mercurial/localrepo.py	Wed Jan 16 17:46:39 2019 -0800
+++ b/mercurial/localrepo.py	Wed Jan 16 17:33:47 2019 -0800
@@ -2409,7 +2409,7 @@
             match.explicitdir = vdirs.append
             match.bad = fail
 
-        wlock = lock = tr = None
+        wlock = lock = None
         try:
             wlock = self.wlock()
             lock = self.lock() # for recent changelog (see issue4368)
@@ -2473,13 +2473,12 @@
             try:
                 self.hook("precommit", throw=True, parent1=hookp1,
                           parent2=hookp2)
-                tr = self.transaction('commit')
-                ret = self.commitctx(cctx, True)
-                # update bookmarks, dirstate and mergestate
-                bookmarks.update(self, [p1, p2], ret)
-                cctx.markcommitted(ret)
-                ms.reset()
-                tr.close()
+                with self.transaction('commit'):
+                    ret = self.commitctx(cctx, True)
+                    # update bookmarks, dirstate and mergestate
+                    bookmarks.update(self, [p1, p2], ret)
+                    cctx.markcommitted(ret)
+                    ms.reset()
             except: # re-raises
                 if edited:
                     self.ui.write(
@@ -2487,7 +2486,7 @@
                 raise
 
         finally:
-            lockmod.release(tr, lock, wlock)
+            lockmod.release(lock, wlock)
 
         def commithook(node=hex(ret), parent1=hookp1, parent2=hookp2):
             # hack for command that use a temporary commit (eg: histedit)