Client integration

P4 Code Review 2022.3 or later only works with P4 Visual Client (P4V) 2021.3 or later.

P4V and P4 for Visual Studio can integrate with P4 Code Review. To indicate how these applications should connect with P4 Code Review, P4 Code Review sets the P4.Swarm.URL property set in P4 Server. P4V and P4 for Visual Studio read this property, and if set, they connect to the specified URL to make P4 Code Review API calls. If the property is unset, P4 Code Review integration features are disabled.

If you make a configuration change, P4 Code Review will not use it until the configuration cache has been reloaded, this forces P4 Code Review to use the new configuration. You must be an admin or super user to reload the P4 Code Review config cache. Navigate to the User id dropdown menu, select System Information, click the Cache Info tab, and click the Reload Configuration button.

When P4.Swarm.URL is set, P4V provides the following integration features:

  • Request a review: requests a review for pending or committed changelists.
  • Update a review: updates a review from the current state of a pending changelist. This works for changelists that are already associated with a review, or for unassociated changelists.
  • Open review in P4 Code Review: opens the review associated with the selected changelist in your system's default web browser.
  • Review Id and State columns: adds Review Id and Review State columns to both the Pending and Submitted tabs.

By default, the first P4 Code Review worker auto-detects the URL it is running under and sets P4.Swarm.URL accordingly. P4 Code Review checks and updates this property every 10 minutes.

Customized P4 Code Review installations

For customized P4 Code Review installations, the auto-detected URL might not use the correct protocol, hostname, or port. In these scenarios, you can disable the URL auto-detection by editing the SWARM_ROOT/data/config.php file and setting the auto_register_url item to false in the p4 configuration block. For example:

<?php
'p4' => array(
'auto_register_url' => false,
),

If you disable this feature, you should:

Manually set P4.P4 Code Review.URL in the P4 Server

If you disable auto_register_url, you should manually set the P4.Swarm.URL property in P4 Server to the URL for your P4 Code Review installation:

p4 property -a -n P4.Swarm.URL -v https://myswarm.url:port/

Replace https://myswarm.url:port/ with the URL for your P4 Code Review installation.

To find out what the current P4.Swarm.URL value is for all users, run:

p4 property -Al -n P4.Swarm.URL

P4V uses an integration timeout, specified in the P4.Swarm.Timeout property, to limit delays in the P4V user interface. The default timeout is 10 seconds.

To change the integration timeout, run:

p4 property -a -n P4.Swarm.Timeout -v 10

Replace the 10 with the desired timeout in seconds. Increasing the timeout could cause notable delays in the P4V user interface, and decreasing the timeout could cause sporadic integration failures if P4 Code Review's API responses take longer than the specified timeout.

Set the external_url in P4 Code Review

If you disable auto_register_url, you should usually set the external_url for P4 Code Review. However, you do not need to set the external_url if the P4.Swarm.URL is manually set. For information about setting the external_url for P4 Code Review, see external_url.