Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Create Client Workspace using Perforce command-line on Ubuntu

I am writing a script to build all our projects on a Ubuntu build machine.

Each project is stored in Perforce and I am using p4 to perform the above.

The command I am using is:

p4 -u <MyUsername> -P <MyPassword> client MyWorkspace

This runs and loads vim which I then need to perform a :wq [Enter] to quit from.

Can I auto-save or avoid vim loading?

like image 241
neildeadman Avatar asked Jun 15 '11 09:06

neildeadman


People also ask

What is Perforce client workspace?

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. More precisely, it is a named mapping of depot files to workspace files.

How do I run a p4 command-line?

Quick start with p4Open p4v (visual Perforce client). Right click on the project folder. Click "Open Terminal". Now you can use p4 in a preconfigured console, you don't need to setup workspace and server connection.

What is Perforce client spec?

Your Perforce client spec defines your workspace location, the depot files you plan to work with, and their location in your workspace when you invoke Perforce commands. When you work with P4Web, all workspaces reside on the machine where P4Web is running.

What is workspace root in Perforce?

The workspace root, also referred to as client root. If two or more client workspaces are located on one machine, they should not share a client root directory., specifies the location on your workstation under which Helix server stores copies of depot files.


2 Answers

For my builds I have a text file, which I have in perforce, containing my client. That way I know what the client looked like at that build (I don't use a spec depot).

So on unix machines:

$ cat client.txt | p4 client -i

or for windows:

type client.txt | p4 client -i

creates the client from the txt file in perforce. You can create the text by doing a p4 client -o <client_name> >client.txt and change it from there.

like image 64
aflat Avatar answered Sep 29 '22 05:09

aflat


You probably want to try p4 client -i. From the help page:

The -i flag reads a client specification from the standard input. The user's editor is not invoked.

So you construct your client-spec in a script and pass it to p4 client -i. Additionally, -t could be helpful, too:

The -t flag constructs the client view by using the specified client's view and options as a template, instead of using the existing view or creating a new default view.

like image 30
jhwist Avatar answered Sep 29 '22 05:09

jhwist