History: Confronting your Past

[article]

was applied by our automated build system when it made build 2752.)

Admonishments on the Evils of "Label Promotion"

Sometimes after you apply a label you realize that you want to make a small change.  As an example, consider the following scenario:  One week ago, you finalized the code for the 4.0 release of your product.  You applied a label to the tree, and your team has proceeded with development on a few post-4.0 tasks.

But now Bob (one of your QA guys) comes crawling into your office.  His clothes are torn and his face is covered with soot.  While gasping for air he informs you that he has found a potential showstopper bug in the 4.0 release candidate.  Apparently if you are running your app on the Elbonian version of Windows NT 3.5 with the time zone set to Pacific Standard Time and you enter a page margin size of 57 inches while printing a 42 page document on a Sunday morning before 9am, the whole machine locks up.  In fact, if you don't quickly kill the app, the computer will soon burst into flame. 

As Bob finishes explaining the situation, a developer walks in and announces that he has already found the fix for this bug, and it affects only one line of code in FOO.CPP.  Should he make the fix and generate a new release candidate?

After scolding Bob for not being more diligent in finding this bug sooner, you begrudgingly decide that the severity of this bug does indeed make it a showstopper for the 4.0 release.  But how to proceed?  The label for the 4.0 build has already been applied.  You want a new release candidate which contains exactly the contents of the 4.0 label plus this one-line change.  None of the other stuff which has been checkin in during the past week should be included.

I'm sure it was this very situation which prompted Microsoft to implement a feature in SourceSafe 6.0 called "label promotion."  The idea is that a minor change to a label can be made after it was originally created.  Returning to our example, let's suppose that the 4.0 label contained version 6 of FOO.CPP.  So now we would make the one-line change and check it in, resulting in version 7 of that file.  Then we "promote" version 7 of the file to be included in the 4.0 label, instead of version 6.

Best Practice: Avoid Using Label Promotion
Your repository should contain an accurate reflection of what really happened. Don't use label promotion. If you must, do at least try to feel guilty about it.

Personally I think "label promotion" is a terrible name for this feature.  In fact, I think label promotion is a terrible feature.  I am doctrinally opposed to any SCM feature which allows the user to alter the historical record.  The history of the repository should be a complete record of what really happened.  If we use label promotion in this situation, there will be no record of the fact that the original 4.0 release candidate actually contained version 6 of that file.  In situations where label promotion seems necessary, a fanatical purist like me would just create a new branch, which is a topic I will discuss in the next chapter.

However, even though I dislike this feature for philosophical reasons, customers really want it.  Here at SourceGear, I tell people that "the customer is not always right, but the customer is always the customer."  So in order to remain true to our goal of making Vault a painless transition from SourceSafe, we implemented label promotion. 

About the author

TechWell Contributor's picture TechWell Contributor

The opinions and positions expressed within these guest posts are those of the author alone and do not represent those of the TechWell Community Sites. Guest authors represent that they have the right to distribute this content and that such content is not violating the legal rights of others. If you would like to contribute content to a TechWell Community Site, email editors@techwell.com.

AgileConnection is one of the growing communities of the TechWell network.

Featuring fresh, insightful stories, TechWell.com is the place to go for what is happening in software development and delivery.  Join the conversation now!

Upcoming Events

Nov 09
Nov 09
Apr 13
May 03