# HG changeset patch # User FUJIWARA Katsunori # Date 1448993528 -32400 # Node ID 6df3ec5bb813f5ec7bb80d2448606a6855c65b9e # Parent 7b4a61570d610dbf062638c6d69df2404acadcbd shelve: widen wlock scope of shelve for consistency while processing Before this patch, "hg shelve" of shelve extension executes/refers below before acquisition of wlock: - 'repo.dirstate.parents()' via 'repo[None].parents()' - 'repo._activebookmark' It may cause unintentional result, if another command runs parallelly (see also issue4368). This patch widens wlock scope of "hg shelve" of shelve extension for consistency while processing. diff -r 7b4a61570d61 -r 6df3ec5bb813 hgext/shelve.py --- a/hgext/shelve.py Wed Dec 02 03:12:08 2015 +0900 +++ b/hgext/shelve.py Wed Dec 02 03:12:08 2015 +0900 @@ -224,7 +224,13 @@ def createcmd(ui, repo, pats, opts): """subcommand that creates a new shelve""" + wlock = repo.wlock() + try: + return _docreatecmd(ui, repo, pats, opts) + finally: + lockmod.release(wlock) +def _docreatecmd(ui, repo, pats, opts): def mutableancestors(ctx): """return all mutable ancestors for ctx (included) @@ -285,9 +291,8 @@ name = opts['name'] - wlock = lock = tr = None + lock = tr = None try: - wlock = repo.wlock() lock = repo.lock() # use an uncommitted transaction to generate the bundle to avoid @@ -346,7 +351,7 @@ _aborttransaction(repo) finally: - lockmod.release(tr, lock, wlock) + lockmod.release(tr, lock) def cleanupcmd(ui, repo): """subcommand that deletes all shelves"""