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 thoughts on “TFS: Automatically insert Check-In comments into source-code

  1. Matt

    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. Pingback: Jochen Kalmbach’s Blog » Blog Archive » $log$ substitution check-in policy published

  3. Pingback: Keyword Expansion Check-in Policy on CodePlex | Coded Style

  4. Pingback: Keyword Expansion Check-in Policy on CodePlex | PHP Scribe

  5. Pingback: New check-in policy for VSS fans: keywords expanded | Coded Style

  6. Christian

    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 🙂

  7. jkalmbach Post author

    Hi!

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

  8. Christian

    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…

Comments are closed.