hgext/shelve.py
changeset 27838 60b850b7e4ef
parent 27837 496ca4deddc5
child 27841 83995fdde225
--- a/hgext/shelve.py	Fri Jan 15 13:14:47 2016 -0800
+++ b/hgext/shelve.py	Fri Jan 15 13:14:47 2016 -0800
@@ -520,8 +520,7 @@
     """subcommand to continue an in-progress unshelve"""
     # We're finishing off a merge. First parent is our original
     # parent, second is the temporary "fake" commit we're unshelving.
-    lock = None
-    try:
+    with repo.lock():
         checkparents(repo, state)
         ms = merge.mergestate.read(repo)
         if [f for f in ms if ms[f] == 'u']:
@@ -529,8 +528,6 @@
                 _("unresolved conflicts, can't continue"),
                 hint=_("see 'hg resolve', then 'hg unshelve --continue'"))
 
-        lock = repo.lock()
-
         util.rename(repo.join('unshelverebasestate'),
                     repo.join('rebasestate'))
         try:
@@ -556,8 +553,6 @@
         shelvedstate.clear(repo)
         unshelvecleanup(ui, repo, state.name, opts)
         ui.status(_("unshelve of '%s' complete\n") % state.name)
-    finally:
-        lockmod.release(lock)
 
 @command('unshelve',
          [('a', 'abort', None,