April 16, 2013

Task Streams Administration

What's New
Streams

As we discussed in a previous post, task streams are a great addition to the Perforce tool set. Along with shelving improvements, they give us useful containers for managing tasks in progress and how they are eventually promoted into a more stable branch.

If you're the Perforce administrator, there are just a few things to keep in mind.

Task stream location

When you use a task stream, the parent can be a regular branch or another stream. If you're using task streams with regular Perforce branches, you'll need to create a stream depot to contain your task streams. You can create one, or create several to group different sets of task streams together. If you need some advice here, please contact Perforce Support for some tips. You can also have a look at the PDS for more ideas about branch organization.

If the parent is another stream, you can keep the task streams in the same stream depot or make a new one.

  • Keeping the task streams in the same stream depot is convenient. You don't need to make a new depot, and the task streams will be visible in the P4V stream graph.
  • Keeping the task streams in a second stream depot more clearly identifies them as having a different purpose, and makes it easier to assign different permissions to task streams. It also helps if you have a large number of task streams and don't want to clutter up the stream graph and other stream tools.

Unloading task streams

There are two ways to retire a task stream when you're done with it, unloading and deleting. I prefer unloading, as it is easy to automate and easy to 'undo' if you make a mistake. Unload unused task stream metadata (the meaningless 'rev 1' records) into an unload depot, where it can peacefully live forever.

If your teams are creating a lot of task streams every week, I'd put a scheme in place to unload inactive task streams regularly, just as you do with inactive labels and workspaces. You can run a report to see when a change was last submitted to a task stream, and automatically unload task streams that haven't seen new work in over a month. Remember, task streams are easy to restore, so unloading is a low risk procedure. The snippet below shows a few relevant commands, which can all be scripted directly or using Perforce's Perl, Python, or Ruby API.

# find the last change in a task stream
> p4 changes -m1 //tasks/bug895/...
Change 7 on 2012/10/02 by bruno@ws3 'add new method'

# this stream is abandoned, so unload it
> p4 unload -s //tasks/bug895
Stream //tasks/bug895 unloaded.

# oops, need it back
> p4 reload -s //tasks/bug895
Stream //tasks/bug895 reloaded.

You can still see all the permanent data, including merge history, in the unloaded streams. You just can't actively use it anymore.

Next steps

As you roll out task streams, it's a good time to take stock of your regular Perforce maintenance procedures. Besides cleaning up old task streams, you can use the unload command to clean up old labels and workspaces as well. If you have questions be sure to give the good folks in Perforce Support a call.