August 26, 2011

P4Sandbox: Private local branching, distributed development, and more


Here at Perforce we’ve been following the discussion about distributed version control solutions with great interest. Although distributed version control has obvious appeal if you have a sporadic or low bandwidth connection to your SCM server, some of the workflow implications are equally compelling.

We still think that the centralized model has great merit, so we’ve decided to give you the best of both worlds. An upcoming release of Perforce will include our new private local branching and workflow solution. This solution will be much more than just a new client program to talk to a Perforce server. In fact, it could become a core part of the way you work with Perforce.

In this article I’ll introduce some of the key features and benefits of this solution.

The Architecture

Other resources will go into the technical details in much greater depth, but looking at the basic architecture of P4Sandbox will give you a better understanding of the features and benefits.

At its core, P4Sandbox puts a local Perforce server on your workstation.

Perforce Sandbox Architecture
High-level P4Sandbox architecture

P4Sandbox lets you select a branch of the central repository to keep on your local server, and handles all of the communication and synchronization between your local server and the central server. A P4Sandbox instance acts as a remote branch of the central server. You can use any of our normal Perforce clients, like P4V, the command line client, or P4Eclipse, to work on your P4Sandbox instance. P4Sandbox automatically pulls down changes from the central server to merge into your local server, and gives you the tools to push your changes up when ready.

Distributed Perforce

Of course, one of the key benefits of using P4Sandbox is that your team can continue working regardless of whether their connection to the central Perforce server is slow or non-existent. Your local P4Sandbox will have enough data to let you work independently of the connection to the central server. You’ll be able to use branching, shelving, and all the other advanced Perforce features. You only need to talk to the central server periodically, to pull and push changes.

Private Local Branching and Workflow

P4Sandbox will let you quickly and easily create new local branches, opening up a new horizon of productive workflows. You can use these local branches for fast task switching, experimentation, or a variety of other purposes. Your local branches are private and won’t interfere with other users; you have complete freedom to work as you see fit.

P4Sandbox Features
P4Sandbox Features

To each his own

The folks who design the branch model on the central server often have different goals than individual developers. The administrators and product leads who design a branch model are striving for clarity, ease of collaboration, and efficient release processes. That doesn’t always gel with developers who want the freedom to create task or experimental branches. With P4Sandbox, the developer can branch as much as she wants, and periodically push changes to the central server, with its more formally managed branching structure. If her local work isn’t exactly pristine, no one will care (or even know). From an administrator’s point of view, P4Sandbox is just about transparent, and the learning curve is shallow.


P4Sandbox offers several productivity features to keep you working quickly and efficiently. P4Sandbox uses just-in-time branching, which means that files are actually branched only as you start working on them. Just-in-time branching is one of the features that enables fast context switching: with P4Sandbox, you can very quickly switch between branches using in-place branching. Only the files that actually differ from branch to branch are updated in your workspace. And since you’re working against your local P4Sandbox most of the time, everything you do is fast. All the work you’re doing with P4Sandbox is work not done on the central server, which means it’ll be faster too.

Fast context switching

P4Sandbox offers the ability to rapidly switch tasks and branches, automatically saving work in the process. As you switch from branch to branch, any work in progress is automatically shelved on your P4Sandbox instance. That means that you can create local branches to work on different tasks, and quickly switch between them, with your work restored for you – even if you haven’t submitted it yet.

Tightly integrated

P4Sandbox is tightly integrated with the central Perforce server. New changes are regularly and automatically pulled from the central server, and local changes can be easily pushed up to the central repository. P4Sandbox shows that you shouldn’t have to sacrifice any of the advantages of a centralized server in order to use the local and distributed features.

A Unique Architecture

Perforce always tries to bring you the best parts of version control without any of the drawbacks: powerful but still fast, full featured but still flexible. P4Sandbox follows that principle, offering a unique combination of local and distributed features tightly integrated with a strong central server. Expect more details soon, but for now, suffice to say that we’re very excited about the possibilities P4Sandbox offers.