Chapter 2
Configuring P4
This chapter tells you how to configure connection settings.
Configuration overview
Perforce uses a client/server architecture: you sync files from the server repository, called the depot, and edit them on your client machine in your client workspace. This chapter assumes that your system administrator has a Perforce server running. For details about installing the Perforce Server, refer to the Perforce System Administrator's Guide.
To set up your client workspace so you can work with the server, perform the following steps.
After you configure your workspace, you can populate it by syncing files that are stored in the depot. For details, see "Syncing (retrieving) files" on page 50 and the description of the p4 sync command in the Perforce Command Reference.
Before you start to configure your client machine, ask your Perforce administrator for the server host and port setting. Also ask whether a workspace has already been configured for your client machine.
What is a client workspace?
A Perforce client workspace is a set of directories on the client machine where you work on file revisions that are managed by Perforce. Each workspace is given a name that identifies the client workspace to the Perforce Server. If no workspace name is specified (by setting the P4CLIENT environment variable) the default workspace name is the name of the client machine. To specify the effective workspace name, set the P4CLIENT environment variable. A client machine can contain multiple workspaces.
All files within a Perforce client workspace share a root directory, called the client root. The client root is the highest-level directory of the workspace under which the managed source files reside.
If you configure multiple workspaces on the same machine, keep workspace locations separate to avoid inadvertently overwriting files. Ensure that client roots are located in different folders and that their client views do not map depot files to overlapping locations on the client machine.
After you configure your workspace, you can sync files from the depot and submit changes. For details about these tasks, refer to Chapter 4, Managing Files and Changelists.
How Perforce manages the workspace
Perforce manages the files in a client workspace as follows:
- Files in the workspace are created, updated, and deleted as determined by your changes.
- Write permission is enabled when you edit a file, and disabled when you submit your changes.
The state of your client workspace is tracked and managed by the Perforce server. To avoid conflicts with the file management that is performed by the server, do not manually change read-only permission settings on files. You can verify that the state of the client workspace corresponds to the server's record of that state. For details, refer to Technote 2 on the Perforce web site:
Files in the workspace that you have not put under Perforce control are ignored by Perforce. For example, compiled objects, libraries, executables, and developers' temporary files that are created while developing software but not added to the depot are not affected by Perforce commands.
After defining your client workspace, you can fine-tune the workspace definition. Probably most important, you can restrict the portion of the depot that is visible to you, to prevent you from inadvertently syncing the entire depot. For details, refer to "Refining client views" on page 24.
Configuring Perforce settings
This guide refers to Perforce settings using environment variables (for example, "set P4CLIENT"), but you can specify Perforce settings such as server port, user, and workspace names using the following methods, listed in order of precedence:
- On the command line, using flags
- In a config file, if P4CONFIG is set
- User environment variables (on UNIX or Windows)
- System environment variables (on Windows, system-wide environment variables are not necessarily the same thing as user environment variables)
- On Windows, in the Perforce user registry (set by issuing the p4 set command)
- On Windows, in the Perforce system registry (set by issuing the p4 set -s command)
To configure your client machine to connect to a Perforce server, you specify the name of the host where the server is running, and the port on which the server is listening. The default server host is perforce and default server port is 1666. If the server is running on your client machine, specify localhost as the host name. If the server is running on port 1666, you can omit the port specification.
You can specify these settings as described in the following sections. For details about working detached (without a connection to a Perforce server), see "Working detached" on page 59.
Using the command line
To specify server settings on the command line, use the -p flag. For example:
p4 -p localhost:1776 sync //depot/dev/main/jam/Jambase
Server settings specified on the command line override any settings specified in config files, environment variables, or the Windows registry. For more details about command-line flags, refer to the discussion of global options in the Perforce Command Reference.
Using config files
Config files are text files containing Perforce 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 machine. 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, Perforce 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 flags).
Each setting in the file must be specified on its own line, using the following format:
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 Perforce commands that use forms.
|
P4HOST
|
Hostname of the client workstation. Only useful if the Host: field of the current client workspace has been set in the p4 client form.
|
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 Perforce user's password for any Perforce client command.
|
P4PORT
|
The host and port number of the Perforce server or proxy with which to communicate.
|
P4USER
|
Current Perforce user name.
|
For details about these settings, refer to the Perforce Command Reference.
Example:
Using config files to handle switching between two workspaces
Ona switches between two workspaces on the same machine. The first workspace is ona-ash.
It has a client root of /tmp/user/ona and connects to the Perforce server at ida:1818. The
second workspace is called ona-agave. Its client root is /home/ona/p4-ona, and it uses the
Perforce server at 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=ida:1818
P4CLIENT=ona-ash
She creates a second .p4settings file in/home/ona/p4-ona. It contains the following
text:
P4PORT=warhol:1666
P4CLIENT=ona-agave
Any work she does on files under /tmp/user/ona is managed by the Perforce server at
ida:1818 and work she does on files under /home/ona/p4-ona is managed by the Perforce
server at warhol:1666.
Using environment variables
To configure server connection settings using environment variables, set P4PORT to host:port, as in the following examples.
If the server is running on
|
and is listening to port
|
set P4PORT to
|
---|
your computer
|
1666
|
localhost:1666
|
perforce
|
1666
|
1666
|
houston
|
3435
|
houston:3435
|
deneb.com
|
1818
|
deneb.com:1818
|
If your network environment and Perforce Server have been configured to support Zeroconf services, you can set P4PORT to the value of the service name.
Using the Windows registry
On Windows machines, you can store connection settings in the registry by issuing the p4 set command. For example:
There are two ways you can configure Perforce settings in the registry:
- p4 set setting=value: for the current Windows login.
- p4 set -s setting=value: for all users on the local machine. Overrides any registry settings made for the local user. Requires Perforce admin privilege.
To see which settings are in effect, type the p4 set command. For details about the p4 set command, see the Perforce Command Reference.
Defining client workspaces
To define a client workspace:
- Specify the workspace name by setting P4CLIENT; for example, on a UNIX system:
$ P4CLIENT=bruno_ws ; export P4CLIENT
- Issue the p4 client command.
Perforce displays the client specification form in your text editor. (For details about Perforce forms, refer to "Using Perforce forms" on page 47.)
- Specify (at least the minimum) settings and save the specification.
No files are synced when you create a client specification. To find out how to sync files from the depot to your workspace, refer to "Syncing (retrieving) files" on page 50. For details about relocating files on your machine, see "Changing the location of your workspace" on page 30.
The minimum settings you must specify to configure a client workspace are:
- The workspace name defaults to the client machine's hostname, but a client machine can contain multiple workspaces. To specify the effective workspace, set P4CLIENT.
- The client root is the top directory of your client workspace, where Perforce stores your working copies of depot files. Be sure to set the client root, or you might inadvertently sync files to your client machine's root directory.
Your client view determines which files in the depot are mapped to a client workspace and enables the server to construct a one-to-one mapping between individual depot and workspace files. You can map files to have different names and locations in your workspace than they have in the depot, but you cannot map files to multiple locations in the workspace or the depot. By default, the entire depot is mapped to your workspace. You can define a client view to map only files and directories of interest, so that you do not inadvertently sync the entire depot into your workspace. For details, see "Refining client views" on page 24.
Example:
Setting the client view
Bruno issues the p4 client command and sees a form containing this default client view
definition:
Client: bruno_ws Update: 2004/11/29 09:46:53 Access: 2005/03/02 10:28:40 Owner: bruno Root: c:\bruno_ws Options: noallwrite noclobber nocompress unlocked nomodtime normdir SubmitOptions: submitunchanged LineEnd: local View: //depot/... //bruno_ws/...
|
He modifies the view to map only the development portion of the depot.
View: //depot/dev/... //bruno_ws/dev/...
|
He further modifies the view to map files from multiple depots into his workspace.
View: //depot/dev/... //bruno_ws/depot/dev/... //testing/... //bruno_ws/testing/... //archive/... //bruno_ws/archive/...
|
Verifying connections
To verify a connection, issue the p4 info command. If P4PORT is set correctly, information like the following is displayed:
User name: bruno Client name: bruno_ws Client host: workstation_12 Client root: c:\bruno_ws Current directory: c:\bruno_ws Client address: 127.0.0.1:28 Server address: localhost:1667 Server root: /usr/depot/p4d Server date: 2008/06/28 15:03:05 -0700 PDT Server uptime: 752:41:23 Server version: P4D/FREEBSD4/2008.1/156375 (2008/05/25) Proxy version: P4P/SOLARIS26/2008.1/156884 (2008/05/25) Server license: P4 Admin <p4adm> 20 users (expires 2009/01/01)
|
The Server address: field shows the Perforce server to which p4 connected and also displays the host and port number on which the Perforce server is listening. If P4PORT is set incorrectly, you receive a message like the following:
Perforce client error: Connect to server failed; check $P4PORT. TCP connect to perforce:1666 failed. perforce: host unknown.
|
If the value you see in the third line of the error message is perforce:1666 (as above), P4PORT has not been set. If the value is anything else, P4PORT is set incorrectly.
Refining client views
By default, when you create a client workspace, the entire depot is mapped to your workspace. You can refine this mapping to view only a portion of the depot and to change the correspondence between depot and workspace locations.
To display or modify a client view, issue the p4 client command. Perforce displays the client specification form, which lists mappings in the View: field:
Client: bruno_ws Owner: bruno Description: Created by bruno. Root: C:\bruno_ws Options: noallwrite noclobber nocompress unlocked nomodtime normdir SubmitOptions: submitunchanged View: //depot/... //bruno_ws/...
|
The following sections provide details about specifying the client view. For more information, see the p4 client command description and the description of views in the Perforce Command Reference.
Specifying mappings
Views consist of multiple mappings. Each mapping has two parts.
- The left-hand side specifies one or more files in the depot and has the form: //depotname/file_specification
- The right-hand side specifies one or more files in the client workspace and has the form: //clientname/file_specification
The left-hand side of a client view mapping is called the depot side, and the right-hand side is the client side.
To determine the location of any client file on the host machine, substitute the client root for the client name on the client side of the mapping. For example, if the client root is C:\bruno_ws, the file //depot/dev/main/jam/Jamfile resides in the workspace as C:\bruno_ws\dev\main\jam\Jamfile.
Later mappings override earlier ones. In the following example, the second line overrides the first line, mapping the files in //depot/dev/main/docs/manuals/ up two levels. When files in //depot/dev/main/docs/manuals/ are synced, they reside in c:\bruno_ws\docs\.
View: //depot/dev/... //bruno_ws/dev/... //depot/dev/main/docs/... //bruno_ws/docs/...
|
Using wildcards in client views
To map groups of files in client views, you use Perforce wildcards. Any wildcard used on the depot side of a mapping must be matched with an identical wildcard in the mapping's client side. You can use the following wildcards to specify client view mappings.
Wildcard
|
Description
|
---|
*
|
Matches anything except slashes. Matches only within a single directory. Case sensitivity depends on your server platform
|
...
|
Matches anything including slashes. Matches recursively (everything in and below the specified directory).
|
%%1 - %%9
|
Positional specifiers for substring rearrangement in filenames.
|
In this simple client view:
//depot/dev/... //bruno_ws/dev/...
all files in the depot's dev branch are mapped to the corresponding locations in the workspace. For example, the file //depot/dev/main/jam/Makefile is mapped to the client workspace file C:\bruno_ws\dev\main\jam\Makefile.
Note
|
To avoid mapping unwanted files, always precede the "..." wildcard with a forward slash.
|
The mappings in client workspace views always refer to the locations of files and directories in the depot; you cannot refer to specific revisions of a file in a client view.
Mapping part of the depot
If you are interested only in a subset of the depot files, map that portion. Reducing the scope of the client view also ensures that your commands do not inadvertently affect the entire depot. To restrict the client view, change the left-hand side of the View: field to specify the relevant portion of the depot.
Example:
Mapping part of the depot to the client workspace
Dai is working on the Jam project and maintaining the web site, so she sets the View: field as
follows:
View: //depot/dev/main/jam/... //dai-beos-locust/jam/... //depot/www/live/... //dai-beos-locust/www/live/...
|
Mapping files to different locations in the workspace
Views can consist of multiple mappings, which are used to map portions of the depot file tree to different parts of the workspace file tree. If there is a conflict in the mappings, later mappings have precedence over the earlier ones.
Example:
Multiple mappings in a single client view
The following view ensures that Microsoft Word files in the manuals folder reside in the
workspace in a top-level folder called wordfiles.
View: //depot/... //bruno_ws/... //depot/dev/main/docs/manuals/*.doc //bruno_ws/wordfiles/*.doc
|
Mapping files to different filenames
Mappings can be used to make the filenames in the client workspace differ from those in the depot.
Example:
Files with different names in the depot and client workspace
The following view maps the depot file RELNOTES to the workspace file rnotes.txt:
View: //depot/... //bruno_ws/... //depot/dev/main/jam/RELNOTES //bruno_ws/dev/main/jam/rnotes.txt
|
Rearranging parts of filenames
Positional specifiers %%0 through %%9 can be used to rearrange portions of filenames and directories.
Example:
Using positional specifiers to rearrange filenames and directories
The following view maps the depot file //depot/allfiles/readme.txt to the workspace
file filesbytype/txt/readme:
View: //depot/allfiles/%%1.%%2 //bruno_ws/filesbytype/%%2/%%1
|
Excluding files and directories
Exclusionary mappings enable you to explicitly exclude files and directories from a client workspace. To exclude a file or directory, precede the mapping with a minus sign ( - ). White space is not allowed between the minus sign and the mapping.
Example:
Using views to exclude files from a client workspace
Earl, who is working on the Jam project, does not want any HTML files synced to his
workspace. His client view looks like this:
View: //depot/dev/main/jam/... //earl-dev-beech/jam/... -//depot/dev/main/jam/....html //earl-dev-beech/jam/....html
|
Avoiding mapping conflicts
When you use multiple mappings in a single view, a single file can inadvertently be mapped to two different places in the depot or workspace. When two mappings conflict in this way, the later mapping overrides the earlier mapping.
Example:
Erroneous mappings that conflict
Joe has constructed a view as follows:
View: //depot/proj1/... //joe/project/... //depot/proj2/... //joe/project/...
|
The second mapping //depot/proj2/... maps to //joe/project and conflicts with the
first mapping. Because these mappings conflict, the first mapping is ignored; no files in
//depot/proj1 are mapped into the workspace: //depot/proj1/file.c is not mapped,
even if //depot/proj2/file.c does not exist.
Mapping different depot locations to the same workspace location
Overlay mappings enable you to map files from more than one depot directory to the same place in a client workspace. To overlay the contents of a second directory in your client workspace, use a plus sign (+) in front of the mapping.
Example:
Overlaying multiple directories in the same workspace
Joe wants to combine the files from his projects when they are synced to his workspace, so he
has constructed a view as follows:
View: //depot/proj1/... //joe/project/... +//depot/proj2/... //joe/project/...
|
The overlay mapping +//depot/proj2/... maps to //joe/project, and overlays the
first mapping. Overlay mappings do not conflict. Files (even deleted files) in
//depot/proj2 take precedence over files in //depot/proj1. If
//depot/proj2/file.c is missing (as opposed to being present, but deleted), then
//depot/proj1/file.c is mapped into the workspace instead.
Overlay mappings are useful for applying sparse patches in build environments.
Dealing with spaces in filenames and directories
Use quotation marks to enclose files or directories that contain spaces.
Example:
Dealing with spaces in filenames and directories
Joe wants to map files in the depot into a local workspace, but some of the paths contain
spaces:
View: "//depot/Release 2.0/..." //joe/current/... "//depot/Release 1.1/..." "//joe/Patch Release/..." //depot/webstats/2006/... "//joe/2006 Web Stats/..."
|
By placing quotation marks around the path components on the server side, client side, or
both sides of the mappings, Joe can specify file names and/or directory components that
contain spaces.
For more information, see "Spaces in filenames, pathnames, and identifiers" on page 42.
Mapping Windows workspaces across multiple drives
To specify a Perforce client workspace that spans multiple Windows drives, use a Root: of null and specify the drive letters (in lowercase) in the client view. For example:
Client: bruno_ws Update: 2004/11/29 09:46:53 Access: 2005/03/02 10:28:40 Owner: bruno Root: null Options: noallwrite noclobber nocompress unlocked nomodtime normdir SubmitOptions: submitunchanged LineEnd: local View: //depot/dev/... "//bruno_ws/c:/Current Release/..." //depot/release/... "//bruno_ws/d:/Prior Releases/..." //depot/www/... //bruno_ws/d:/website/...
|
Using the same workspace from different machines
By default, you can only use a workspace on the machine that is specified by the Host: field. If you want to use the same client workspace on multiple machines with different platforms, delete the Host: entry and set the AltRoots: field in the client specification. You can specify a maximum of two alternate client workspace roots. The locations must be visible from all machines that will be using them, for example through NFS or Samba mounts.
Perforce compares the current working directory against the main Root: first, and then against the two AltRoots: if specified. The first root to match the current working directory is used. If no roots match, the main root is used.
Note
|
If you are using a Windows directory in any of your client roots, specify the Windows directory as your main client Root: and specify your other workspace root directories in the AltRoots: field.
|
In the following example, if user bruno's current working directory is located under /usr/bruno, Perforce uses the UNIX path as his client workspace root, rather than c:\bruno_ws. This approach allows bruno to use the same client workspace specification for both UNIX and Windows development.
Client: bruno_ws Owner: bruno Description: Created by bruno. Root: c:\bruno_ws AltRoots: /usr/bruno/
|
To find out which workspace root is in effect, issue the p4 info command and check the Client root: field.
If you edit text files in the same workspace from different platforms, ensure that the editors and settings you use preserve the line endings. For details about line-endings in cross-platform settings, refer to the Perforce System Administrator's Guide.
Changing the location of your workspace
To change the location of files in your workspace, issue the p4 client command and change either or both of the Root: and View: fields. Before changing these settings, ensure that you have no files checked out (by submitting or reverting open files).
If you intend to modify both fields, perform the following steps to ensure that your workspace files are located correctly:
- To remove the files from their old location in the workspace, issue the
p4 sync ...#none command.
- Change the Root: field.
- To copy the files to their new locations in the workspace, perform a p4 sync. (If you forget to perform the p4 sync ...#none before you change the client view, you can always remove the files from their client workspace locations manually).
- Change the View: field.
- Again, perform a p4 sync. The files in the client workspace are synced to their new locations.
Configuring workspace options
The following table describes workspace Options: in detail.
Option
|
Description
|
Default
|
---|
[no]allwrite
|
Specifies whether unopened files are always writable. By default, the Perforce server makes unopened files read-only. To avoid inadvertently overwriting changes or causing syncs to fail, specify noallwrite.
|
noallwrite
|
[no]clobber
|
Specifies whether p4 sync overwrites writable but unopened workspace files. (By default, Perforce does not overwrite unopened files if they are writable.)
|
noclobber
|
[no]compress
|
Specifies whether data is compressed when it is sent between the client and the server.
|
nocompress
|
[un]locked
|
Specifies whether other users can use, edit, or delete the client workspace specification. A Perforce administrator can override the lock with the -f (force) flag.
If you lock your client workspace specification, be sure to set a password for the workspace's owner using the p4 passwd command.
|
unlocked
|
[no]modtime
|
For files without the +m (modtime) file type modifier:
- If modtime is set, the modification date (on the local filesystem) of a newly synced file is the datestamp on the file when the file was submitted to the depot.
- If nomodtime is set, the modification date is the date and time of sync, regardless of Perforce client version.
For files with the +m (modtime) file type, the modification date (on the local filesystem) of a newly synced file is the datestamp on the file when the file was submitted to the depot, regardless of the setting of modtime or nomodtime on the client.
|
nomodtime (date and time of sync).
Ignored for files with the +m file type modifier.
|
[no]rmdir
|
Specifies whether p4 sync deletes empty directories in a workspace if all files in the directory have been removed.
|
normdir
|
Configuring submit options
To control what happens to files in a changelist when you submit the changelist to the depot, set the SubmitOptions: field. Valid settings are as follows.
Option
|
Description
|
---|
submitunchanged
|
All open files (with or without changes) are submitted to the depot.
This is the default behavior of Perforce.
|
submitunchanged+reopen
|
All open files (with or without changes) are submitted to the depot, and all files are automatically reopened in the default changelist.
|
revertunchanged
|
Only those files with content or type changes are submitted to the depot. Unchanged files are reverted.
|
revertunchanged+reopen
|
Only those files with content or type changes are submitted to the depot and reopened in the default changelist. Unchanged files are reverted and not reopened in the default changelist.
|
leaveunchanged
|
Only those files with content or type changes are submitted to the depot. Any unchanged files are moved to the default changelist.
|
leaveunchanged+reopen
|
Only those files with content or type changes are submitted to the depot. Unchanged files are moved to the default changelist, and changed files are reopened in the default changelist.
This option is similar to submitunchanged+reopen, except that no unchanged files are submitted to the depot.
|
Configuring line-ending settings
To specify how line endings are handled when you sync text files, set the LineEnd: field. Valid settings are as follows.
Option
|
Description
|
---|
local
|
Use mode native to the client (default)
|
unix
|
UNIX-style (and Mac OS X) line endings: LF
|
mac
|
Macintosh pre-OS X: CR only
|
win
|
Windows- style: CR, LF
|
share
|
The share option normalizes mixed line-endings into UNIX line-end format. The share option does not affect files that are synced into a client workspace; however, when files are submitted back to the Perforce Server, the share option converts all Windows-style CR/LF line-endings and all Mac-style CR line-endings to the UNIX-style LF, leaving lone LFs untouched.
When you sync your client workspace, line endings are set to LF. If you edit the file on a Windows machine, and your editor inserts CRs before each LF, the extra CRs do not appear in the archive file.
The most common use of the share option is for users of Windows workstations who mount their UNIX home directories as network drives; if you sync files from UNIX, but edit the files on a Windows machine.
|
For detailed information about how Perforce uses the line-ending settings, see Tech Note 63 on the Perforce web site:
Deleting client workspace specifications
To delete a client workspace specification, issue the p4 client -d clientname command. Deleting a client specification removes the Perforce server's record of the workspace but does not remove files from the workspace or the depot.
When you delete a workspace specification:
- Revert (or submit) any pending changelists that have been opened from the workspace.
- Delete existing files from a client workspace (p4 sync ...#none). (optional)
- Delete the workspace specification.
If you delete the workspace specification before you delete files in the workspace, you can delete workspace files using your operating system's file deletion command.
Security
For security purposes, your Perforce administrator can configure the Perforce server to require passwords and to limit the length of time for which your login ticket is valid. The following sections provide details.
Passwords
Depending on the security level at which your Perforce server is running, you might need to log in to Perforce before you can run Perforce commands. Without passwords, any user can assume the identity of any other Perforce user by setting P4USER to a different user name or specifying the -u flag when you issue a p4 command. To improve security, use passwords.
Setting passwords
To create a password for your Perforce user, issue the p4 passwd command.
Your system administrator can configure your Perforce server to require "strong" passwords. A password is considered strong if it is at least eight characters long and contains at least two of the following:
- Uppercase letters
- Lowercase letters
- Non-alphabetic characters
For example, a1b2c3d4, A1B2C3D4, aBcDeFgH are strong passwords.
To reset or remove a password (without knowing the password), Perforce superuser privilege is required. If you need to have your password reset, contact your Perforce administrator. See the Perforce System Administrator's Guide for details.
Using your password
If your Perforce user has a password set, you must use it when you issue p4 commands. To use the password, you can:
- Log into the server by issuing the p4 login command, before issuing other commands
- Set P4PASSWD to your password, either in the environment or in a config file
- Specify the -P password flag when you issue p4 commands (for instance,
p4 -P mypassword submit)
- Windows: store your password in the registry using the p4 set -s command. Not advised for sites where security is high. Perforce administrators can disable this feature.
Connection time limits
Your Perforce administrator can configure the Perforce server to enforce time limits for users. Perforce uses ticket-based authentication to enforce time limits. Because ticket-based authentication does not rely on environment variables or command-line flags, it is more secure than password-based authentication.
Tickets are stored in a file in your home directory. After you have logged in, your ticket is valid for a limited period of time (by default, 12 hours).
Logging in and logging out
If time limits are in effect for your server, you must issue the p4 login command to obtain a ticket. Enter your password when prompted. If you log in successfully, a ticket is created for you in the ticket file in your home directory, and you are not prompted to log in again until either your ticket expires or you log out by issuing the p4 logout command.
To see how much time remains before your login expires, issue the following command:
If your ticket is valid, the length of time remaining is displayed.
To log out of Perforce, issue the following command:
Working on multiple machines
By default, your ticket is valid only for the IP address of the machine from which you logged in. If you use Perforce from multiple machines that share a home directory (typical in many UNIX environments), log in with:
Using p4 login -a creates a ticket in your home directory that is valid from all IP addresses, enabling you to remain logged into Perforce from more than one machine.
To log out from all machines simultaneously, issue the following command:
For more information about the p4 login and p4 logout commands, see the Perforce Command Reference.
Working with Unicode servers
The Perforce server can be run in Unicode mode to activate support for file names or directory names that contain Unicode characters, and Perforce identifiers (for example, user names) and specifications (for example, changelist descriptions or jobs) that contain Unicode characters.
In Unicode mode, the Perforce server also translates unicode files and metadata to the character set configured for the client machine, and verifies that the unicode files and metadata contain valid UTF-8 characters.
Note
|
If you only need to manage textual files that contain Unicode characters, but do not need the features listed above, you do not need to run your server in Unicode mode. Your system administrator will tell you if your server is using Unicode mode or not.
For such installations, assign the Perforce utf16 file type to textual files that contain Unicode characters. You do not have to set the P4CHARSET or P4COMMANDCHARSET environment variables. See "Assigning File Types for Unicode Files" on page 116 for details.
|
To correctly interoperate with Unicode-mode servers, and to ensure that such files are translated correctly by the Perforce server when the files are synced or submitted, you must set P4CHARSET to the character set that corresponds to the format used on your client machine by the applications that access them, such as text editors or IDEs. These formats are typically listed when you save the file using the Save As... menu option.
Values of P4CHARSET that begin with utf16 or utf32 further require that you also set P4COMMANDCHARSET to a non utf16 or utf32 character set in which you want server output displayed. "Server output" includes informational and error messages, diff output, and information returned by reporting commands.
For further information, see the System Administrator's Guide.
Setting P4CHARSET on Windows
To set P4CHARSET for all users on a workstation, you need Perforce administrator privileges. Issue the following command:
p4 set -s P4CHARSET=character_set
To set P4CHARSET for the user currently logged in:
p4 set P4CHARSET=character_set
Your client machine must have a compatible True Type or Open Type font installed.
Setting P4CHARSET on UNIX
You can set P4CHARSET from a command shell or in a startup script such as .kshrc, .cshrc, or .profile. To determine the proper value for P4CHARSET, examine the setting of the LANG or LOCALE environment variable. Common settings are as follows:
If LANG is...
|
Set P4CHARSET to
|
---|
en_US.ISO_8859-1
| iso8859-1
|
ja_JP.EUC
| eucjp
|
ja_JP.PCK
| shiftjis
|
In general, for a Japanese installation, set P4CHARSET to eucjp, and for a European installation, set P4CHARSET to iso8859-1.
Please send comments and questions about this manual to
[email protected].
Copyright 2005-2008 Perforce Software. All rights reserved.
Last updated: 12/05/08