ccollab admin trigger ensure-review-started

Top  Previous  Next

Usage: ccollab [global-options] admin trigger ensure-review-started [--ignore-integrate --review-id-regex <value>] <changelist-id>

 

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

 

Command Options

Option

Required?

Description

--ignore-integrate

N

Allow integration changes to proceed without review

--review-id-regex <value>

N

Regular Expression that identifies Review ID in commit comment

<changelist-id>

Y

Changelist ID

 

(See Version Control specific description - Perforce Subversion )

 

This trigger ensures that a Review has been started before changes can be committed to version control.

If a Review has not been started, the commit will fail and the user will get an error message explaining that the changes need to be reviewed before commit.

 

For Perforce, to install this trigger edit your Perforce Triggers list (see Perforce manual for details) and add a line like the following (except supply your installation directory for the ccollab application, replace <values> as appropriate, and put everything on one line even though the following text is word-wrapping):

 

ccollab submit //depot/... "/usr/bin/ccollab --url <collabUrl> --user <collabUser> --password <collabPasswd> --scm perforce --p4port <p4port> --p4user <p4user> --p4passwd <p4passwd> admin trigger ensure-review-started %changelist%"

 

On Unix systems the Perforce trigger system incorrectly splits up arguments by whitespace ignoring single quotes and other standard ways of indicating that data with spaces is actually a single argument. The solution is to use a separate bash script to call our trigger application.

 

For Subversion, to install this trigger you will need to create a pre-commit hook. If you already have a pre-commit hook, you can add our tool wherever it is appropriate; otherwise you will need to create an executable hook as described in the Subversion documentation (typically a batch file under Windows or a shell script under Linux/Mac).

 

Example Windows batch file:

"C:\Program Files\Code Collaborator Client\ccollab.exe" --url <collabUrl> --user <collabUser> --password <collabPasswd> --scm subversion --svn-repo-path %1 --svn-look-exe "C:\Program Files\Subversion\bin\svnlook.exe" admin trigger ensure-review-started --review-id-regex "review:\s+(\d+)" %2 || exit 1

 

Example Linux/OSX shell script:

/collab/install/ccollab --url <collabUrl> --user <collabUser> --password <collabPasswd> --scm subversion --svn-repo-path %1 --svn-look-exe /usr/bin/svnlook admin trigger ensure-review-started --review-id-regex "review:\s+(\d+)" $2 || exit 1

 

Note our use of "exit 1" to ensure that the script terminates with a non-zero exit code if our trigger application fails.

 

For Perforce, you must supply credentials for a Perforce user that has at least read-only access.

 

For Perforce, changelists that result from creating a new branch are ignored. Creating a new branch does not involve a code change, so it does not require review.

 

For Perforce, integrating changes from one branch into another branch does make code changes and can introduce bugs, so by default this type of change is handled by the trigger. However, because integration changes frequently involve a very large number of files and because often it is necessary to integrate changes to many branches, this would require cumbersome reviews to be performed many times.

For this reason, the '--ignore-integrate' option can be used to ignore changelists consisting of only integration changes. In this case, enforcement of code review happens externally to the system: for example, a review could be performed on one branch, but other branches could be just directly integrated.

 

For Subversion, you must specify the --svn-repo-path and --svn-look-exe global options.

 

For Subversion, you must require developers to put the review ID somewhere in the Subversion commit message. The format of this text is completely up to you; you must supply a Java-style regular expression that identifies this text and specifically calls out the review ID inside that text using the --review-id-regex command option.