Geeks With Blogs


Google My Blog

Murray Gordon Flash a-ah! Savior of the universe...

Team Foundation Version Control (TFVC) has a great feature, Shelving. 

Bottom-line: Even if your code is not working, you don’t have to check it in to make sure it’s backed up. Shelving give you the ability to store it and back it up without checking it in.

Read more about this below: 

A Paradox in Version Control

Sometimes in the development process, we end up with a paradox. For instance, a common goal in development teams is to have the most current version software checked in to the source control repository at the end of every day. The central repositories are typically backed up with greater frequency than developer workstations, and other developers may need access to the most recent code as well. The problem comes in when we also say that we don't want any code in the source control repository that will break the build or otherwise disrupt the development process. Since some complex changes will take more than a single day to perform, it can be impossible to both have code checked in daily, and also not cause difficulties for other members of the development team.

TFVC fixes this situation by introducing shelving. By using shelving, users can store intermediate versions of their files in the source control repository, on a shelf. That is, the files are on the Team Foundation Server, accessible by other users, and backed up as part of your standard backup procedures. At the same time, this shelveset is NOT part of the version-controlled application source code; you will not be blamed for breaking the build because you checked in incomplete or otherwise misaligned code. To emphasize, the changes are uploaded and stored on the server, but they are not checked in.

Shelving can be helpful for any interrupted workflow, such as when you are called back from your current V2.0 updates to work on V1.0 bugs, or even if you decide to take a vacation and need to leave your current source code tasks as-is but available to your peers. In fact, shelving is also useful for general sharing between team members. Not only can other team members access your code shelf for interrupted workflow, but also for planned activities such as code reviews and buddy tests.

Shelving with Team Foundation Version Control

Shelving can easily be performed from within Visual Studio 2005 Team System. If you are working on files that have been checked out, you can place your updates in a shelveset from various places. Right-clicking in the Solution Explorer or Source Control Explorer will provide a Shelve command in a shortcut menu; shelving and unshelving are also available through toolbar buttons on the Pending Checkin window. As shown in Figure 7, clicking the Shelve menu command provides a dialog box, allowing you to select the items to shelve, as well as providing the shelveset name and comments.

Figure 1. Shelving (click the image for a larger picture)

Retrieving changes from a shelveset is as easy as putting them there in the first place. Clicking the File menu, Source control, and then Unshelve provides a dialog box similar to the one shown in Figure 8. This menu option is also available from shortcut menus in Solution Explorer. Note that, permissions allowing, you can pull changes from shelvesets created by others almost as easily as from your own shelvesets. Simply enter the other user's name in the dialog box and click the Find button. When you actually perform the unshelving, the changes in the shelveset will be pulled into your local project so that you can continue working on them.


Figure 2. Unshelving

Posted on Thursday, September 29, 2005 4:09 PM | Back to top

Comments on this post: Team Foundation Version Control (TFVC) - Shelving

# re: Team Foundation Version Control (TFVC) - Shelving
Requesting Gravatar...
The command-line (tf.exe) also has some useful shelveset-related capability. unshelve/shelve/shelvesets are obvious, but you can also "tf diff /shelveset:foo" and "tf status /shelveset:foo" both of which are pretty useful if you want to look at the content changes or just the pending changes of a shelveset.
Left by James Manning on Oct 13, 2005 11:09 PM

# re: Team Foundation Version Control (TFVC) - Shelving
Requesting Gravatar...
Thanks for the heads up. I appreciate it James, Best, Murray
Left by Murray on Oct 24, 2005 2:05 PM

# re: Team Foundation Version Control (TFVC) - Shelving
Requesting Gravatar...
Thank you!
Left by Abel on Jun 20, 2007 4:17 PM

# re: Team Foundation Version Control (TFVC) - Shelving
Requesting Gravatar...
Thanks very much for the good description.
Left by Dhina on Nov 05, 2008 12:01 PM

# re: Team Foundation Version Control (TFVC) - Shelving
Requesting Gravatar...
So let's say I shelve my changes and leave the files checked-out, and I want a peer to get myshelveset to review my code. It is not letting the other developer get the shelveset because it wants him to have the files checked-out when he gets the shelve and the files don't allow multiple check-outs. Is there any way for them to get my shelveset other than me undoing my changes or changing the multiple check-out option?
Left by Scott on Jan 16, 2009 3:32 PM

# re: Team Foundation Version Control (TFVC) - Shelving
Requesting Gravatar...
Clear and detailed explanations.good work...
very useful!

Left by Venkat on Feb 09, 2010 5:50 AM

Your comment:
 (will show your gravatar)

Copyright © Murray Gordon | Powered by: