Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set defaults for perforce client specs

I'm trying to discover how to change the default set of Client Spec options and submit-options.

set P4CLIENT=my_new_client_1
p4 client

Gives me the following spec default-spec:

Client: my_new_client_1
...
Options:    noallwrite noclobber nocompress unlocked nomodtime normdir

SubmitOptions:  submitunchanged
...

Now on my machine i want to always use revertunchanged, rmdir for example, but it seems like I need remember to manually set this everytime I create a new client.

Is there any way to achieve this? p4 set seems to only affect the things that can be set by environment variables.

like image 455
Greg Avatar asked Jul 09 '10 04:07

Greg


People also ask

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 Perforce client workspace?

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.

What is P4V client?

Helix Visual Client (P4V) is a desktop app that provides access to versioned files in Helix Core through a graphical interface. It includes tools for merging and visualizing code evolution.


2 Answers

You can't change the default client spec template (unless you're the Perforce system administrator) but you can set up and use your own template. You would first create a dummy client with a client spec that has the values that you want:

Client: my_template_client
...
Options:    noallwrite noclobber nocompress unlocked nomodtime rmdir

SubmitOptions:  revertunchanged
...

Then you just specify that the dummy client should be used as a template when creating new clients:

p4 client -t my_template_client my_new_client_1
like image 83
rettops Avatar answered Sep 20 '22 22:09

rettops


The first response here was incorrect:

You CAN create a default clientspec in Perforce using triggers.

Essentially, you create a script that runs on the server and runs whenever someone does a form-out on the form client. This script would have to check to see if the clientspec already exists, and then substitute a sensible "default" if it doesn't (if it's a new clientspec).

Note that this works fine and well, and it's even in the P4 SysAdmin Guide (the exact example you're looking for is there!) but it can be a bit difficult to debug, as triggers run on the SERVER, not on the client!

Manual: http://www.perforce.com/perforce/r10.1/manuals/p4sag/06_scripting.html

Specific Case Example: http://www.perforce.com/perforce/r10.1/manuals/p4sag/06_scripting.html#1057213

like image 33
Dana Lacoste Avatar answered Sep 19 '22 22:09

Dana Lacoste