Code Tools: jcheck

The jcheck extension to Mercurial validates various properties of Mercurial changesets according to local conventions. Among other constraints, it ensures that:

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.

  1. Download the latest version of jcheck.py and save it somewhere convenient. (Alternatively, you can clone the jcheck respository.)

  2. In your ~/.hgrc file, add the following:

    [extensions]
    jcheck = $DIR/jcheck.py

    where $DIR is replaced by the name of the directory where you stored jcheck.py. This will enable the hg jcheck subcommand, which you can use to check specific changesets manually. hg help jcheck will describe the available options.

  3. 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 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 jcheck will reject the synthetic tags created by MQ, preventing qpush, qrefresh and other MQ commands from working. Instead, run jcheck manually after you qfinish your patches.

  4. 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.

Further information