Can you map a file or directory multiple times in perforce?

sorin picture sorin · Jun 27, 2011 · Viewed 7.7k times · Source

I would like to know if I can map a file or directory to multiple local copies with perforce.

I know that the P4V does allow me to do that but I encountered very weird behavior from the client and I suspect that this doesn't work.

I do not plan to modify any these files, I need this in order to recreate the same directory structure needed to build my own source tree (I do not want to create a huge branch if I know that I have to modify only few files and also I do not want to create additional workspaces because switching from them takes too much time).

Answer

JasonMArcher picture JasonMArcher · Jun 28, 2011

You aren't allowed to do that because it leads to Bad Things. You can only map a depot file to one local location and vise versa. You can map two different depot folders to the same local folder, but you have to do it in a way that the files in the local folder will go to only one depot location (well, it will ignore the early mappings that conflict).

Branches can't be "big" because Perforce will make shadow copies until you actually make modifications. In general, you should branch the whole tree. Then you can have a workspace per branch (preferable), or one workspace that maps everything (still doable).