Perforce can keep a file from a contractor, and has done so for decades: deny the read right on a path and the file never reaches their machine. What it cannot do is keep that file from the contractor and still let the contractor's build use it. Occlude does both, by controlling what each side of a workspace can see instead of what syncs.


"Perforce has done this for thirty years" is the objection we hear most from teams with Perforce in the building. It is fair, so here is exactly where the two differ.
What the manual says
Perforce grants rights per path in its protections table, p4 protect. To keep a contractor out of a file, you deny them the read right on it. The command reference is precise about the effect:
"If this right is denied, users cannot use p4 print, p4 diff, or p4 sync on files."
That is the point: the file does not sync, so it is not on the contractor's disk. Deny a whole depot and, in the words of the administration guide, the user "will no longer see the depot in the output of p4 depots."
It is also the problem. If the contractor's code imports that file, their build now fails, because the compiler on their machine cannot read what is not there.
The other choice is to deny less. Denying the open right stops them changing the file:
"If this right is denied, users cannot open files with p4 add, p4 edit, p4 delete, or p4 integrate."
Now the file syncs, the build passes, and the source sits on their laptop, readable. A Perforce administrator chooses between a broken build and a visible file.
Why version control cannot do both
That is not a flaw in Perforce. It follows from where version control sits. A version-control server decides what lands on a disk. Once a file is on the disk, anything that can read the disk can read it, and on a contractor's laptop the compiler and the contractor are the same user on the same machine. Keep the file from one and you keep it from both.
To keep a file from a person while the compiler still reads it, you need two readers the system can tell apart, and a runtime the person does not control. Version control ships neither.
Side by side
| Perforce protections | Occlude | |
|---|---|---|
| Decides | What syncs to a machine | What each side of a workspace can see |
| A protected file, for the contractor | Not on their disk | Not in their tree, search or terminal |
| A protected file, for their build | Missing, so the build fails | Present, so the build passes |
| Where the permitted code ends up | On the contractor's laptop | In your cloud |
| Applies to | Files in Perforce depots | Your existing Git repositories |
| Maturity | Decades in production | New |
What Occlude does instead
Occlude does not decide what syncs. It holds the full clone in a workspace in your cloud and decides what each side of that workspace can see.
- The person's side (shell, editor, language server) sees the task's files. An Occluded file is not there:
catanswers No such file or directory, exactly as it would for a file that never existed. Where their code imports it, a declaration stub stands in, so autocomplete and go-to-definition still work. - The build's side (compiler, tests, dev server) sees the whole repository and runs as a different user.
npm run buildreads the real file, so the build is the one you ship.
The contractor gets a working build without the file. The Perforce administrator never had that option. We call this code masking: partial repository access with a working build.
Where Perforce still wins
- You already run it and contractors can live with partial builds. Then the protections table is enough, and it costs you nothing new.
- The protected code is a stable library. Perforce plus a compiled binary handed to contractors works well when the library changes a few times a year.
- Very large binary assets. Perforce is built for them, and nothing here replaces it as version control.
If the code changes every week, or the contractor edits next to it every day, the binary goes stale and the sync-time choice comes back. That is the case Occlude is for.
Sources
Both manuals were last read on 28 November 2026.
- p4 protect, the Helix Core command reference, for the read and open rights.
- Set protections, the Helix Core administration guide, for excluded depots.
- Our docs: The four states and Stubs.
Want to go through this for your codebase?
Or write to contact@occludehq.com
Not ready to talk? Step through a session on a sample repository