Search code examples
perforceperforce-client-spec

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.


Solution

  • 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