Files configuration

Swarm can be customized using the following config items:

Tip

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

max_size

Swarm limits the size of files that are displayed in a review or standard file view. This defaults to 1MB, but can be configured to be larger or smaller. When the files are in the add or delete state, files larger than this will be truncated. The lowest max_size value defaults to 50 bytes. If you set the max_size value lower than 50 bytes then Swarm will ignore it. The max_size value enhances the review page loading speed for reviews with large files.

When a file is in the edit state, depending on the max_size value, the following two flags are set in the response:

  • fetchContent: This flag determines if the size of a file is larger than the max_size value and accordingly enables or disables the show more context buttons in the file diff panel. For more information about the show more context buttons, see File diff panel.

    Files larger than the max_size value sets the fetchContent flag to false. When the fetchContent flag is set to false, all the show more context buttons in the file diff panel are disabled. When the fetchContent flag is set to true, all the show more context buttons in the file diff panel are enabled.

  • isCut: This flag determines if a file diff size is larger than the max_size value and must be truncated.

    File diff sizes larger than the max_size value sets the isCut flag value to the max_size value which truncates the diff. When the file diff size is smaller than the max_size value, the isCut flag is set to false.

If the max_size value is set to zero, then the file size is unlimited.

<?php
// this block should be a peer of 'p4'
'files' => array(
'max_size' => 1 * 1024 * 1024, // 1MB (in bytes)
),

download_timeout

When downloading files, there is a timeout which defaults to 30 minutes. This can be changed by setting the download_timeout configurable to a value in seconds. Alternatively, setting it to zero removes the timeout.

<?php
// this block should be a peer of 'p4'
'files' => array(
'download_timeout' => 1800, // seconds (30 minutes)
),

allow_edits

Important

File edit is a Technology Preview feature.

Features offered in Technology Preview are experimental and not guaranteed to always work as expected. If you have feedback and functionality suggestions, email techpreview@perforce.com.

By default, you can edit a file from the files page and shelve or commit it.

When set to false, files cannot be edited from the Swarm files page.

<?php
// this block should be a peer of 'p4'
'files' => array(
'allow_edits' => false, // default is true
),