[PATCH 2 of 5 V2] shelve: remove redundant acquisition of wlock for sub commands of unshelve
FUJIWARA Katsunori
foozy at lares.dti.ne.jp
Tue Dec 8 18:21:21 CST 2015
# HG changeset patch
# User FUJIWARA Katsunori <foozy at lares.dti.ne.jp>
# Date 1449617333 -32400
# Wed Dec 09 08:28:53 2015 +0900
# Node ID c1169e12a94ecd82cdc43812ca569f88a8399038
# Parent 140d5ad6d256d355524d532a514a5432d8b29c2a
shelve: remove redundant acquisition of wlock for sub commands of unshelve
Previous patch ensures that wlock is acquired before processing for
"hg unshelve". It makes acquisition of wlock in each functions below
redundant.
- unshelveabort() for "unshelve --abort"
- unshelvecontinue() for "unshelve --continue"
diff --git a/hgext/shelve.py b/hgext/shelve.py
--- a/hgext/shelve.py
+++ b/hgext/shelve.py
@@ -473,7 +473,6 @@ def pathtofiles(repo, files):
def unshelveabort(ui, repo, state, opts):
"""subcommand that abort an in-progress unshelve"""
- wlock = repo.wlock()
lock = None
try:
checkparents(repo, state)
@@ -497,7 +496,7 @@ def unshelveabort(ui, repo, state, opts)
finally:
shelvedstate.clear(repo)
ui.warn(_("unshelve of '%s' aborted\n") % state.name)
- lockmod.release(lock, wlock)
+ lockmod.release(lock)
def mergefiles(ui, repo, wctx, shelvectx):
"""updates to wctx and merges the changes from shelvectx into the
@@ -533,7 +532,6 @@ def unshelvecontinue(ui, repo, state, op
"""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.
- wlock = repo.wlock()
lock = None
try:
checkparents(repo, state)
@@ -571,7 +569,7 @@ def unshelvecontinue(ui, repo, state, op
unshelvecleanup(ui, repo, state.name, opts)
ui.status(_("unshelve of '%s' complete\n") % state.name)
finally:
- lockmod.release(lock, wlock)
+ lockmod.release(lock)
@command('unshelve',
[('a', 'abort', None,
More information about the Mercurial-devel
mailing list