##// END OF EJS Templates
with: use context manager in unshelveabort
Bryan O'Sullivan -
r27841:83995fdd default
parent child Browse files
Show More
@@ -461,30 +461,27 b' def pathtofiles(repo, files):'
461
461
462 def unshelveabort(ui, repo, state, opts):
462 def unshelveabort(ui, repo, state, opts):
463 """subcommand that abort an in-progress unshelve"""
463 """subcommand that abort an in-progress unshelve"""
464 lock = None
464 with repo.lock():
465 try:
466 checkparents(repo, state)
467
468 util.rename(repo.join('unshelverebasestate'),
469 repo.join('rebasestate'))
470 try:
465 try:
471 rebase.rebase(ui, repo, **{
466 checkparents(repo, state)
472 'abort' : True
473 })
474 except Exception:
475 util.rename(repo.join('rebasestate'),
476 repo.join('unshelverebasestate'))
477 raise
478
467
479 lock = repo.lock()
468 util.rename(repo.join('unshelverebasestate'),
480
469 repo.join('rebasestate'))
481 mergefiles(ui, repo, state.wctx, state.pendingctx)
470 try:
471 rebase.rebase(ui, repo, **{
472 'abort' : True
473 })
474 except Exception:
475 util.rename(repo.join('rebasestate'),
476 repo.join('unshelverebasestate'))
477 raise
482
478
483 repair.strip(ui, repo, state.stripnodes, backup=False, topic='shelve')
479 mergefiles(ui, repo, state.wctx, state.pendingctx)
484 finally:
480 repair.strip(ui, repo, state.stripnodes, backup=False,
485 shelvedstate.clear(repo)
481 topic='shelve')
486 ui.warn(_("unshelve of '%s' aborted\n") % state.name)
482 finally:
487 lockmod.release(lock)
483 shelvedstate.clear(repo)
484 ui.warn(_("unshelve of '%s' aborted\n") % state.name)
488
485
489 def mergefiles(ui, repo, wctx, shelvectx):
486 def mergefiles(ui, repo, wctx, shelvectx):
490 """updates to wctx and merges the changes from shelvectx into the
487 """updates to wctx and merges the changes from shelvectx into the
General Comments 0
You need to be logged in to leave comments. Login now