Who made that change?


When I am working in a large team, particularly when I am investigating reported defects, I find myself looking at someone else’s code and thinking “Who made that change?”, or “Why on earth did they do it that way?”

Now I know that code should be self-documenting, and where it isn’t, a helpful, up-to-date comment should be there illuminating what was done and why.  But I also live in the real world where that is not always the case.  Sometimes it is helpful to chase down the developer that made the change and ask the question, or at least look at the rest of the changeset to see the context in which the change was made.

Fortunately there are two features in VS2010 that assist with this.

The first is “Annotate”.  Those of you who have used Subversion will be familiar with svn blame.  Well, ‘Annotate’ is TFS’s version.  It will show you when the line of code changed and who made the change, and the changeset it was associated with.  The changeset number is a hyperlink.  When you select this, the changest check-in window loads showing all the files associated with the changeset, and any comments the developer supplied with the commit. There's more information on this over on MSDN (http://msdn.microsoft.com/en-us/library/bb385979.aspx)



There are 3 ways of launching this:
1. Visual Studio Solution Explorer
Select the file, right-click, select ‘Annotate’

2. Visual Studio Team Explorer
Select 'Source Control'  browse to the file in question, right click on the file and select "Annotate".

3. Command Prompt
>tfpt annotate

File path to tfpt exe if needed:
C:\Program Files\Visual Studio 2005 SDK\2006.03\VisualStudioTeamSystemIntegration\Utilities\Team Foundation Power Toys

Simply click on a line to see the details.

Comments