Using config files

Config files are text files containing settings that are in effect for files in and below the directory where the config file resides. Config files are useful if you have multiple client workspaces on the same computer. By specifying the settings in config files, you avoid the inconvenience of changing system settings every time you want to work with a different workspace.

To use config files, you define the P4CONFIG environment variable, specifying a file name (for example, .p4config). When you issue a command, Helix Core Server searches the current working directory and its parent directories for the specified file and uses the settings it contains (unless the settings are overridden by command-line options).

Each setting in the file must be specified on its own line, using the following format:

setting=value

Note

Make sure there are no spaces. For example, setting = value will not work.

The following settings can be specified in a config file:

Setting Description

P4CHARSET

Character set used for translation of Unicode files.

P4COMMANDCHARSET

Non-UTF-16 or UTF-32 character set used by Command-Line Client when P4CHARSET is set to a UTF-16 or UTF-32 character set.

P4CLIENT

Name of the current client workspace.

P4DIFF

The name and location of the diff program used by p4 resolve and p4 diff.

P4EDITOR

The editor invoked by those Helix Core Server commands that use forms.

P4HOST

Hostname of the client computer. Only useful if the Host field of the current client workspace has been set in the p4 client form.

P4IGNORE

A list of files to ignore when using the p4 add and p4 reconcile commands.

P4LANGUAGE

This environment variable is reserved for system integrators.

P4MERGE

The name and location of the third-party merge program to be used by p4 resolve's merge option.

P4PASSWD

Supplies the current Helix Core Server user’s password for any Helix Core Server command.

P4PORT

The protocol, host and port number of the Helix Core Server (including proxies or brokers) with which to communicate.

P4TRUST

The location of a file of known (trusted) Helix Core Server. You manage the contents of this file with the p4 trust command. By default, this file is .p4trust in your home directory.

P4USER

Current Helix Core Server user name.

For details about these settings, refer to the Helix Core Command-Line (P4) Reference.

Example   Using config files to handle switching between two workspaces

Ona switches between two workspaces on the same computer. The first workspace is ona-ash. It has a client root of /tmp/user/ona and connects to the Helix Core Server using SSL at ssl:ida:1818. The second workspace is called ona-agave. Its client root is /home/ona/p4-ona, and it uses a plaintext connection to a Helix Core Server at tcp:warhol:1666.

Ona sets the P4CONFIG environment variable to .p4settings. She creates a file called .p4settings in /tmp/user/ona containing the following text:

P4PORT=ssl:ida:1818
P4CLIENT=ona-ash

She creates a second .p4settings file in /home/ona/p4-ona. It contains the following text:

P4PORT=tcp:warhol:1666
P4CLIENT=ona-agave

Any work she does on files under /tmp/user/ona is managed by the Helix Core Server at ssl:ida:1818 and work she does on files under /home/ona/p4-ona is managed by the Helix Core Server at tcp:warhol:1666.