This file outlines the policy on reviews for the Mercury system.

Reviewable material

All changes to the Mercury repository, including the compiler, documentation, www pages, library predicates, runtime system, and tools need to be reviewed.

Review process

  1. Make sure you are working with an up-to-date workspace.
  2. If the change is a code change, test the change. See "Testing" section of coding standards. Testing may take time - don't forget that steps 3, 4 and 5 can be done in parallel.
  3. Write a log message for this change - use a template (see below). How you include this will depend on the next step.
  4. Create a diff: create one or more commits and mail them to us using either git diff or by creating series of commits and using git format-patch (see the git documentation for details). You will need to edit the files that format-patch generates to modify the subject line (see below), and to duplicate this line within the e-mail's body. If you create a diff, then new files should be appended verbatim to the end of the diff, with descriptions indicating the name of the file. XXX why not git add -N?
  5. Review the diff and log message yourself. (see below)
  6. E-mail the changes to us at Mercury Reviews <> The subject should be "for review: <short description of change>", the short description is typically the first line of your git log message. Optionally nominate a reviewer at top of diff (see below). Optionally describe which branches your change should be applied to. (If this change has been reviewed once before, it might fall into the "commit before review" category -- see the section on exceptions). If you generated your diffs using git format-patch then you can use git send-email to mail them, or attach them to an e-mail normally. It is also possible to use github pull-requests, however we prefer e-mail.
  7. Wait for review (see below).
  8. Fix any changes suggested.
  9. Repeat the above steps until approval.
  10. Push the change(s) (see below) if you have repository permissions. If you do not, the developer who reviewed your change will help you with this.

Log Messages

Use this template for each change's log message.
<one-line description (subject)>

<overview or general description of changes>

    <detailed description of changes>

The description should state why the changes were made, not just what the changes were. All file modifications related to the same change should be committed together.

For very small changes, the <overview or general description> can be omitted, but the other descriptions should stay.

If adding a new feature, this is a good place to describe the feature, how it works, how to turn it on and off, and any present limitations of the feature (note that all this should also be documented within the change, as well). If fixing a bug, describe both the bug and the fix. If the bug is in a bug tracker, also include the bug's number for reference.


You should also review your own code first, and fix any obvious mistakes. if there was something you had to understand when making the change, and it was not documented before, then document it as part of the change. This makes it easier to review the change, and should make future similar changes easier as well.


We post all diffs to

The reasons for posting to reviews are:

You should try to match the reviewer to the code - someone familiar with a section of code can review faster and is more likely to catch errors. Put a preamble at the start of your diff to nominate who you would like to review the diff.

Waiting and approval

Waiting for approval need not be wasted time. This is a good time to start working on something else, clean up unused workspaces, etc. In particular, you might want to run long running tests that have not yet been run on the your change (different grades, different architectures, different optimisation levels, and so on).

The reviewer(s) should reply, indicate any problems that need to be corrected, and whether the change can be committed yet. Design issues may need to be fully justified before you commit. You may need to fix the problems, then go through another iteration of the review process, or you may be able to just fix a few small problems, then commit.

Pushing changes

Use the log message you prepared for the review when committing and pushing changes, updated as necessary to reflect the changes you made as a result of the review.

Exceptions: Push before review

The only time changes should be pushed before being reviewed is when they satisfy all of the following conditions:

If the compiler is already broken (i.e. it doesn't pass its nightly tests), and your change is a bug fix, then it is not so important to be absolutely sure that your change won't introduce bugs. You should still be careful, though. Make sure you review the diffs yourself.

Similarly, if the code you are modifying is a presently unused part of code - for example a new feature that nobody else is using yet, that is switchable and is switched off by default, or a new tool, or an `under development' webpage that is not linked to by other webpages yet, the criteria are a bit looser. Don't use this one too often - only for small changes. You don't want to go a long way down the wrong track with your new feature, before finding that there is a much better way.

If these conditions are satisfied, then there shouldn't be any problem with mailing the diff, then committing, then fixing any problems that come up afterwards, provided you are pretty sure everything will be okay. This is particularly true if others are waiting for your work.

Usually, a change that has already been reviewed falls into this category, provided you have addressed the reviewers comments, and there are no disputes over design decisions. If the reviewer has specifically asked for another review, or there were a large number of comments at the review, you should not commit before a second review.

If you are going to commit before the review, use the subject line:
"diff: <short description of change>".

Exceptions: No review

The only time changes should be committed without review by a second person is when they satisfy all of the following conditions:

If your change falls into this category, you should still send the diff and log message to the reviews mailing list, but use the subject line: "trivial diff: <short description of change>".