Search code examples
command-linep4v

Create Workspace in P4V using Command Line


I have a basic idea of defining a workspace in P4V using command line, however I'm trying to create a workspace and assign it a name, root and stream using command line but have been unable to do so.

Any examples on how to do this would be greatly appreciated if it's possible to do at all.


Solution

  • Found what I was after, still unsure as to setting a Steam but this will get you most of the way:

    https://portal.perforce.com/s/article/3504

    When creating a new client, the only pieces of information that are required are the name of the client and its root. The name is given upon invocation, but the workspace root normally has to be specified in the creation form or automatically generated by sed. However, you can take advantage of the fact that the workspace root is set, by default, to the directory where the client creation takes place.

    If you are creating a client specification called "testme" and you want its root to be "D:\testme_root", you do the following:

    Change to the proper directory.

    cd D:\testme_root

    Note: This method creates a client specification with the default client view mappings for the user.

    Run the p4 client command using standard input and output.

    D:\testme_root>p4 client -o testme | p4 client -i

    You can then set the workspace for streams using:

    D:\testme_root>p4 client -f -s -S //stream_root_path