Answered Injecting variables into checked-out source code

  • Thursday, August 16, 2012 4:32 PM
     
     

    Is there a way to automatically inject "variables" into the comments of source code upon checkout?  I'm interested in things like:

    -- revision number

    -- change history

    -- copyright date


    John Lilley CTO DataLever Corporation

All Replies

  • Friday, August 17, 2012 3:06 AM
    Moderator
     
     

    Hi John, 

    Thanks for your post.

    Do you mean that you want to inject the  Revision number, Change History and Copyright date as the variables into Check Out windows? Or when the source files be checked out, display that variables as the columns in Source Control Explorer?

    If misunderstood anything, please describe your question in more detail and we will be able to provide the better responses.


    John Qiao [MSFT]
    MSDN Community Support | Feedback to us

  • Friday, August 17, 2012 1:22 PM
     
     

    I mean that I want to be able to automatically embed information into the comments of the source files themselves as they are checked out, for example:

    // Copyright (C) <years> <company>.  All rights reserved.

    // Revision: <revision number>

    // Checkout date: <checkout date>

    // Modification history:

    // <revision1>: <date1>, <comment1>

    // <revision2>: <date2>, <comment2>

    etc


    John Lilley CTO DataLever Corporation

  • Saturday, August 18, 2012 1:28 PM
     
     Answered

    Hi,

    you could use TFS Checkout event and parse files that are checked out. You can find an usefull example how to use checkout event here: http://code.msdn.microsoft.com/windowsdesktop/CSTFSAddCheckOutEventType-673d0536

    I hope it will help you

    Regards,

    Ivan


    Ivan Kardum
    PMP, MCSD, MCPD, MCTS:TFS
    Blog: Kardum Software Development Storyboard
    Please remember to click “Mark as Answer” on the post that helps you.