Customize p4 trigger with a local config?

I recently setup a default changelist description for my team with a form-out trigger, which has been working great, but I’ve been asked to investigate if it can be customized by each user with some kind of local config file.

For example, I’d want to be able to populate the description with the feature pod that a developer is in by looking up a config file in their workspace.

The trigger runs on the p4 server, but is there a way i can get some kind of local info from the client or its p4 config?

You should be able to run commands like p4client inside the trigger, if the info is there you can get to it it and append it to the CL. Local machine stuff like environment vars would be a harder project.

1 Like

If the config is completely local, you probably can’t get at it from the server.

In addition to using the client spec as @AnnieCat mentioned, you could store the config data in the user spec, or assign the user to specific groups based on project / feature.

1 Like

Doh, that was me – i was helping a user account recovery and forgot I was in impersonation mode. But hey – it’s 2018, anything goes!

The trigger will tell you the name of the client and you can use tjhat to run p4client -o %client% and get details of the client. On a change-content trigger you should also be able to p4 print the contents of files in the CL. That will be slow, though.

1 Like