--- a/hgext/shelve.py Fri Jan 15 13:14:47 2016 -0800
+++ b/hgext/shelve.py Fri Jan 15 13:14:50 2016 -0800
@@ -461,30 +461,27 @@
def unshelveabort(ui, repo, state, opts):
"""subcommand that abort an in-progress unshelve"""
- lock = None
- try:
- checkparents(repo, state)
-
- util.rename(repo.join('unshelverebasestate'),
- repo.join('rebasestate'))
+ with repo.lock():
try:
- rebase.rebase(ui, repo, **{
- 'abort' : True
- })
- except Exception:
- util.rename(repo.join('rebasestate'),
- repo.join('unshelverebasestate'))
- raise
+ checkparents(repo, state)
- lock = repo.lock()
-
- mergefiles(ui, repo, state.wctx, state.pendingctx)
+ util.rename(repo.join('unshelverebasestate'),
+ repo.join('rebasestate'))
+ try:
+ rebase.rebase(ui, repo, **{
+ 'abort' : True
+ })
+ except Exception:
+ util.rename(repo.join('rebasestate'),
+ repo.join('unshelverebasestate'))
+ raise
- repair.strip(ui, repo, state.stripnodes, backup=False, topic='shelve')
- finally:
- shelvedstate.clear(repo)
- ui.warn(_("unshelve of '%s' aborted\n") % state.name)
- lockmod.release(lock)
+ mergefiles(ui, repo, state.wctx, state.pendingctx)
+ repair.strip(ui, repo, state.stripnodes, backup=False,
+ topic='shelve')
+ finally:
+ shelvedstate.clear(repo)
+ ui.warn(_("unshelve of '%s' aborted\n") % state.name)
def mergefiles(ui, repo, wctx, shelvectx):
"""updates to wctx and merges the changes from shelvectx into the