Best practices to prevent changes to certain files in perforce

Viewed 95

What is a good way to prevent people from submitting changes to a file? I was thinking of two methods

  1. p4 trigger with a python snippet that holds a dictionary with protected paths and warn the user that changes are not accepted any more for that file.
  2. use a bot account to check-out the file and never check-in (sounds like a bad idea)

I was searching for "permanently lock file" however that is just to keep exclusive locks when a file is only to be authored by one user at a time.

1 Answers

Remove write access in the protection table. I.e. run p4 protect and then set up permissions for the path like:

write user * * -//depot/whatever/path/...

If you want users to be able to sync and/or open the file but not submit it, add another line afterward that grants read or open permission specifically. For example, to allow users to sync that path but not edit or submit you'd do:

write user * * -//depot/whatever/path/...
read  user * *  //depot/whatever/path/...
Related