Discussion:
[p4] How to set the default submit option for new workspaces
Sven Erik Knop
2017-04-06 13:32:04 UTC
Permalink
Hi Sean,


this will not work, because the submit option is not set by default, so all you are changing the comment.

but this will work if you replace 'change' with 'client':

autodesc form-out client "sed -i -e %quote%s/submitunchanged/revertunchanged/%quote% %formfile%"

Cheers,

Sven Erik

--

Sven Erik Knop | Principal Solutions Engineer
Perforce Software<http://www.perforce.com>
T: +44 1189 771020<tel:+441189771020> | M: +44 7974 351514<tel:+447974351514>
Visit us on: Twitter<https://twitter.com/perforce> | LinkedIn<https://www.linkedin.com/company/perforce-software> | Facebook<https://www.facebook.com/Perforce>



On 6 Apr 2017, at 10:45, SeanT <perforce-user-***@forums.perforce.com<mailto:perforce-user-***@forums.perforce.com>> wrote:

Posted on behalf of forum user 'SeanT'.

Hi Sven,

should i be able to get this working using:

autodesc form-out change "sed -i -e
%quote%s/submitunchanged/revertunchanged/%quote% %formfile%"



--
Please click here to see the post in its original format:
http://forums.perforce.com/index.php?/topic/948-how-to-set-the-default-submit-option-for-new-workspaces
_______________________________________________
perforce-user mailing list - perforce-***@perforce.com<mailto:perforce-***@perforce.com>
http://maillist.perforce.com/mailman/listinfo/perforce-user

_______________________________________________
perforce-user mailing list - perforce-***@perforce.com
http://maillist.perforce.com/mailman/listinfo/perforce-
Sven Erik Knop
2017-04-06 14:52:23 UTC
Permalink
Aye

which is why my trigger first checks if this is the first time the client has been invoked, and otherwise leaves it well alone.

Cheers,

Sven Erik
--
Sven Erik Knop | Principal Solutions Engineer
Perforce Software<http://www.perforce.com>
T: +44 1189 771020<tel:+441189771020> | M: +44 7974 351514<tel:+447974351514>
Visit us on: Twitter<https://twitter.com/perforce> | LinkedIn<https://www.linkedin.com/company/perforce-software> | Facebook<https://www.facebook.com/Perforce>



On 6 Apr 2017, at 15:35, Sambwise <perforce-user-***@forums.perforce.com<mailto:perforce-user-***@forums.perforce.com>> wrote:

Posted on behalf of forum user 'Sambwise'.

That's one approach, although if you're trying to trigger on the client
form you should specify "client" there rather than"
change".��

A caveat with doing it that way is that every time the user edits their client
spec your script is going to do that substitution, so if they do explicitly
specify submitunchanged you're going to constantly reset it underneath
them.��A way to avoid this is to have your script check to see if
it's firing on a new vs existing client spec; there's a really simple
example in the admin guide:

https://www.perforce.com/perforce/r15.1/manuals/p4sag/chapter.scripting.html#scripting.triggers.forms.out
--
Please click here to see the post in its original format:
http://forums.perforce.com/index.php?/topic/948-how-to-set-the-default-submit-option-for-new-workspaces
_______________________________________________
perforce-user mailing list - perforce-***@perforce.com
http://maillist.perforce.com/mailman/listinfo/perforce-user

_______________________________________________
perforce-user mailing list - perforce-***@perforce.com
http://maillist.perforce.com/mailma
Robert Cowham
2017-04-06 19:43:49 UTC
Permalink
There is an easy way to do what you want:

Create a client workspace with appropriate view and settings, call it “my_template_workspace” and then:

p4 configure set template.client=my_template_workspace

Give it a try.

Regards
Robert



_______________________________________________
perforce-user mailing list - perforce-***@perforce.com
http://maillist.perforce.com/mailman/listinfo/perf
Robert Cowham
2017-04-10 12:10:01 UTC
Permalink
Glad to hear it.

I would suggest you lock your template workspace to prevent accidental deletion – that can cause “chicken and egg” problems! Get around it by importing unsetting the configurable again, recreating the template client and resetting, or “p4 client -i < my_client_workspace.txt” where the file contains the full definition.

Also, you can of course call it whatever you want, template.client to match the configurable can be a good thing, plus a Description which identifies what it is. Set the View to be something like:

//sandbox/... //template.client/...

or a similar area where new users won’t cause problems by syncing down “the whole repository”.


For future reference, there are a couple of simple triggers which only depend on Python and p4 command line:

https://swarm.workshop.perforce.com/files/guest/perforce_software/sdp/main/Server/Unix/p4/common/bin/triggers/SetWsOptions.py
https://swarm.workshop.perforce.com/files/guest/perforce_software/sdp/main/Server/Unix/p4/common/bin/triggers/SetWsOptionsAndView.py

Regards
Robert
-------
This worked perfectly thanks




_______________________________________________
perforce-user mailing list - perforce-***@perforce.com
http://mail

Loading...