Code Tools: jcheck
The 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
jcheck
.
Projects currently using jcheck
Running jcheck in your own repositories
If 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
invalid changesets.
-
Download the latest version of
jcheck.py
and save it somewhere convenient. (Alternatively, you can clone the jcheck respository.) -
In your
~/.hgrc
file, add the following:[extensions] jcheck = $DIR/jcheck.py
where
$DIR
is replaced by the name of the directory where you storedjcheck.py
. This will enable thehg jcheck
subcommand, which you can use to check specific changesets manually.hg help jcheck
will describe the available options. -
Define the following hooks in your
~/.hgrc
file 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 usejcheck
, or upon non-JDK repositories.Note: If you use the Mercurial Queues extension (MQ) then do not enable these hooks. The current version of
jcheck
will reject the synthetic tags created by MQ, preventingqpush
,qrefresh
and other MQ commands from working. Instead, runjcheck
manually after youqfinish
your patches. -
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
fetch
extension then add the following to your~/.hgrc
:[defaults] fetch = -m Merge
Updates to jcheck
Major updates to jcheck
will be announced on the
general
announcement list. Minor updates will be noted in the commit
messages sent to the Mercurial
tools mailing list.