comparison mercurial/cmdutil.py @ 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 a8e8950ebd4d
children 02c5f8ad00ac
comparison
equal deleted inserted replaced
27867:7ced54ebf972 27868:d1a55366d825
2510 2510
2511 wlock = lock = newid = None 2511 wlock = lock = newid = None
2512 try: 2512 try:
2513 wlock = repo.wlock() 2513 wlock = repo.wlock()
2514 lock = repo.lock() 2514 lock = repo.lock()
2515 tr = repo.transaction('amend') 2515 with repo.transaction('amend') as tr:
2516 try:
2517 # See if we got a message from -m or -l, if not, open the editor 2516 # See if we got a message from -m or -l, if not, open the editor
2518 # with the message of the changeset to amend 2517 # with the message of the changeset to amend
2519 message = logmessage(ui, opts) 2518 message = logmessage(ui, opts)
2520 # ensure logfile does not conflict with later enforcement of the 2519 # ensure logfile does not conflict with later enforcement of the
2521 # message. potential logfile content has been processed by 2520 # message. potential logfile content has been processed by
2683 obs = [(old, (new,))] 2682 obs = [(old, (new,))]
2684 if node: 2683 if node:
2685 obs.append((ctx, ())) 2684 obs.append((ctx, ()))
2686 2685
2687 obsolete.createmarkers(repo, obs) 2686 obsolete.createmarkers(repo, obs)
2688 tr.close()
2689 finally:
2690 tr.release()
2691 if not createmarkers and newid != old.node(): 2687 if not createmarkers and newid != old.node():
2692 # Strip the intermediate commit (if there was one) and the amended 2688 # Strip the intermediate commit (if there was one) and the amended
2693 # commit 2689 # commit
2694 if node: 2690 if node:
2695 ui.note(_('stripping intermediate changeset %s\n') % ctx) 2691 ui.note(_('stripping intermediate changeset %s\n') % ctx)