fix a deadlock in "hg unhide"

Summary:
The `hg unhide` command acquired the repo lock without acquiring the wlock.
This causes locking order problems, as it calls other parts of the code that
will acquire the `wlock` (such as autopull during revset resolution) while it
is already holding the `lock`.

This can cause `hg unhide` to deadlock with other `hg` commands that acquire
`wlock` before `lock`.

Reviewed By: kulshrax

Differential Revision: D24129559

fbshipit-source-id: cf31ec661123df329f1773d2b67deb474d6476f8
This commit is contained in:
Adam Simpkins 2020-10-05 21:44:48 -07:00 committed by Facebook GitHub Bot
parent e9a5b7e379
commit b2d9183c92

View File

@ -187,7 +187,7 @@ def unhide(ui, repo, *revs, **opts):
commits will also become visible.
"""
revs = list(revs) + opts.pop("rev", [])
with repo.lock():
with repo.wlock(), repo.lock():
revs = set(scmutil.revrange(repo, revs))
_dounhide(repo, revs)