views:

54

answers:

2

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.

+4  A: 

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
rettops
Thanks, I suspected I'd have to resort to templates. I'm assuming your command line above is missing the "client" from the end ;)
Greg
Oops, sorry. That should have been'p4 client -t my_template_client my_new_client_1'
rettops
+1  A: 

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

Dana Lacoste
Note that my first line said "unless you're the Perforce system administrator". Your examples are from the Perforce System Administrator's Guide. Triggers may only be defined by Perforce superusers.
rettops
Thanks for the info - I'm probably not going to have permission to set triggers, but I'll give that a go. I think what you have put is here is valuable to some, so maybe I could split this into two questions - one for strictly basic user and one for those with more complete access.
Greg