Question

I'm a new with p4v so please be patient if my questions are "simple" :)

Description:

I want to write a script that upon any creation of "new workspace" will set its property "Line ending characters for text files:" to "Shared: writes UNIX style and reads local style" (the property is under the "Advanced" tab).

Questions:

  • triggers - I understand that I need to add a record to the triggers table, but I don't know what what the record must contain (an example will be great).
  • script - I want to write the script with Groovy (I'm in windows environment), how do I refer to a "new workspace" from within the script? where do I keep the script so that the trigger can run it?

That's it for now, thoughts anyone?

Regards, Igor.

Was it helpful?

Solution

Indeed, you can use a trigger to accomplish your goal.

The trigger will be a "form-in" trigger with a "path" value of "client".

You'll need to learn to work with the Perforce command line, and with the simple text file format that Perforce uses for workspace specs.

You should have a look at this related question: How to set defaults for perforce client specs

And you can find documentation and examples in the Perforce manuals here: http://www.perforce.com/perforce/doc.current/manuals/p4sag/chapter.scripting.html

Here's another older document with some good background material: http://www.perforce.com/sites/default/files/writing-triggers-paper_0.pdf

After you've read all that material, set up a test server to use for developing your triggers, and tried writing some triggers yourself, you'll probably have some additional questions to ask about the details, but your proposed trigger is simple enough that you'll probably be able to figure it out with some experimentation once you've looked at these examples.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top