This page is primarily intended for Mercurial's developers. How
locking works in Mercurial. There are two locks in Mercurial,
known as "lock" (for repository data) and "wlock" (for working
directory data). Generally speaking, locks are only taken by
writers and there is no limit on the number of simultaneous
readers. Consistency for readers is managed using atomic
operations (like rename) and careful ordering of data
visibility. 2. Lock files Lock files are implemented as symlinks
where possible. This allows locks to be created and information
about their owner stored in a single operation. 3. The
repository lock The repository lock lives in .hg/store/lock and
covers all data in store/. Writes to the repository are ordered
as follows: - write to file revlogs (data, then index) - write
to manifest revlogs (data, then index) - write to changelog data
- write to temporary changelog index - atomic rename of
changelog index Thus, if a reader starts at the changelog index
and works down the tree in the opposite ord