TFS: Automatically insert Check-In comments into source-code

TFS is in most cases very wonderfull. But if you have projects, which will also be used “outside” of the TFS environment (for example in an other subsidary without TFS access), then it has one disadvantage:
The comments for every check-in is only stored in the TFS version history.

While this is enough, if you always have access to the TFS. But if you work without TFS, then it would be helpfull if these comments are also included in the source-file (like in the old days, when we were using cvs (a feature called keyword-substitution)

I searched the web for any plugin for TFS which has almost the same features… but could not find any plugin….

So I wrote my own plugin, which at least puts the check-in comments into the source-file.
You just need to install this plugin and activate it in the “Check-In policy”.

Then your source-file will contai the comment, after you checked it in:

/*
 * $log$
 * 
 * Comment: And another test
 *          with a multiline
 *          comment...
 * User: xyz
 * DateTime: 2009-07-23 22:05:24
 * Change: edit
 * 
 * Comment: This is an test
 * User: xyz
 * DateTime: 2009-07-23 21:01:22
 * Change: add, edit
 *
 */

I can also customize (like templates) the position and contents of the comments…

If you are interested in this plugin-in, please let me know…

Just a small addition: Here is a post about “keyword expansion” and TFS; and possible side-effects:
http://blogs.msdn.com/buckh/archive/2007/07/07/keyword-expansion-in-tfs.aspx

EDIT: 2009-08-08:
Today I published my first release of the LogSubstPol on CodePlex.

9 Responses to “TFS: Automatically insert Check-In comments into source-code”

  1. Matt Says:

    Cool stuff! Would you ever consider putting this on a shared code site, like CodePlex? I’m sure there are a good number of other people that could benefit from this.

  2. Pallavi Says:

    how can I get the plugin?

  3. Jochen Kalmbach’s Blog » Blog Archive » $log$ substitution check-in policy published Says:

    […] Jochen Kalmbach’s Blog Infos about Windows development and dotNET Framework « TFS: Automatically insert Check-In comments into source-code […]

  4. Keyword Expansion Check-in Policy on CodePlex | Coded Style Says:

    […] I saw a blog post by Jochen Kalmbach where he was talking about a check-in policy he wrote to support the keyword expansion […]

  5. Keyword Expansion Check-in Policy on CodePlex | PHP Scribe Says:

    […] I saw a blog post by Jochen Kalmbach where he was talking about a check-in policy he wrote to support the keyword expansion […]

  6. New check-in policy for VSS fans: keywords expanded | Coded Style Says:

    […] voila! Two years after this post was published, there appears TFS keyword expansion checkin policy, written by Jochen Kalmbach. Jochen also published the policy on CodePlex site, under the […]

  7. Christian Says:

    Great work Jochen. I have been waiting for this plug-in since we left VSS.
    Will this work for VS 2005 and VS 2010 too? (We have C++ apps with VS2005, ASPX Apps with VS 2008 and WCF Apps with VS2010 - all in the same project :-)

  8. jkalmbach Says:

    Hi!

    It should work.. but you need to recompile it with the according VS-Version…

  9. Christian Says:

    Thx 4 the quick reply. I have it working on VS 2010 after a recompile. But VS 2005 is tough. Your code is .net 3.5 and I needed to rewrite it to 2.0 However, now I’m getting a cast exception :-( I probably added a bug somewhere. If anyone has this running on VS 2005 - any feedback would be helpful. I need to get some other work done…

Leave a Reply