Search code examples
perforcep4v

Importing perforce stream into the root directory of another stream


I have two depots with one stream each:

  • //DepotA/StreamA
  • //DepotB/StreamB.

I want to import the contents of //DepotA/StreamA into the root directory of //DepotB/StreamB.

The workspace should look like this:

workspace\
├─ [StreamB files]
├─ [StreamA files]

I have tried this using the View settings of //DepotB/StreamB:

share ...
import ./... //DepotA/StreamA/...

But this doesn't import any files into the workspace from StreamA.

If I instead write

share ...
import StreamAFiles/... //DepotA/StreamA/...

I get

workspace\
├─ [StreamB files]
├─ StreamAFiles\
├─ ├─ [StreamA files]

so I think I'm on the right track.


Solution

  • The way to import an arbitrary depot path into the root of a stream would be:

    import ... //DepotA/StreamA/...
    

    Note that you can't combine this with a share ...; each path in the stream needs to be mapped to a specific location in the depot, and where they conflict, one will override the other.

    You could have them in parallel directories by doing something like:

    Paths:
        share ...
        import StreamA/... //DepotA/StreamA/...
    
    Remapped:
        ... StreamB/...
    

    That will give you a mapping like:

    workspace\
    ├─ StreamA\
    ├─ ├─ [//DepotA/StreamA files]
    ├─ StreamB\
    ├─ ├─ [//DepotB/StreamB files, EXCEPT FOR //DepotB/StreamB/StreamA]
    

    If you want to merge streamA's files into the depot namespace of streamB, you can do that by branching the actual files (rather than mapping the depot namespace of streamA into streamB's client namespace). Use a regular old share path so that you can submit files freely to streamB:

    Stream: //DepotB/StreamB
    Paths:
        share ...
    

    and then within a client of that stream you can do:

    p4 merge -F //DepotA/StreamA/... //DepotB/StreamB/...
    p4 resolve
    p4 submit