P4Sandbox: Merge Down, Copy Up

One of the joys of using P4Sandbox to develop P4Sandbox is that I get to encounter and fix cumbersome workflows before our customers do.

P4Sandbox requires a “merge down, copy up” workflow. This means that any time I want to send my work to the central Perforce server, I must first “merge down” all of my coworkers’ changes: merge their changes into my working branch, resolve any conflicts, fix any bugs, get my branch exactly how I want. Only then can I can “copy up” my own work sending it to the central server.

This is the what the “merge down, copy up” workflow looks like on the command line:

  1. Figure out which stream I am on.

    $ p4 switch

    Currently on stream

    //s/job051690

  2. Merge down coworkers’ changes.

    $ p4 merge -rS //s/job051690
    $ p4 resolve -am
    $ p4 submit -d “Merge down //s/job051690”

  3. Build and test

    $ make sand test

  4. Copy up the result to central server.

    $ p4 copy -S //s/job051690
    $ p4 submit

Every time I finished a task I had to answer “what is the name of my current stream?” I needed to supply that answer along with -S to both merge down and copy up commands. I also needed to remember which direction is “reverse” for the -r flag. This seemed unnecessary: P4Sandbox knows what stream I am on. P4Sandbox knows which direction is correct. Let P4Sandbox answer its own demands.

Behold two new P4Sandbox-only commands:

p4 mergedown
p4 copyup

‘p4 mergedown’ replaces these three commands:

$ p4 merge -rS //s/job051690
$ p4 resolve -am
$ p4 submit -d “Merge down //s/job051690”

‘p4 mergedown’ is smart enough to skip the resolve+submit if there is nothing to merge, and skip the submit if the resolve -am could not resolve everything.

‘p4 copyup’ replaces one command:

$ p4 copy -S //s/job051690

‘p4 copyup’ never submits: I always need to type in a changelist description and fuss over the changelist before submitting.

The resulting “merge down, copy up” process now looks like this:

$ p4 mergedown
$ make sand test
$ p4 copyup
$ p4 submit

Fewer commands, fewer parameters, no flags.

P4Sandbox, along with its new ‘p4 mergedown’ and ‘p4 copyup’ commands, starts open beta testing soon.

 

Zig Zichterman is Technical Lead for P4Sandbox. Before joining Perforce, Zig worked at WildPackets, where he wrote parts of EtherPeek and OmniPeek while also administering a Perforce server. He gets nervous around ceiling fans.