Description
The admin trigger create-review
trigger automatically creates a review in Collaborator after the change is committed to the Subversion server. It is smart enough to not create reviews if they have already been created for this code.
Command Line Syntax
ccollab [global-options] admin trigger create-review [--add-on-match <value>] [--review-id-regex <value>] <changelist>
Command Options
Option |
Required? |
Description |
---|---|---|
No |
If a review ID regex matches, add this changelist to the review |
|
No |
Regular Expression that identifies Review ID in commit comment |
|
Yes |
SCM-specific ID of an atomic set of changes |
Installation
For Subversion, to install this trigger you will need to create a post-commit hook. If you already have a post-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\Collaborator Client\ccollab.exe" --url <collabUrl> --user <collabUser> --password <collabPasswd> --scm subversion --svn-user <svnUser> --svn-passwd <svnPasswd> --svn-repo-url svn://url/to/repo --svn-exe "C:\Program Files\Subversion\bin\svn.exe" admin trigger create-review --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-user <svnUser> --svn-passwd <svnPasswd> --svn-repo-url svn://url/to/repo --svn-exe /usr/bin/svn admin trigger create-review --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.
Remarks
- You need to specify the --svn-user and --svn-passwd global options. Also, in order for this hook to work smoothly, you will need your Subversion usernames and Collaborator logins to match (the match is case-insensitive). This ensures that when a developer checks in code, the review is created under his Collaborator account.
If you do not do this, the hook will still work, but reviews will be created under the system administrator's account. Someone will have to log into the system with that account and assign the review to someone else. - If you have an empty password for Collaborator account (which is not recommended), you should pass an empty string as the password global option: --password ""
- You may optionally specify a regular expression that identifies a Collaborator review ID inside a Subversion commit message. If you supply the regular expression, the create-review hook will check for this text in commit messages and automatically not create a new review if a non-canceled review with that ID already exists. This allows some users to do 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.