October 26, 2011

Task-Focused Work in P4Sandbox


In recent posts I've talked about a couple of the problems that P4Sandbox helps to solve: distributed or offline work and private branching. One of the best things about P4Sandbox is that it also adds some really productive workflow to private development: the ability to quickly switch between tasks.

Once you have the freedom to make as many private branches as you want, you may find it convenient to create a new private branch for each task (bug, new feature, or story) that you're working on. That gives you a way to isolate and focus your work. Unless you have the luxury of working on only one task at a time until it's finished, you'll appreciate that a lot. P4Sandbox, of course, makes it easy and fast to create new branches, using techniques like just-in-time branching.

But multitasking can be distracting if you have to waste a lot of time mechanically refocusing your working environment. You spend a certain amount of mental energy switching to a new task, but you don't want to have to perform a lot of extra 'tool' steps if you can help it. That's why the Mylyn framework in Eclipse (used by P4Eclipse) has proved so popular, as it saves and preserves working context as you move from one task to another.

P4Sandbox offers that same productive workflow: as you switch from one task (branch) to another, any work-in-progress is automatically shelved before your workspace is updated. The workspace update itself is very efficient, only updating files that actually differ. If you had work already started on the branch you're switching to, it is unshelved and restored in your workspace.

All of this magic comes by virtue of P4Sandbox's switchcommand:

> p4 switch local
Shelving files for change 16.
edit //streams/test/depot/Jam/MAIN/src/timestamp.c#2
Change 16 files shelved.
Client bruno_ws switched.
//streams/local/depot/Jam/MAIN/src/yyacc#1 - unshelved, opened for edit

So switching tasks in P4Sandbox is fast and convenient. Multitasking just got a little bit easier.