mirror of
https://github.com/facebook/sapling.git
synced 2024-10-10 00:45:18 +03:00
debug: add --wait to debuglock
Summary: We have automation that wants to use this to hold the lock while doing some maintenance. They want the ability to wait for the lock so they don't have to busy loop. Reviewed By: snarkmaster Differential Revision: D24604466 fbshipit-source-id: be02539908655e183f334865718b68b633b069a5
This commit is contained in:
parent
e5e6f53b83
commit
2cf0157824
@ -1678,6 +1678,7 @@ def debuglabelcomplete(ui, repo, *args):
|
||||
("U", "force-undolog-lock", None, _("free the undolog lock " "(DANGEROUS)")),
|
||||
("s", "set-lock", None, _("set the store lock until stopped")),
|
||||
("S", "set-wlock", None, _("set the working state lock until stopped")),
|
||||
("", "wait", None, _("wait for the lock when setting it")),
|
||||
],
|
||||
_("[OPTION]..."),
|
||||
)
|
||||
@ -1726,16 +1727,18 @@ def debuglocks(ui, repo, **opts):
|
||||
if done:
|
||||
return 0
|
||||
|
||||
wait = opts.get(r"wait") or False
|
||||
|
||||
locks = []
|
||||
try:
|
||||
if opts.get(r"set_wlock"):
|
||||
try:
|
||||
locks.append(repo.wlock(False))
|
||||
locks.append(repo.wlock(wait))
|
||||
except error.LockHeld:
|
||||
raise error.Abort(_("wlock is already held"))
|
||||
if opts.get(r"set_lock"):
|
||||
try:
|
||||
locks.append(repo.lock(False))
|
||||
locks.append(repo.lock(wait))
|
||||
except error.LockHeld:
|
||||
raise error.Abort(_("lock is already held"))
|
||||
if len(locks):
|
||||
|
@ -417,7 +417,7 @@ Show all commands + options
|
||||
debuginstall: template
|
||||
debugknown:
|
||||
debuglabelcomplete:
|
||||
debuglocks: force-lock, force-wlock, force-undolog-lock, set-lock, set-wlock
|
||||
debuglocks: force-lock, force-wlock, force-undolog-lock, set-lock, set-wlock, wait
|
||||
debugmakepublic: rev, delete
|
||||
debugmanifestdirs: rev
|
||||
debugmergestate:
|
||||
|
Loading…
Reference in New Issue
Block a user