Shelving and Unshelving– A source control option with some practical usage.


In TFS version control sub-system, there is a feature for Shelving and Unshelving your pending changes. This is quite a useful operation in source control with a variety of applications. In this blog I will show some scenarios where this operation can be helpful.

Picture yourself in your day-to-day work. And your Boss comes to you when you are really in “The Zone” (I use this term referring to a time-frame when my productivity for the day is the highest, when I am able to code what I think, and more importantly when I don’t like to be disturbed while coding). So  you Boss is at your desk and you have the following conversations:

Scenario :

Boss: “Hey I have got this new feature which I want you to start off immediately.”

You: “Yes, but I am in middle of the feature you already said is most important.” Surprised smile

Boss: “Yes, that’s true, but this new one is more important than the one you are doing.” Sarcastic smile

You: (Thinking I don't know smile) 1

Boss: “Please stop everything, and do what I say.”

You:(Thinking I don't know smile )  2

Boss: “If possible take help of other senior developers too, and try to do it by the end of the day.”

You: (Thinking I don't know smile) 3

You are Thinking Part 1: While you are thinking, your boss has already overruled your current work. He has prioritized your existing work, he also didn’t tell what to do of the work done so far (you are at this point when you are thinking for the first time). You are trying to understand the new work in front of you and trying to find a possible solution.

You are Thinking Part 2: When your Boss says “stop everything”, you are at point 2 thinking what will happen to work done so far. I don’t remember whatever I changed (considering I don’t use any version control). I need to revert back to a state where everything was working fine, and then code the new requirement (More Important than the Most Important).

You are Thinking Part 3: When your Boss says “take help from senior developers”, you are really in mayhem. How would you do that? The senior developer might not have anything related to the new development. How will he do my code review? How will I.. And you are in a endless thought process.

This is what happens when your Boss leaves,

You: @#$@#$#%@#%@#$%@#$%@#$%@#$%@#$%@#$%

Ok, there is a way out if you are using version control in TFS. TFS provides what is called as Shelving (put whatever you changed in a cold box), and Unshelving (take out stuff form cold box and continue). It is just like you hibernate your OS, it remembers all the state you were in and then when you reconnect back all the programs are open.

For more information on shelving, and unshelving read the following link:

http://msdn.microsoft.com/en-us/library/ms181404(v=vs.80).aspx

Now when you are empowered with this new information, let’s see how your conversation would be:

Updated Scenario :

Boss: “Hey I have got this new feature which I want you to start off immediately.”

You: “Yes, but I am in middle of the feature you already said is most important.” Surprised smile

Boss: “Yes, that’s true, but this new one is more important than the one you are doing.” Sarcastic smile

You: (Thinking I don't know smile) 1 (You have the liberty to think without worrying about How would I questions !!!)

Boss: “Please stop everything, and do what I say.”

You:(Thinking Winking smile ) 2 (You can shelve your changes and get the version which was running just fine before you started to implement this feature.)

Boss: “If possible take help of other senior developers too, and try to do it by the end of the day.”

You: (Thinking Winking smile) 3 (You can shelve the changes for review with your senior developers, who can unshelve and do a code review for you.)

Note: The TFS build system also allows to execute a shelveset merged with the sources present on the server. By doing so you can verify the integrity of the shelveset with respect to your stable version of the source code.

Conclusion: Shelving and Unshelving are really powerful features of the TFS version control system. They save a lot of time from code backup nightmares, working on prototypes, sharing your source code for code-reviews, suspending and resuming code activities. Fortunately, the version control plug-in from To-Increase for Microsoft Dynamics NAV enables the developers to perform Shelving and Unshelving, contact To-Increase for a demo and unleash the power of version control for Microsoft Dynamics NAV.

Advertisements
This entry was posted in Agile Software Development and tagged , , , , on by .

About ssmantha

A Technologist and Evangelist, with more than 9 years of extensive experience in Microsoft and related Technologies. Working as Technical Solution Architect in To-Increase India since Sep 2006 Role - Technical Solution Architect responsible for creating cutting edge solutions in the Microsoft Dynamics Ax and NAV using .Net framework. Satya enjoys work involving implementation and integration of .NET and related Microsoft Technologies including Microsoft Dynamics AX and NAV, apart from playing around with new software technologies. He successfully built development tools which assists ERP teams to develop better solutions using Agile Practices. Using TFS 2010, Visual Studio 2010 he integrated the Development Processes with the Microsoft Dynamics Ax and NAV. By automating the development processes using the tools and technology, he was able to educate the practices, which in turn is helping people focus more on building innovative products rather than maintaining them. His latest work include a successful integration of ERP on Cloud, a pretty stable integration interface to a third party vendor. Another feather in his cap, automating TFS builds for Dynamics Suite of products on both AX and NAV. He is currently focusing on technologies surrounding ERP on cloud, Mobile Connectivity, XRM 2011 and many more. His areas of interest also include helping Development Teams work in a more structured way using Agile practices. Currently, Satya is working on the a Next-Generation of Business Integration Solutions for Microsoft Dynamics NAV 2013. Using industry proven architecture, he and his team are working on simplifying the domain of integration. Some key work areas he contributed on, Document Processor, Created a Data Model Mapping language and compiler working in tandem with XSLT transformation, and modular Integration Pipeline Architecture design.

2 thoughts on “Shelving and Unshelving– A source control option with some practical usage.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s