Am I an expert? Nah, but I play one on the Internet!

My Resume

Affiliations

Friday, September 4, 2009

Many development shops have the requirement to associate any code changes to a backlog item or defect to help track the time and energy spent working against a particular featureset. This need is so prevelant, that the awesome TortoiseSVN Windows Explorer Subversion extension actually has some special settings you can use to help make your life a little easier.

Generally when demoing something like this, I like to show the finished result and then jump back to the beginning and follow the whole process step-by-step, but I’m going to break stride with this post. I’m just gonna do it. Here it goes:

How do you associate a backlog item/bug/issue ID with a check-in?

Add the “bugtraq:message” property to the root folder of your repository, and set it to something like “Backlog ID: %BUGID%”.

Yep, that’s it. I know - crazy, right? Next time you go to check in, you’ll see something like this:

NOTE

For those of you who have never used Subversion properties, the easiest way to add one is to right-click on your Subversion folder, then select “TortoiseSVN > Properties” which will bring you to the dialog where you can add and edit your Subversion properties. All of the features I discuss in this post are unlocked using these properties.

Then, after filling in a value for the Backlog ID and hitting OK to complete the check-in, you can visit the history logs and see that TortoiseSVN has oh-so-nicely inserted the Backlog ID into your checkin comment for you, like so:

Some of you might be thinking, “But hey – I could have just typed that myself!” Yeah, sure – if you wanna waste a bunch of time typing the same thing in every comment, this probably won’t be of much help to you… but wait – there’s more!

Make that integration experience a little bit nicer

For those of you who were underwhelmed with the first section, let’s dive a little deeper and check out some of the other bug tracking properties that TortoiseSVN has made available to us that allow us to customize this behavior:

bugtraq:url – now this is the stuff you’ve been waiting for! If you set this property with a URL pattern containing the %BUGID% placeholder, TortoiseSVN will be nice enough to turn those nifty little messages into direct links to your issue tracking system! Naturally, this link will be different for every issue tracking system, but assuming your system allows you link directly to an issue via it’s ID, this is a pretty sweet option. Here’s an example:
By setting the bugtraq:url property to “http://myversioncontrol/issues/%BUGID%”, my previous history message (shown below) now contains a link directly into my issue tracking system!

bugtraq:warnifnoissue – this awesome setting tells Tortoise to yell at the dev (shown to the right) if they haven’t provided an Issue #. It’s purely a client-side setting and provides no server-side validation so it’s not going to force the users to associate an issue #, but it sure is a nice reminder.
Note: If you really want to perform server-side validation, stay tuned – a post on that topic should be coming up soon!

bugtraq:append – if you’re like me and want the backlog/issue ID right at the beginning of the message instead of the end, you can set the “bugtraq:append” property to “false” so it prepends the ID snippet to the beginning of the log message instead of appending it to the end (as is the default behavior shown earlier).

bugtraq:label – if you go waaay back to the first screenshot in this post, you’ll see that the label for the Backlog ID input box had the awkward default value of “Bug-ID / Issue-Nr:” This bugged the heck out of me, and I wanted to change it to match my message of “Backlog ID:”, and luckily the bugtraq:label property let’s you do just that! I just set the value of bugtraq:label=Backlog ID:, and I was good to go!

Well, I hope you found these useful and that they help you in your quest to write better software. As always, if you know of a better way to do this or have any comments, suggestions, or questions, please feel free to comment below.