Mercurial > hg
changeset 27868:d1a55366d825
with: use context manager in amend
author | Bryan O'Sullivan <bryano@fb.com> |
---|---|
date | Fri, 15 Jan 2016 13:14:50 -0800 |
parents | 7ced54ebf972 |
children | 76ecf0227ea5 |
files | mercurial/cmdutil.py |
diffstat | 1 files changed, 1 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- 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