mercurial/cmdutil.py
changeset 27868 d1a55366d825
parent 27803 a8e8950ebd4d
child 27943 02c5f8ad00ac
--- a/mercurial/cmdutil.py	Fri Jan 15 13:14:50 2016 -0800
+++ b/mercurial/cmdutil.py	Fri Jan 15 13:14:50 2016 -0800
@@ -2512,8 +2512,7 @@
     try:
         wlock = repo.wlock()
         lock = repo.lock()
-        tr = repo.transaction('amend')
-        try:
+        with repo.transaction('amend') as tr:
             # See if we got a message from -m or -l, if not, open the editor
             # with the message of the changeset to amend
             message = logmessage(ui, opts)
@@ -2685,9 +2684,6 @@
                         obs.append((ctx, ()))
 
                     obsolete.createmarkers(repo, obs)
-            tr.close()
-        finally:
-            tr.release()
         if not createmarkers and newid != old.node():
             # Strip the intermediate commit (if there was one) and the amended
             # commit