Why TFS labels aren't like SourceSafe labels
I’m keeping my eye out for reasonable “short” blog topics as all of mine seem to be pretty long 🙂 There was a question today on one of our internal aliases about why labels in TFS don’t show up in the history display the way they do in SourceSafe. The originator was under the impression that labels were not available in the UI. Here’s my response: You can get labels in the UI although not in history. When in the Source Control Explorer, you can use File -> Source Control -> Labels -> Find Label. The difference with SourceSafe is that they are not included in the history. There’s a good reason for this. Labels in SourceSafe were always “point in time” labels. You generally labeled some tree at some point in time and that implied a label of all of the contents of the tree at the same point in time. In this respect it is reasonable to display labels in time sequence with history. Everything before it in the list is in the label and everything after it is not. This works for a significant percentage of label uses (and is a convenient way to think of them) but not all. In Team Foundation, labels are more powerful. Instead of being a single point in time, they are able to have versions of each file in the label from different points in time. The canonical scenario is that you label a build and then find some bugs and want to go back change the versions of a few of the files (either omitting changes that introduced bugs or adding changes that fixed bugs). Now the label does not represent a point in time, but rather a collection of points in time. This makes it very hard to display it in a list mixed with change sets because there is not “correct” ordering of the list. As a result we treat the list of changesets and the list of labels separately.
I’m not comfortable that we’ve made this discoverable enough or done enough to enable exploring and manipulating labels yet but that’s a basic explanation why we can’t just do what SourceSafe does. Expect in future versions to see us improve upon the user experience around these.