Perforce Public Knowledge Base - Cloning" clients to bootstrap large workspaces
Downloads Blog Company Integrations Careers Contact Try Free
Menu Search
Reset Search



Cloning" clients to bootstrap large workspaces

« Go Back



How do I create and populate new client workspaces from a master.


When you create a new workspace, you normally use p4 sync to fill it with files. If five people sync new workspaces, the Perforce Server sends the same files to all five new workspaces. Usually it's just as fast for you to sync the files from the Perforce Server as it is to copy them from your coworker. However, if you and your coworkers are all working at the end of a poor network connection, it might make more sense for one of you to sync a workspace and the rest of you to "clone" that workspace just to get started. This note describes how to clone a workspace so that a client appears correctly synced to Perforce.

Let us assume that you are going to clone someone else's client workspace to bootstrap your own. We will call their client the "master" client. Ideally, there should be no opened files in the master client, but if there are, a method for handling them is mentioned below. Here is how you can replicate a master client that has no files opened:


  1. Copy the contents of the master client workspace onto your client workspace area, preserving directory structure, etc.


  2. Create your new client spec using the master client as a template:
    p4 client -t masterclient 
    While in the editor, make sure your client root directory matches the location into which you copied the master client workspace.


  3. There is a variant of p4 sync called p4 flush that pretends to do a sync but does not actually transfer any files. All it really does is update the client information to indicate the workspace has the files. Run p4 flush to simulate doing a sync to files at the master client's revisions:
    p4 flush @masterclient  

    (The @masterclient revision causes Perforce to use the master client's "have" list as if it were a label.)

After doing this, you can edit, submit, and sync to new depot files as if you had already synced your whole workspace.

There is one complication: if the master client had files opened when you copied them into your workspace, you must open the same files in your own client. Otherwise you'll be working with files that Perforce thinks are the same as their depot counterparts, but which may have actually been modified. This situation is exactly the same as if you had been "Working Disconnected From The Perforce Server". Follow the instructions from the article on Working Disconnected to build a changelist that describes all of the changes in your workspace.

This process has now been largely superseded by the use of the Perforce Proxy.

Related Links
Perforce Proxy (Perforce System Administrator's Guide)
Working Disconnected (KB Article)



Was this article helpful?



Please tell us how we can make this article more useful.

Characters Remaining: 255