Annotate (also known as blame) is now a power toy

[UPDATE 8/9/2007]  I fixed the broken link to power tools page. 

[UPDATE 9/8/2006]  TFPT is now available in its own small download:!  You no longer need to download the VS SDK.  You can find more information about the September '06 release here.

One of the features that we had to cut for version 1 was annotate, which is also known as blame in Subversion.  We had hoped to provide a power toy that at least provided the basics, and the Visual Studio 2005 SDK – March 2006 CTP for v2 contains an updated tfpt.exe with support for annotate.

Written by Justin, a developer working primarily on the version control server, annotate downloads every version of a particular file and annotates the output with attributes showing the changeset, date, and user who last changed each line in the file.  The current implementation does not show deleted lines.

Most of the time, you will likely run tfpt annotate filename to bring up the viewer, but you can also specify /noprompt to get console output.  The optional version provides the ability to see changes up to the specified version.  Here is the help text.

C:Program FilesVisual Studio 2005 SDK2006.03VisualStudioTeamSystemIntegrationUtilitiesTeam Foundation Power Toys>tfpt annotate /?
tfpt annotate - Display line-by-line change information for a file

Displays the given version of a file along with information
on who modified the line last.

Usage: tfpt annotate [/noprompt] filespec[;versionspec]

 filespec               Server or local path of file to view history of.
 /noprompt              Prints interleaved output to console instead of GUI.

The annotate viewer is shown in a screenshot below.  By default, the content viewer displays only the changeset number.  You can use the View menu to display the user name and date, as I have.

When this screenshot was captured, I had selected the line that prints the output.  As a result, the changeset information on the left hand side shows some of the changeset information, including the comment.  If I had associated or resolved a work item when checking in, that work item would be displayed in the Work Items list.

Finally, the Edit menu gives you the ability to search and go to a particular line number.

This annotate implementation provides the basics, and it will likely whet your appetite for more.  While this power toy is not likely to get more features, we are certainly interested in your feedback for what you would like to see in the shipping product.


Comments (9)
  1. Keith J. Farmer says:

    Neat, but something like this should be in the IDE…

  2. buckh says:

    Keith, you’re right.  Another person on the team has been working on exactly that.  Stay tuned.

  3. Rob Caron blogs about Notion Solutions on Team System.

    Eric Jarvi gives us another VSTS Tip: Visual…

  4. Those who are used to working with Subversion know the great tool the blame command is:…

  5. Keith Hill says:

    Cool but why is it so slow?  I ran it on a file and it took about 15-20 minutes to pop up the GUI.  BTW this is on a project we ported over from another version control system and this particular file probably has about 400 changesets on it.

  6. buckh says:

    Yes, it can be slow.  Because the internal diff engine doesn’t support some encodings, one of which is UTF-8, the current implementation converts all of the files to UTF-16 before sending them through the diff engine.  Unfortunately, the internal diff engine is much slower when processing UTF-16 as compared to a single-byte code page, such as Windows 1252.

    We’re hoping to modify the code to skip the conversion if the versions being compared are in an encoding that is supported by the diff engine, rather than blindly convert everything.

  7. Here’s one more collection of links.  It took me quite a while, and I threw out 90% of the links…

  8. Peter H. says:

    Annotate currently shows "who put the code there in what version".  For propper change management an option to show "who removed code in what version" would be beneficial.

    Example 1: Let’s say there is bug in a function that was caused by removing some code and somebody investigates when the bug was intrduced then current Annotate will not help.

    Annotate could have an option to show deleted lines in the interleaved output including the version in which the line was deleted.

    Other leading source control system do have this option.


  9. buckh says:

    Peter, we’ll make sure that gets added to the feature backlog.

    Thanks for the feedback.


Comments are closed.

Skip to main content