# HG changeset patch # User Bryan O'Sullivan # Date 1452892490 28800 # Node ID d1a55366d825aceb661fbc857c5c009b240210d5 # Parent 7ced54ebf97223df2485864eb45db79c88a8fd2f with: use context manager in amend diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py --- a/mercurial/cmdutil.py +++ b/mercurial/cmdutil.py @@ -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