We have a Perforce depot path called “Shared” with a number of subfolders, all just containing zero-length dummy files, no real source files, to create a specific folder structure in the workspace. We want to have this same folder structure a second time, this time called “Artifacts”.
Is there a way to map one depot path into two workspace locations using Perforce?
UPDATE: Since there is no way to copy one depot path into two workspace locations using Perforce, I had to go for some other solution. This is a good thing because having a shadow copy of a depot path has a smell anyway. Now I introduced a “Pre build” step resetting all archive flags in the Shared folder. And I’ve added a “Post build” step xcopiing all files with archive flag set into an Artifacts folder. That’s exactly meeting my requirements without having to solve the above question.
Thanks for your answers and comments.
No, you cannot.
Perforce mapping is 1:1. Think about it. If you were to edit a file in both locations, how should Perforce handle that? It gets very complicated when a single file in the Perforce depot is represented by two locations in your workspace, and rather than deal with that complexity, they’ve decided not to allow it.
Now, I would actually have preferred to have a feature where you can have a readonly mapping to allow just what you need without breaking the underlying 1:1 SCM functionality, but that’s probably taking Perforce too far in a direction they don’t want to invest effort into.
By far my biggest gripe, however, is that Perforce will not give any errors if you map a location to two workspace locations. It will simply ignore one of them (the second one, I think). This leads to a lot of confusion and is pretty poor behaviour from Perforce for what is a fairly obvious mistake.