Create or edit a client workspace specification and its view.
The command p4
workspace
is an alias for p4
client
.
p4 [g-opts] client [-f] [-t template] [-T type] [clientname]
p4 [g-opts] client -o [-t template] [-T type] [clientname]
p4 [g-opts] client -d [-f [-Fs]]clientname
p4 [g-opts] client -s [-S stream | -t clientname] clientname
p4 [g-opts] client -S stream [[-c change] -o] [clientname]
p4 [g-opts] client -i [-f]
p4 [g-opts] client -d -f --serverid=serverid [-Fs]
A
Perforceclient workspace is a set of files on a user’s machine that mirror
a subset of the files in the depot. More precisely, it is a named mapping
of depot files to workspace files. Use the p4 client
command to create or edit a client workspace specificatio. Invoking this
command displays a form in which the user enters the information required
by
Perforce
to maintain the workspace.
The p4 client
command puts the client spec into a
temporary file and invokes the editor configured by the environment
variable P4EDITOR
. For new workspaces, the client name
defaults to the P4CLIENT
environment variable if set, or to
the current host name. Saving the file creates or modifies the client
spec.
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
the mapping between files in the workspace and depot.
When p4 client
completes, the new or altered
workspace specification is stored in the
Perforce
database. The files in the workspace are not touched. The new view does
not take effect until the next p4
sync
.
To submit changes to a stream, you must associate the stream with a
workspace by using the command p4 client -S stream
clientname
. To change the stream associated with a
workspace, use the command p4 client -s -S stream
clientname
.
Field Name | Type | Description |
---|---|---|
|
Read-only |
The client workspace name, as specified in the When called without a clientname argument, Be aware of the Limitations on characters in filenames and entities. |
|
Writable, mandatory |
The name of the user who owns the workspace. The default is the user who created the workspace. The specified owner does not have to be a Perforce user. You might want to use an arbitrary name if the user does not yet exist, or if you have deleted the user and need a placeholder until you can assign the spec to a new user. |
|
Read-only |
The date the workspace specification was last modified. |
|
Read-only |
The date and time that the workspace was last used in any way. The access time is only valid for the server where the client resides — where it was created or where it was moved to. This is an issue only in a commit-edge architecture. Reloading a workspace with |
|
Writable, optional |
The name of the workstation on which this workspace resides. If included, operations on this client workspace can be run only from this host. If not set, access is allowed from any host. The hostname must be provided exactly as it appears in the
output of This field is meant to prevent accidental misuse of client
workspaces on the wrong machine. Providing a host name does not
guarantee security, because the actual value of the host name can
be overridden with the |
|
Writable, optional |
A textual description of the workspace. The default text is
|
|
Writable, mandatory |
The directory (on the local host) relative to which all the
files in the If you change this setting, you must physically relocate any
files that currently reside there. On Windows client machines,
you can specify the root as |
|
Writable, optional |
Up to two optional alternate client workspace roots. Perforce
applications use the first of the main and alternate roots that
match the application’s current working directory. Use the This enables users to use the same Perforce client workspace specification on multiple platforms, even those with different directory naming conventions. If you are using multiple or alternate workspace roots (the
If you are using a Windows directory in any of your workspace
roots, you must specify the Windows directory as your main
workspace root and specify your other workspace roots in the
For example, an engineer building products on multiple platforms
might specify a main client root of
|
|
Writable, mandatory |
A set of seven switches that control particular workspace options. See Usage Notes for a listing of these options. |
|
Writable, mandatory |
Options to govern the default behavior of
|
|
Writable, mandatory |
Configure carriage-return/linefeed (CR/LF) conversion. See Usage Notes for a listing of these options. |
|
Writable, optional |
Associates the workspace with the specified stream. Perforce generates the view for stream-associated workspaces: you cannot modify it manually. |
|
Writable, optional |
A changelist number that sets a back-in-time view of a stream. When This field is ignored unless the |
|
Writable, optional |
If set, restricts usage of the workspace to the named server. If unset, use is allowed on master server and on any replicas of the master other than Edge servers. |
|
Writable, multi-line |
Specifies the mappings between files in the depot and files in
the workspace. See |
|
Writable, optional, multi-line |
Restricts access to depot paths to a particular point in time. Files specified for the ChangeView field are read-only: they may be opened but not submitted. For example: //depot/path/...@1000 Revisions of the files in the specified path will not be visible if they were submitted after the specified changelist number. Files matching a ChangeView path may not be submitted. Note
The names of automatic labels can be used as specifiers in import mappings on stream specs and in the ChangeView on client specs. |
|
Writable, optional |
Specifies the type of client: Use Use Note
Using writeable clients in build automation scripts can lead
to |
|
Writable, optional |
Not currently in use. Applies only to clients bound to cluster workspace servers. If a backup startup process is launched on a cluster
workspace-server, by default all writable clients (see
Note: If the backup startup process is configured with auto-unload unused clients on, neither readonly clients nor those with backup disabled, will be considered for auto unload. For complete information, see version 15.1 of Helix Versioning Engine Administrator Guide: Cluster Management. |
|
Delete the specified client workspace whether or not the
workspace is owned by the user. The workspace must be unlocked
and must have no opened files or pending changes. (The
If you try to forcibly delete a client bound to another server,
you need to specify the |
|
Allows the last modification date, which is normally read-only,
to be set. Administrators can use the Use of this option requires |
|
Allows the deletion of a client even when that client contains
shelved changes. The client is deleted and the shelved changes
are left intact. (You must use the |
|
Read the client workspace specification from standard input. |
|
Write the client workspace specification to standard output. |
|
When used with |
|
Switch workspace view. To switch the workspace view to a stream,
specify Switching views is not allowed in a client that has opened
files. The |
|
If you try to forcibly delete a client bound to another server,
you need to specify the This variant of the |
|
Associates the workspace with the specified stream, which is used to generate its workspace view. |
|
Copy client workspace clientname's view and options into
the |
|
By default, clients are |
|
See Global Options. |
Can File Arguments Use Revision Specifier? | Can File Arguments Use Revision Range? | Minimal Access Level Required |
---|---|---|
N/A |
N/A |
|
p4 client "my workspace"
creates
a workspace called my_workspace
.p4 client
clientname
. To
prevent this from happening, set the locked
option and use
p4 passwd
to create a
password for the workspace owner.To specify a workspace on Windows that spans multiple drives, use a
Root:
of null
, and specify the drive
letters in the workspace view. For instance, the following workspace
spec with a null
root maps //depot/main/...
to an area of the
C:
drive, and other releases to the D:
drive:
Client: eds_win Owner: edk Description: Ed's Windows Workspace Root: null Options: nomodtime noclobber SubmitOptions: submitunchanged View: //depot/main/... "//eds_win/c:/Current Release/..." //depot/rel1.0/... //eds_win/d:/old/rel1.0/... //depot/rel2.0/... //eds_win/d:/old/rel2.0/...
Use lowercase drive letters when specifying workspaces across multiple drives.
The Options:
field contains six values, separated by
spaces. Each of the six options have two possible settings:
Option | Choice | Default |
---|---|---|
|
If set, unopened files in the workspace are left writable. If A setting of |
|
|
If set, a If |
|
|
If set, the data stream between the user’s workstation and the Perforce service is compressed. The compress option speeds up communications over slow links by reducing the amount of data that has to be transmitted. Over fast links, the compression process itself may consume more time than is saved in transmission. In general, compress should be set only for line speeds under T1. |
|
|
Grant or deny other users permission to edit or delete the
workspace specification. (To make a If |
|
|
For files without the
For files with the Files with the |
Ignored for files with the |
|
If rmdir is set, when a command such as Tip
If rmdir is set, |
|
The LineEnd:
field controls the line-ending character(s)
used for text files in the client workspace. Changing the line end option
does not actually update the client files; you can refresh them with
p4 sync -f
.
The LineEnd:
field accepts one of five values:
Option | Meaning |
---|---|
|
Use mode native to the client (default) |
|
UNIX-style (and Mac OS X) line endings: |
|
Mac pre-OS X: |
|
Windows- style: |
|
The When you sync your workspace, line endings are set to
The most common use of the The |
For more information about how Perforce uses the line-ending settings, see "CR/LF Issues and Text Line-endings" in the Perforce knowledge base:
http://answers.perforce.com/articles/KB/3096/
Without -s
, the -S stream
option can be
used to create a new client spec dedicated to a stream. If the client
spec already exists, and -S
is used without -s
,
it is ignored. Using -S
sets the client’s
Stream
field. The special syntax -S
//
can be used to set both a
/stream
@changelist
Stream
and
StreamAtChange
at the same time.
The -S stream
option can be used with -o -c
change
to inspect an old stream client view. It yields
the client spec that would have been created for the stream at the moment
the change was recorded.
A server of type build-server (see p4 help server
)
is a replica that supports build farm integration, and the p4
client
command may be used to create or edit client
workspaces on a build-server. Such workspaces may issue the p4 sync
command in addition
to any read-only command supported by the replica. For more information,
run p4 help buildserver
.
When creating or editing a client workspace for a build-server, the
client specified by the optional name
argument, as well as
the client specified by the P4CLIENT
environment variable or
via the global -c client
argument must not exist, or must be
restricted to this server; this command may not be used to create or edit
a workspace that is not restricted to this build-server.
Build automation scripts, which routinely create, sync, and tear down
clients, may fragment the db.have
table over time. To avoid
this, you can specify the type readonly
for these clients.
Such clients cannot add, delete, edit, integrate, or submit files, but
this should not be an issue in build scripts.
A readonly client is assigned its own personal db.have
database table, and the location of this table is specified using the
client.readonly.dir
configurable.
To set up a read-only client:
Set the client.readonly.dir
configurable to the
directory where the db.* tables for the client should be stored.
For example, if you create a read-only client whose name is
myroc
and you set client.readonly.dir
to
/perforce/1
, then syncing files using this client will
write to the following database
/perforce/1/server.dbs/client/
hashdir
/db.myroc
Type
field of the client spec to
readonly
.Your client spec can include repos that belong to a depot of type
graph
.
A client spec can map a directory that belongs to a depot of type
graph
. The name depot
is the default for a
writable depot. The name repo
is the default for a depot of
type graph
:
Client: mixed_client1 Update: 2017/04/04 09:51:30 Access: 2017/04/04 09:51:48 Owner: bruno Host: win-bruno-153 Description: Created by bruno. Root: C:\Users\bruno\mixed_client1 Options: noallwrite noclobber nocompress unlocked nomodtime normdir SubmitOptions: submitunchanged LineEnd: local View: //depot/main/projectA/... //mixed_client1/depot/main/projectA/... //repo/projectB/... //mixed_client1/repo/projectB/...
This client spec provides write access to projectA
, which
belongs to a writable depot, and read-only access to
projectB
, which belongs to a depot of type
graph
. One use case for such a client is to support
including files from both kinds of projects into a single software
build.
With this client spec, p4 sync
results in:
//depot/main/projectA/projA.txt#1 - added as /opt/perforce/servers/17100/mixed_client1/depot/main/projectA/projA.txt //depot/main/projectA/readme.txt#1 - added as /opt/perforce/servers/17100/mixed_client1/depot/main/projectA/readme.txt //repo/projectB/projB.txt - added as /opt/perforce/servers/17100/mixed_client1/repo/projectB/projB.txt //repo/projectB/readme.txt - added as /opt/perforce/servers/17100/mixed_client1/repo/projectB/readme.txt
|
Edit or create the workspace specification named by the value of
|
|
Create or edit a workspace named |
|
Delete the workspace named |
To list all workspaces known to the system |
|
To read files from the depot into the workspace |
|
To open new files in the workspace for addition to the depot |
|
To open files in the workspace for edit |
|
To open files in the workspace for deletion |
|
To write changes in workspace files to the depot |