Subversion "Shelving"
Posted on 07. Jan, 2009 by bryan in Programming, Software Development
I had one of those moments yesterday where you get 60% of the way through fixing a problem a certain way, and then discover that there was a simpler, more elegant solution that would require 10% of the effort. Problem being, I had just written a lot of code that I didn’t necessarily want to lose forever, incase it may be useful somewhere down the road.
From my days working with Team Foundation Server I remembered the "Shelving" concept. Unfortunately, I was using Subversion, not Team Foundation Server. But isn’t a shelf really just a branch? So I figured I could do a poor-mans shelf with Subversion, and I was right. Worked great.
I was going to write up my steps to do so but decided I would do a quick Google sanity check before expending the effort. Glad I did, cause Mark Phippard did a much better job then I would have done. Kudos Mark, thanks for the excellent amount of detail.


Galaxis
21. Jul, 2009
Actually Shelving is not Branchcing; only part of the equation. Don’t forget about the merge back! THis process is clumsy and error-prone (as you’ll see from the article you link to) especially after using TFS. Subversion has a ways to go, but TFS is relatively new and MS never rests on its laurels, so the for a while, the gap (and TFS’s adoption) will probably widen.
bryan
21. Jul, 2009
I suppose the “clumsiness” is relative to your general subversion experience. Branching/merging in Subversion is widely regarded as a somewhat unkempt process. TortoiseSVN definitely does its part to simplify the process, but is it as straight-forward as TFS? Nope.
As to whether shelving is branching or not, I would argue that it is very similar, if not identical, to the concept of private branches. The difference is more semantic than functional. Similar to how tags are handled in Subversion. At the end of the day you are in effect creating a branch, but because it is within the tag parent, the semantic is that it should be read-only. With shelves in this context, yes, it is a branch, but because the branch is within /shelf the semantic dictates that it is intended to be a “parking lot” for code for an indeterminate period of time, not a traditional branch that would have additional commits.
Great comments Galaxis, thanks.