'How can I share a workspace definition between multiple hosts?

I have created a Perforce workspace definition with which I will be able to "run the latest demo" on a PC.

Then I wanted to try and check out the same workspace on another PC in order to run the same demo. I found that I could not do this because the workspace is somehow tied to the first PC where I created it.

I ended up copying the workspace by

  • inspecting the textual definition of the workspace and copying it to a text editor,
  • searching and replacing "WantedWorkspaceName" with "WantedWorkspaceName_NewHostname",
  • creating a new workspace with a new name ("WantedWorkspaceName_NewHostname"),
  • giving the new workspace the same workspace root path ("D:\Demo") as the original workspace,
  • pasting the modified textual representation into the textual representation of the new workspace.

Surely there must be a better way to achieve what I want? (Use the same workspace mapping on different hosts.)



Solution 1:[1]

Just use the -t template option to p4 client:

p4 client -t WantedWorkspaceName WantedWorkspaceName_NewHostname

You may also want to look at streams, which are an alternative way of setting up client/branch mappings. Rather than configuring each client individually, you define a single "stream" which encapsulates a set of depot mappings and branching relationships to other streams. Then a client can be defined simply in terms of what stream it's associated with, and the views are auto-generated whenever the stream is changed.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Samwise