Code Tools: jcheck
jcheck extension to Mercurial validates various
properties of Mercurial changesets according to local conventions.
Among other constraints, it ensures that:
- The changeset comment follows the prescribed format;
- The author and reviewer names listed in a changeset are valid OpenJDK usernames;
- Bug ids are not used more than once in a repository;
- Executable files and symbolic links are not checked in;
- Changeset comments and source files do not contain tabs, carriage returns, or trailing spaces; and
- Named branches are not created.
jcheck is installed and enabled on the OpenJDK
Mercurial server for all JDK Release Projects and for some other
Projects as well, at the discretion of the responsible Project
Lead. Projects of a more experimental nature usually don't enable
Projects currently using jcheck
Running jcheck in your own repositories
jcheck is enabled for a Mercurial repository on
the server then it will prevent invalid changesets from being
pushed into that repository. You can avoid nasty surprises by
configuring your local Mercurial command to run jcheck in your own
working repositories so that you never create, pull, or import
Download the latest version of
jcheck.pyand save it somewhere convenient.
~/.hgrcfile, add the following:
[extensions] jcheck = $DIR/jcheck.py
$DIRis replaced by the name of the directory where you stored
jcheck.py. This will enable the
hg jchecksubcommand, which you can use to check specific changesets manually.
hg help jcheckwill describe the available options.
Define the following hooks in your
~/.hgrcfile so that you never create, pull, or import invalid changesets:
[hooks] pretxnchangegroup.jcheck = python:jcheck.hook pretxncommit.jcheck = python:jcheck.hook
The extension only performs its checks if the root of the repository upon which it is invoked contains a directory named
.jcheck, so these hooks will not interfere with Mercurial operations upon OpenJDK repositories that don't use
jcheck, or upon non-JDK repositories.
Note: If you use the Mercurial Queues extension (MQ) then do not enable these hooks. The current version of
jcheckwill reject the synthetic tags created by MQ, preventing
qrefreshand other MQ commands from working. Instead, run
jcheckmanually after you
The extension requires the descriptions of merge changesets to say simply "Merge" rather than, e.g., "Automated merge with file:///u/mr/ws/jdk7/..." because the latter contains potentially-confidential information. If you have enabled the (now deprecated) Mercurial
fetchextension then add the following to your
[defaults] fetch = -m Merge