Subversion Server Hooks

Top  Previous  Next

Triggers recommended for Subversion

ccollab admin trigger ensure-review-started - Changelist cannot be submitted until review of this changelist exists

ccollab admin trigger ensure-reviewed - Changelist cannot be submitted until review of this changelist has been completed

ccollab admin trigger create-review - Creates a new Review for a changelist if no Review already exists

 

The ensure-review-started and ensure-reviewed hooks ensure that files cannot be committed unless certain conditions are met.  If a user attempts to commit a files that doesn't meet those conditions, an error message describing the unfulfilled conditions will be displayed and the files will not be committed.  If the conditions are met, the commit will be allowed to continue normally.
The create-review hook automatically creates a review in Code Collaborator after the revision is committed to the Subversion server. Because you can supply the regular expression for identifying reviews, you can provide users with the ability to review before check-in without having an additional review automatically created after the check-in.  This way some groups (or just some check-ins arbitrarily) can use pre-commit review and others post-commit, and either way you know all code has been reviewed or at least that a review of all code exists in the system.
Linking reviews with commits

To use the ensure-review-started and ensure-reviewed hooks, you must first require developers to put the review ID somewhere in the Subversion commit message (also optionally for the create-review hook).  The format of this text is completely up to you; you will need to supply a Java-style regular expression that identifies this text and specifically calls out the review ID inside that text.  The regular expression is specified using the --review-id-regex hook command option.

Here are some common ways of specifying the review ID and the corresponding regular expressions.  Note that regular expressions are case-insensitive and you must identify the review ID portion with parenthesis:

Text

--review-id-regex

Review: 4233

review:\s*(\d+)

rID4233

rid(\d+)

(review 4233)

\(review (\d+)\)

 

This text can appear in-line with other text or in a more formal "form-style" layout.  Because you control the regular expression, you can control exactly what this looks like.

For more information about Subversion hooks in general, see the Subversion documentation.