Map different depot locations to the same workspace location

Overlay mappings enable you to map files from more than one depot directory to the same place in a workspace.

Overlay mappings are:

  • Useful for applying sparse patches in build environments.

  • Fundamental to Sparse streams.

To overlay the contents of a second depot path on top of a prior depot path mapped to the same workspace directory, use a plus sign (+) in front of the mapping.

Example   Overlaying multiple directories in the same workspace

Maria wants to combine the files from her projects when they are synced to her workspace, so she constructs this view:

View:
    //Acme/proj1/...    //maria/project/...
    +//Acme/proj2/...   //maria/project/...

The overlay + mapping //Acme/proj2/... maps to //maria/project, and overlays the first mapping, which is //Acme/proj1/....

When multiple directories are overlaid in this way, only the last directory is writable. In this example, the files in //Acme/proj2/ are writeable and the files in //Acme/proj1/ are read-only.

Overlay mappings avoid conflicts because the files in the overlay take precedence:

  • If only //Acme/proj1/ReadMe.txt exists, //Acme/proj1/ReadMe.txt is mapped to the workspace.

  • If only //Acme/proj2/ReadMe.txt exists, //Acme/proj2/ReadMe.txt is mapped to the workspace.

  • If both //Acme/proj1/ReadMe.txt and //Acme/proj2/ReadMe.txt exist (not obliterated), even if one or both are deleted, //Acme/proj2/ReadMe.txt is mapped to the workspace.
    The files in the overlay take precedence and this applies even in the following cases:

    • //Acme/proj2/ReadMe.txt is deleted and //Acme/proj1/ReadMe.txt is not deleted

    • //Acme/proj1/ReadMe.txt is deleted and //Acme/proj2/ReadMe.txt is not deleted