Posts Tagged ‘Agile hotfix’

Reparenting Workspaces – What’s the hype?

September 21st, 2007 by dave

By now you’ve probably heard about workspace reparenting in AccuRev. You know… the fancy drag-n-drop of a workspace from one stream to another. But what’s all the hype? Ultimately, workspace reparenting means that a workspace, on disk, can ‘morph’ into the configuration of it’s parent stream (See video) . So one day you are working on a mainline feature and the next day, with a single command, you can instantly have the configuration from a buggy release 2 months ago on disk, in the same location, with the exact configuration of files at that point in time. Poof! Reparenting VideoWell… first off, reparenting isn’t magic. You see, each and every stream in AccuRev knows at least two things – (1) its parent stream and (2) any active changes to its own relative configuration. Knowledge of the parent stream is by way of reference, in the same way that an OO subclass knows of its parent class. So if you change the parent reference, you instantly have visibility into the new parent configuration, in combination with any active changes that come along for the ride (as needed, most likely). Remember, workspaces are streams too!

Fun Toy or Power Tool?

The only “fun toy” you’ll find in AccuRev is the easter egg hidden in Help–>About where if you press CapsLock-Pause with your left hand you can play a tetris clone… ok, kidding. Workspace reparenting is a wickedly powerful feature that, when used properly, can save time, energy, and disk space and be a great powertool. So when is reparenting useful?

Retargeting a Delivery – Remember the time when you spent Saturday night cranking out a hot-fix… only for it to be reclassified to a lower priority on Monday and scheduled for next weeks build? No problem! Simply reparent your workspace from the release hotfix stream to the mainline area and promote the changes. done. go home.

Large Code Footprints – Lets say you have a 400Gb footprint of source code for any given release. On a particular day, you just finished committing 174 source files to mainline for a new feature. You then get tasked to the bug squad to tackle 9 high-priority bugs found in the recent production release. Rather than creating a brand new workspace from the old release snapshot, you can simply reparent your ‘mainline’ workspace and run update. You’ll most likely get the old versions of 174 files and probably a few dozen or hundred other files that changed… but the point is, you just get the delta. And waiting for 2G of changes over the wire compared to 400G is a significant time savings for you and others sharing the pipe.

Tracing Defects - You know those bugs that crop up and someone asks, “how long has that runtime defect been around?” Take a single workspace, create a unit test that forces the failure, then reparent to each and every release snapshot in question. Each time you do an update, you’ll get a corresponding configuration of code on disk -and- the tweaked unit test (active changes come along for the ride, remember!). Run the test, verify the failure. Bingo – a recipe to quickly test how far back a defect went. Just keep reparenting and running the test(s) until you find a configuration that works.

Rapid Application Development – Are you responsible for cranking out a few features all at once? Need to hop between them frequently? Sure, you could create a separate workspace for each feature and that’s probably a better practice in most cases… but nothing stops you from using a single workspace and context-switching by reparenting. As long as you keep/promote each feature’s set of files out of the workspace, then reparenting is a breeze. This works well if you follow a stream-per-feature paradigm.

So now you might say, “But isn’t reparenting the same as updating my local work area with a different ‘branch’?” Nope. Don’t forget about the most significant architectural difference between streams and branches… inheritance. We’ll save that for another thread.

One of the great things about workspaces is that they are a super tiny meta-data record in the AccuRev meta-database… just a pointer to parent stream and pointer to host machine and dir on disk. That’s it. Workspaces are cheap entities. Reparenting simply changes the single parent reference reference and updating only retrieves the deltas. Make reparenting part of your routine and the benefits will follow.

/happy reparenting/ – dave