Perforce 2008.1 Command Reference
<< Previous Chapter
p4 changes
Table of Contents
Index
Perforce on the Web
Next Chapter >>
p4 clients

p4 client

Synopsis

Create or edit a client workspace specification and its view.

Syntax

p4 [g-opts] client [-f -t template] [clientname]
p4 [g-opts] client -o [-t template] [clientname]
p4 [g-opts] client -d [-f] clientname
p4 [g-opts] client -i [-f]

Description

A Perforce client workspace is a set of files on a user's machine that mirror a subset of the files in the depot. The p4 client command is used to create or edit a client workspace specification; invoking this command displays a form in which the user enters the information required by Perforce to maintain the client workspace.

Although there is always a one-to-one mapping between a client workspace file and a depot file, these files do not need to be stored at the same relative locations, nor must they have the same names. The client view, which is specified in the p4 client form's View: field, specifies how files in the client workspace are mapped to the depot, and vice-versa.

When called without a clientname argument, p4 client operates on the client workspace specified by the P4CLIENT environment variable or one of its equivalents. If called with a clientname argument on a locked client, the client specification is read-only.

When p4 client completes, the new or altered client workspace specification is stored within the Perforce database; the files in the client workspace are not touched. The new client view doesn't take effect until the next p4 sync.

The command p4 workspace is an alias for p4 client.

Form Fields

Field Name
Type
Description

Client:

Read-only

The client workspace name, as specified in the P4CLIENT environment variable or its equivalents.

Owner:

Writable

The Perforce user name of the user who owns the client workspace. The default is the user who created the client workspace.

Update:

Read-only

The date the client workspace specification was last modified.

Access:

Read-only

The date and time that any part of the client workspace specification was last accessed by any Perforce command.

Host:

Writable, optional

The name of the host machine on which this client workspace resides. If included, operations on this client workspace can be run only from this host.

The hostname must be provided exactly as it appears in the output of p4 info when run from that host.

This field is meant to prevent accidental misuse of client workspaces on the wrong machine. It doesn't provide security, since the actual value of the host name can be overridden with the -H flag to any p4 command, or with the P4HOST environment variable. For a similar mechanism that does provide security, use the IP address restriction feature of p4 protect.

Description:

Writable, optional

A textual description of the client workspace. The default text is Created by owner.

Root:

Writable, mandatory

The directory (on the local host) relative to which all the files in the View: are specified. The default is the current working directory.

AltRoots:

Writable, optional

Up to two optional alternate client workspace roots.

Perforce client programs use the first of the main and alternate roots to match the client program's current working directory.

This enables users to use the same Perforce client specification on multiple platforms with different directory naming conventions.

If you are using a Windows directory in any of your client roots, you must specify the Windows directory as your main client root and specify your other client root directories in the AltRoots: field.

For example, an engineer building products on multiple platforms might specify a main client root of C:\Projects\Build for Windows builds, and an alternate root of /staff/userid/projects/build for any work on UNIX builds.

Options:

Writable, mandatory

A set of seven switches that control particular client options. See the Usage Notes, below, for a listing of these options.

SubmitOptions:

Writable, mandatory

Flags to govern the default behavior of p4 submit.

  • 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.

LineEnd:

Writable, mandatory

A set of four switches that control carriage-return/linefeed (CR/LF) conversion. See the Usage Notes, below, for a listing of these options.

View:

Writable, multi-line

Specifies the mappings between files in the depot and files in the client workspace. See Views for more information.

Options

-t clientname

Copy client workspace clientname's view and client options into the View: and Options: field of this client workspace. (i.e, use clientname's View: as a template)

-f

Allows the last modification date, which is normally read-only, to be set. Superusers may use this flag to delete or modify locked workspaces owned by other users, and non-superusers may use this flag to delete or modify locked workspaces that they do own.

-d clientname

Delete the specified client workspace, if the client is owned by the invoking user or it is unlocked. (The -f flag allows allows Perforce superusers to delete locked client workspaces that they don't own, or by non-superusers to delete or modify locked clients that they do own.)

-i

Read the client description from standard input.

-o

Write the client specification to standard output.

g-opts

See the Global Options section.

Usage Notes

Can File Arguments Use
Revision Specifier?

Can File Arguments Use
Revision Range?

Minimal Access Level Required

N/A

N/A

list

The LineEnd: field accepts one of five values:

Option
Meaning

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 more information about how Perforce uses the line-ending settings, see Tech Note 63 on the Perforce web site:

If the rmdir option is active, a p4 sync operation may sometimes remove your current working directory. If this happens, just change to an existing directory before continuing on with your work.

Use lowercase drive letters when specifying workspaces across multiple drives.

Examples

p4 client

Edit or create the client workspace specification named by the value of P4CLIENT or its equivalents.

p4 client -t sue joe

Create or edit client workspace joe, opening the form with the field values and workspace options in client workspace sue as defaults.

p4 client -d release1

Delete the client workspace release1.

Related Commands

To list client workspaces known to the system

p4 clients

To read files from the depot into the client workspace

p4 sync

To open new files in the client workspace for addition to the depot

p4 add

To open files in the client workspace for edit

p4 edit

To open files in the client workspace for deletion

p4 delete

To write changes in client workspace files to the depot

p4 submit


Perforce 2008.1 Command Reference
<< Previous Chapter
p4 changes
Table of Contents
Index
Perforce on the Web
Next Chapter >>
p4 clients
Please send comments and questions about this manual to [email protected].
Copyright 1999-2008 Perforce Software. All rights reserved.
Last updated: 07/08/08