Helix Core is now P4. Product user interfaces will be updated soon. Learn more >>

P4 CLI Documentation | 2025.2

# p4 client (graph)

Create or edit a client workspace specification

The command `p4 workspace` is an alias for `p4 client`.

## Syntax

    p4 [g-opts] client [-f] [-t template] -T graph [graphClientName]
    p4 [g-opts] client -o [-f] [-t template] -T graph [graphClientName]

Syntax and naming conventions

## Description

To modify Graph Depot files using p4 commands, your workspace must obey several additional rules, beyond those described in p4 client:

- Specify Type: graph
- Specify `View: map`, where map describes the files in the repos that are to be used by this client

### Hybrid client that maps to both classic and graph depots

You can create a client spec that maps solely to a classic depot, solely to a graph depot, or to a hybrid client A client workspace that supports both repos of type graph (see also 'Git Connector') and the classic P4 file revision model. that combines both.

If you create a `hybrid client`, the options are:

- a client of a classic depot in which graph depot files are read-only and classic files are editable - see classic client spec that includes a mapping to a graph directory
- a client of a graph depot in which classic files are read-only and graph depot files are editable - see graph depot client spec that includes a mapping to a classic directory
- a read-only client in which both classic and graph depot files are read-only

For more information about depots of type `graph`, see:

- Including Graph Depot repos in your client in `p4 client`
- Working with depots of type graph in `p4 depot`
- Stream and graph depot - .git suffix and repo path in p4 stream

## Options

Option | Description
--- | ---
`-f` | Allows the last modification date, which is normally read-only, to be set. Administrators can use the `-f` option to delete or modify locked workspaces owned by other users. Use of this option requires `admin` access granted by `p4 protect`.
`-o` | Write the client workspace specification to standard output.
`-T type` | By default, clients are `writeable`. You can also set `type` to: `readonly`, which prevents files from being opened or submitted `partitioned`, which allows files to be opened and submitted
`g-opts` | See Global options.

## Usage notes

- there is no distinct graph version of the client command, but the client spec has a `Type` field that can be set to `graph`

- to map a graph depot path (depot or repo), the user must have at least `read` permission on that graph path (either the individual repo, or the whole depot)

## Examples

### classic client spec that includes a mapping to a graph directory

This client spec associated with a graph depot spec does not include a line that specifies "`Type: graph`", so updates to Graph Depot paths are prohibited.

Copy

    Client:   mixed_client1
    Update:   2017/04/04 09:51:30
    Access:   2017/04/04 09:51:48
    Owner:    bruno
    Host:     laptop153
    Description:
        Created by bruno for a writable "classic" depot with read-only access to a graph depot.
    Root:     /home/user/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/...

depot is the default name for a writable "classic" depot.

repo is the default name for a depot of type `graph`.

This client spec provides write access to `projectA`, which belongs to a writable "classic" 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 /home/user/mixed_client1/depot/main/projectA/projA.txt
    //depot/main/projectA/readme.txt#1 - added as /home/user/mixed_client1/depot/main/projectA/readme.txt
    //repo/projectB/projB.txt - added as /home/user/mixed_client1/repo/projectB/projB.txt
    //repo/projectB/readme.txt - added as /home/user/mixed_client1/repo/projectB/readme.txt

If this client attempts to edit a file in a graph depot, an error message appears. For example,

    p4 edit aRepoFile.c
    //repo/projectB/aRepoFile.c - can only edit file in a local depot

### graph depot client spec that includes a mapping to a classic directory

The client spec associated with a graph depot spec must include a line that specifies "`Type: graph`" (see line 10).

Copy

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    Client:   mixed_client2
    Update:   2018/05/16 19:01:30
    Access:   2018/05/16 19:01:59
    Owner:    bruno
    Host:     laptop153
    Description:
    Created by bruno for a writable graph depot, with read-only access to a classic depot.
    Root:     /home/user/mixed_client2
    Options:  noallwrite noclobber nocompress unlocked nomodtime normdir
    SubmitOptions:    submitunchanged
    LineEnd:  local
    Type:    graph
    View:
       //repo/projectB/... //mixed_client2/repo/projectB/...
       //depot/main/projectA/... //mixed_client2/depot/main/classicProjectA/...

If this client attempts to edit a file in a classic depot, an error message appears. For example,

    p4 edit aClassicFile.c
    aClassicFile.c - no such file(s).

Your search for returned results