Shelving and Branching

Team System offers an interesting "shelving" feature

Shelving lets you set aside any pending changes you've made to the source into a named shelveset. Once shelved, those changes are isolated from the main source tree. But that shelveset can be ..

  • shared with other users
  • worked on locally
  • integrated back into the source tree

.. at will. It's a handy feature!

Evidently the Shelving feature is very popular with the Team System development group at Microsoft:

[Shelving is] amazingly simple to use and as soon as the concept 'clicks', people start seeing how handy it is. It's become wildly popular for creating "fix ready" changesets for DCRs, bugs that need approval before checkin, feature work in progress but not ready to be committed, etc. I'm not sure the typical version control user is comfortable enough with branches to deal with many such branches being out there that they might want to interact with, particularly when they may be organized along multiple lines (by user for work in progress, by feature area for DCRs and bug fixes, perhaps).

Shelving in Team System is equivalent to creating a private branch in Subversion, as outlined in this post by Mike Mason:

  • Whilst working on adding the new “frobscottle” feature Alice decides she’d like to shelve her current working copy changes. Her project is checked out from svn://svn.acme.com/project/trunk.
  • Needing somewhere to store her changes, Alice branches the trunk to create svn://svn.acme.com/project/shelves/alice/frobscottle.
  • Alice uses the Subversion switch command to switch her working copy from the trunk to the new frobscottle branch. When switching, Subversion preserves any changes you’ve made to the working copy.
  • Alice checks in her working copy. The changes will be safely stored under the shelves directory.
  • Alice switches her working copy back to the trunk and works on something else. In future if she wants the shelved frobscottle changes she can merge from the branch to her trunk working copy, then commit the changes back into the main code line.

As you can see, Subversion relies pretty heavily on path conventions, such as

/project/trunk
/project/trunk/shelves/
/project/trunk/shelves/username/

When you set up a project in Subversion, you're supposed to manually create these root-level folders:

/project/trunk
/project/tags
/project/branches

Trunk is where the main body of your project code goes; tags and branches are simply straight copies of the tree with labels attached.

posted on Wednesday, January 18, 2006 11:01 AM by jatwood

Comments

# TFS Source Control using the Console

I was helping out a fellow co-worker today to figure out a Team System problem when I found out that...
Thursday, January 19, 2006 5:34 PM by Team System

# re: Shelving and Branching

Is there in TFS something similar to PATCHs (SVN)?

The article is extremely clear :)

Thanks,
Thursday, May 18, 2006 5:46 PM by Maxi Menasches

# re: Shelving and Branching

uh, from the example you gave above, the 'shelves' subfolder seems to be a direct child of the project folder. So the directory structure should look like this instead:
/project/trunk
/project/tags
/project/branches
/project/shelves
/project/shelves/username

perhaps a minor point, but i find it a cleaner structure
Wednesday, December 20, 2006 7:38 PM by swirl

# re: Shelving and Branching

Is it possible to do a teambuild based on shelf sets?
Thursday, March 08, 2007 1:10 PM by Jamfish

# TFS a práce offline

Začali jsme v jednom projektu používat TFS a velmi mě překvapilo, když jsem se dozvěděl, že TFS nepodporuje
Friday, November 09, 2007 10:49 AM by ernestovo zákoutí

# TFS a práce offline

Začali jsme v jednom projektu používat TFS a velmi mě překvapilo, když jsem se dozvěděl, že TFS nepodporuje
Tuesday, November 13, 2007 7:52 AM by ernestovo zákoutí