Reviews

Review enforcement

Swarm can optionally enforce that a change to be submitted is tied to an approved code review. Additionally, Swarm can require that the content of a change to be submitted matches the content of its associated approved code review.

Important

These capabilities are currently not available for a Helix Versioning Engine running on a Windows host.

These capabilities are provided via the trigger script included with Swarm, but are not enabled by default nor covered in the standard installation steps.

To enable these capabilities, edit the Perforce trigger table by running the p4 triggers command as a user with super-level privileges and add the following lines:

swarm.enforce.1 change-submit  //DEPOT_PATH1/... "%//.swarm/triggers/swarm-trigger.pl% -c %//.swarm/triggers/swarm-trigger.conf% -t enforce -v %change% -p %serverport%"
swarm.enforce.2 change-submit  //DEPOT_PATH2/... "%//.swarm/triggers/swarm-trigger.pl% -c %//.swarm/triggers/swarm-trigger.conf% -t enforce -v %change% -p %serverport%"
swarm.strict.1  change-content //DEPOT_PATH1/... "%//.swarm/triggers/swarm-trigger.pl% -c %//.swarm/triggers/swarm-trigger.conf% -t strict -v %change% -p %serverport%"
swarm.strict.2  change-content //DEPOT_PATH2/... "%//.swarm/triggers/swarm-trigger.pl% -c %//.swarm/triggers/swarm-trigger.conf% -t strict -v %change% -p %serverport%"

Note

These trigger table entries assume that the trigger script, swarm-trigger.pl, has been committed to the Helix Versioning Engine within the //.swarm depot. If you have instead copied the trigger script to your Perforce server's filesystem (and to the same path on all edge servers in a commit-edge deployment), replace //.swarm/triggers/swarm-trigger.pl with the path to the trigger script.

Customize each line by replacing DEPOT_PATH1 or DEPOT_PATH2 with the appropriate depot path where you wish to enforce review approvals or to apply a strict comparison of review contents.

The above lines include two examples of each of the two new trigger behaviors. Remove unnecessary lines, or add additional lines for specific depot paths as required.

It is also possible to configure exemptions to the enforce and strict verifications, for the number of files in a review or the filetypes in a review. For more information on the trigger's options, see Trigger options.

Group exclusion

You may want to exclude specific users from the enforcement provided by these new trigger lines:

  1. Create a group in the Helix Versioning Engine whose members should be excluded from enforce or strict review restrictions.

  2. Add users who should be excluded to the group.

    Note

    The owner of a group is not counted as a member of the group, unless the owner's userid is listed as a user in the group.

  3. Edit the trigger table and add -g group_name to each enforce or strict trigger line as desired.

    If the group name is review_exclusions, the trigger lines would be similar to:

    swarm.enforce.1 change-submit  //DEPOT_PATH1/... "%//.swarm/triggers/swarm-trigger.pl% -c %//.swarm/triggers/swarm-trigger.conf% -t enforce -v %change% -p %serverport% -g review_exclusions"
    swarm.enforce.2 change-submit  //DEPOT_PATH2/... "%//.swarm/triggers/swarm-trigger.pl% -c %//.swarm/triggers/swarm-trigger.conf% -t enforce -v %change% -p %serverport% -g review_exclusions"
    swarm.strict.1  change-content //DEPOT_PATH1/... "%//.swarm/triggers/swarm-trigger.pl% -c %//.swarm/triggers/swarm-trigger.conf% -t strict -v %change% -p %serverport% -g review_exclusions"
    swarm.strict.2  change-content //DEPOT_PATH2/... "%//.swarm/triggers/swarm-trigger.pl% -c %//.swarm/triggers/swarm-trigger.conf% -t strict -v %change% -p %serverport% -g review_exclusions"
    

Disable self-approval of reviews by authors

The Swarm 2015.2 release provides the ability to disable review approval by authors, even if they are moderators or administrators. This is useful for development workflows where review by others is of paramount importance.

To disable review approval by authors, update the data/config.php file to include the following configuration item within the reviews block:

        'reviews' => array(
            'disable_self_approve' => true,
        ),

The default value is false.