Mercurial > hg-stable
changeset 27838:60b850b7e4ef
with: use context manager for lock in continue
author | Bryan O'Sullivan <bryano@fb.com> |
---|---|
date | Fri, 15 Jan 2016 13:14:47 -0800 |
parents | 496ca4deddc5 |
children | 7ec3cb246291 |
files | hgext/shelve.py |
diffstat | 1 files changed, 1 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- 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,