Perforce File System Plugin

The Merge plugin for Perforce enables Merge to access files located within a Perforce depot. The plugin is included as a standard part of the Merge installation.

What you can do with the plugin

Using the plugin, you can (for example) perform a folder comparison to compare the Perforce depot against your local client workspace. Alternatively, you could directly compare different branches (or the same branch at different points in time) within the depot. You could then launch file comparisons for any pairs of modified files that were of interest. This approach can work well for performing code reviews.

The plugin also enables Merge to populate the Versions button drop-down versions menu appropriately. For more information, see Comparing Text Files (or Typed/Pasted Text).

The plugin provides read-only access to the Perforce depot. To modify files within the depot, you will need to use one of the Perforce tools to open/edit/submit files.

Preparing Merge to use the plugin

Merge needs to know the path to the p4 executable on your machine. This can be configured on the ApplicationSCM settings page.

Merge also needs credentials to access the Perforce servers that you use. Provide these on the Credentials settings page.

Finally, if you wish Merge to populate the Versions button drop-down versions menu with any other revisions of the files or folders you are comparing, check the Include versions from SCM systems checkbox on the the Versions settings page.

Using the Perforce plugin

To specify a file or folder within a Perforce depot, prefix the path to the depot file or folder with p4: to form a URI.

A username, password, and database computer and port can be included in the URI, as shown in the examples below. If a Perforce URI is specified that does not specify a server, username or password (e.g. p4://depot/folder/file.txt), Merge will use the first entry on the Credentials settings page that is marked as the default for Perforce URIs to provide the required information.

It is possible to use \* as a password placeholder (e.g. p4://jrs:*@p4.example.com/depot/folder/file.txt). This prevents passwords appearing visibly on the screen. In this case, the server list is checked for an entry containing a server p4.example.com and a username jrs, and the password from that entry is used to make the connection.

Information Note that if a username is specified, a host and port must also be provided.

Examples

URI Description
p4://depot/notepad Specifies the most recent version of the folder //depot/notepad.
p4://depot/notepad/notepad.cpp Specifies the most recent revision of the file //depot/notepad/notepad.cpp.
p4://depot/notepad@2000/03/23 Specifies the folder //depot/notepad, as it was on 23 March 2000.
p4://depot/notepad@12345 Specifies the folder //depot/notepad, as it was at changelist 12345.
p4://depot/notepad/notepad.cpp#43 Specifies revision 43 of file //depot/notepad/notepad.cpp.
p4://jrs@cat:1666/depot/notepad/notepad.cpp As above, but logging into a Perforce database located on the host and port cat:1666, as user jrs with no password.
p4://jrs@cat:1666///depot/notepad/notepad.cpp As above. The inclusion of the extra // before the depot is optional.
p4://jrs:mypass@cat:1666/depot/notepad/notepad.cpp As above, but specifying a password mypass.
p4://jrs:*@cat:1666/depot/notepad/notepad.cpp As above, but specifying that Merge should use the relevant password from the Credentials settings page. This ensures that the password is not shown on the screen or within comparison reports.

Accessing files and folders already in your client workspace

If files or folders are already synced in your client workspace, you access them as you would any other file or folder on your hard disk. You do not need to use a p4:// URI to do so.

If the appropriate credentials have been configured on the Credentials settings page, Merge will endeavour to populate the Versions button with any older revisions of the file you are comparing.

Integrating Merge with P4V and the Perforce command-line

Merge itself integrates well with Perforce. For more information, see Integrating with Source Control, Configuration Management, and Other Applications.