Search code examples
perforceperforce-stream

How to efficiently work with a task stream?


Disclaimer: I let the question open, but my slow branching issue was due to the server being overloaded. So this is not the usual Perforce behavior. I now take about 30 seconds to branch 10K files.

I am a new Perforce 2014 user. I have created a stream depot, and put the legacy application (about 10,000 cpp files) in a development branch. That was relatively quick for an initial import, about 1 hour to upload everything.

Now I want to create a 'lightweight' task stream to work on a new feature. I use the default menu > new stream > type task ... I select "Branch file from parent on stream creation"

To my surprise, it takes ages (about 1 hour) to create a new task because it is branching individually every file. I would expect the process to be almost instant coming from other SCM tools. (git, svn,...)

Now my question is :

  • is this the expected behavior ?
  • Alternatively, is there a way to create more quickly a Task, and only branch the file I intend to modify ?

Solution

  • Creating a new task stream of 10k files SHOULD be a very quick operation (on the order of a second or two?) since no actual file content is being transferred, assuming you're starting with a synced workspace. If you're creating a brand new workspace for the new stream, then part of creating the new workspace is going to be syncing the files; I'd expect that to take about as long as the submit did since it's the same amount of data being transferred.

    Make sure when creating a new stream that you're not creating a new workspace. In the visual client there's an option to "create a workspace"; make sure to uncheck that box or it'll make a new workspace and then sync it, which is the part that'll take an hour.

    From the command line, starting from a workspace of //stream/parent, here's what you'd do to make a new task stream:

    p4 stream -t task -P //stream/parent //stream/mynewtask01
    p4 populate -r -S //stream/mynewtask01
    p4 client -s -S //stream/mynewtask01
    p4 sync
    

    The "stream" and "client" commands don't actually operate on any files, so they'll be really quick no matter what. The "populate" will branch all 10k files, but it does it on the back end without actually moving any content around, so it'll also be really quick (if you got up into the millions or billions it might take an appreciable amount of time depending on the server hardware, but 10k is nothing). The "sync" will be very quick if you were already synced to //stream/parent, because all the files are already there; again, it's just moving pointers around on the server side rather than transferring the file content.