Perfarce Extension

This extension is not distributed with Mercurial.

Author: Frank Kingswood

Public repository: http://www.kingswood-consulting.co.uk/hg/perfarce

1. Overview

This extension modifies the remote repository handling so that repository paths that resemble

cause operations on the named p4 client specification on the p4 server.

The client specification must already exist on the server before using this extension, and the working copy belonging to this client spec must be visible to hg.

2. Commands

3. Configuration

Configure your .hgrc to enable the extension by adding following lines:

[extensions]
perfarce = /path/to/perfarce.py

[perfarce]
keep = True
submit = False
lowercasepaths = False
clientuser = search_regex replacement_string

If the keep option is true (this is default) then the Perfarce extension will keep the p4 workarea updated with the current top of tree in Perforce. If keep is false then the Perfarce extension does not leave files in the p4 workarea unless it is creating a changelist.

If the submit option is true then Perfarce will automatically submit a changelist when pushing changes to the p4 depot. The default is to create a pending changelist, and let the user review this before submitting, either with p4 submit or hg p4submit.

If the lowercasepaths option is true then the Perfarce extension forces all directory names received from p4 to lowercase, but leaving filenames unchanged. The default is to preserve filenames.

The clientuser option allows for 'cheap' multiuser operation with Perforce. The option argument is split on the first space into a search regular expression and a replacement string. If the regular expression matches the client spec name of an imported p4 changelist then the username for the changelist is changed to the value of the replacement string after it is capitalized. The replacement string can use regex matches to substitute part of the client spec name.An example could be

clientuser = ([a-z]+)\.([a-z-]+)--[a-zA-Z0-9-_.]+ \1 \2 <\1.\2@example.com>

which turns "firstname.lastname--my-client-name" into "Firstname Lastname <firstname.lastname@example.com>"


CategoryExtensionsByOthers