lock extension

While Mercurial is all about being decentralized, it is sometimes very useful to work in a centralized fashion: if the files you work on cannot be merged (binary files such as Word documents, Photoshop images, etc) then it is better to communicate upfront about any edits to avoid concurrent work.

Version History

Next Version

• Functionality similar to the SVN locking mechanism is provided. To enable, in an hgrc file, set:

[hglock]
updatewriteperm = True


When a repository is cloned, files marked as needing locking (matched by .hglocks) will be checked out read-only. After a file is locked, the file will be writable. When unlocked (with via hg unlock FILE or hg push), the file will be read-only again.

Thanks to Scott Sturdivant for contributing this feature.

• The update and commit commands use locks implicitly and will now silently ignore a missing or uninitialized lock repository. Before, hg update would abort if the lock repository was not initialized, it now outputs a warnings that is only shown when --verbose is used.

• Refactored code for better maintainability. The remote procedure call protocol now lives in its own module.

0.3 — 2011-08-09

• Client-side checking of pushed changesets. Before pushing, clients now inspects each outgoing changeset to see if it contains modifications to an unlocked file for which locking is mandatory. The push is aborted if such a changeset is found.

• Make hg unlock validate the client's changeset the same way hg lock does. This ensures that a client does not unlock a file before the changesets that modify it have been pushed.

The primary way to unlock files is now to simply push the changesets that affect the files -- the unlock command can only be used if a file has not been modified since it was locked.

• Disabled --force flag for hg push. Creating multiple heads on push is then no longer possible. Pushing a new branch is still possible with the --new-branch flag.

• Fix compatibility with Mercurial 1.9.x. Now tested with Mercurial version 1.8.4, 1.9, and 1.9.1.

0.1 — 2011-07-20

• First tagged release.