Make a file in perforce depot download only?

43 Views Asked by At

Is it possible to make a file download only using perforce? In other words, as an example, we have a project.ini file that has various settings each user will download to work on a project. When they modify the project with their custom settings, it will modify the project.ini file with those custom settings. We do NOT want that project.ini file to get pushed back to the depot, it should only be downloaded as a base template for the user to modify further for their program UI. Hope that request makes sense.

Tried looking in the perforce client for ways to mark this file as a download only, but didn't see anything off hand.

1

There are 1 best solutions below

4
Jase On

Based on what you're describing, the option that comes to my mind is using the p4 protect table to remove write access to that file for everyone.

You can do that through p4admin or via the CLI if you are a superuser. (The = sign specifically denies a permission)

=write user * * -//depot_name/my_stream/configuration.ini

(In P4Admin you would choose no write from the dropdown of permissions instead of =write)

By putting this line at the bottom of my protections table, I remove write permission for everyone * (even myself and other super users). So if you ever want to make a change to it, you will need to change/remove that line and then add it back afterwards.

Users can still try to check out the file and submit it, but they will get a permission error when they try to submit.

If you combine that with setting the file's type to +w so it is always writable, then users can sync their workspace, and edit the file to their heart's content, without ever needing to check it out.

For more: p4 protect documentation