locked
List of changed files for a date period?

    Question

  •  

    I want to get a list of changed files for a specified date period and path within TFS 2008.  I'd like to be able to submit a query with something like:

     

    Give me the full list of files in the $/Path, changed between 01/01/2008 and 01/28/2008, that match *.sql.  I can do this using TfsWarehouse and the Code Churn table, but I am writing direct SQL queries against this, which I'd like to avoid.  Is there another way of going about doing this?

     

    Here is the SQL:

     

    Code Snippet

    SELECT d.[File Path], MAX(a.[Date]) as 'LastChanged'
    FROM [Code Churn] a
     --INNER JOIN [Work Item Changeset] b ON a.[Changeset] = b.[Changeset]
    -- INNER JOIN [Team Project] c ON b.[Team Project] = c.[__ID] --AND c.[Team Project] = 'project'
     INNER JOIN [File] d ON a.[Filename] = d.[__ID]
    WHERE a.[Date] BETWEEN @startDate AND @endDate
      AND d.[File Extension] = case when @FileExtensionFilter = '' then d.[File Extension] else '.'+@FileExtensionFiltermailto:'.'+@FileExtensionFilter">'.'+@FileExtensionFilter</A< A>> end
      AND d.[File Path] LIKE '$/' + @filepath +'%'
    GROUP BY d.[File], d.[File Path]
    ORDER BY d.[File Path]

     

     

    Tuesday, January 29, 2008 4:35 PM

Answers

  • You are correct that you should avoid querying the SQL store for TFS.  Here is how to do what you want using the "tf foldediff" command in TFS2008:-

    tf folderdiff -r $/FilePath;D2008-01-01T00:00 $/FilePath;T /noprompt /server:http://tfsserver:8080

    Where "*/FilePath" is the path that you want and the version is after the ";".  Note in the example above I am saying compare a date with latest (T) - but you could compare two dates, changesets, labels etc.

    For more information see http://msdn2.microsoft.com/en-us/library/bb385992.aspx




    Wednesday, January 30, 2008 1:38 PM
    Moderator
  • I don't know how you feel about using 3rd party tools, but the Status Sidekick (part of the Team Foundation Sidekicks from Attrice) should be able to do this for you.

     

    It's free, and very handy.

     

    Chris

     

    Wednesday, January 30, 2008 7:13 PM

All replies

  • You are correct that you should avoid querying the SQL store for TFS.  Here is how to do what you want using the "tf foldediff" command in TFS2008:-

    tf folderdiff -r $/FilePath;D2008-01-01T00:00 $/FilePath;T /noprompt /server:http://tfsserver:8080

    Where "*/FilePath" is the path that you want and the version is after the ";".  Note in the example above I am saying compare a date with latest (T) - but you could compare two dates, changesets, labels etc.

    For more information see http://msdn2.microsoft.com/en-us/library/bb385992.aspx




    Wednesday, January 30, 2008 1:38 PM
    Moderator
  • I don't know how you feel about using 3rd party tools, but the Status Sidekick (part of the Team Foundation Sidekicks from Attrice) should be able to do this for you.

     

    It's free, and very handy.

     

    Chris

     

    Wednesday, January 30, 2008 7:13 PM
  • This is probably not what you want.
    But, I came across this page while trying to find all the files I've modified between 2 dates.

    All I needed to do is:
    1. Go to the 'Source Control Explorer'
    2. Right-click on the folder you want to compare, and choose compare.
    3. Change the source version type to 'Date' and specify the start-date
    4. Change the target path to point to the same folder as the source path (i.e. the server-path)
    5. Change the target version type to Date and specify the end-date
    Hope this helps someone.
    • Proposed as answer by JeffGWM Wednesday, December 30, 2009 3:55 PM
    Friday, August 14, 2009 10:16 AM
  • That helps big time!. Just wanted to find out if we want to get the latest of these files (along with the folder structure) in one shot is there a quick way?

    Sam

     

    • Proposed as answer by Sam_MSN Thursday, July 08, 2010 8:07 PM
    Thursday, July 08, 2010 7:25 PM
  • This is probably not what you want.
    But, I came across this page while trying to find all the files I've modified between 2 dates.

    All I needed to do is:
    1. Go to the 'Source Control Explorer'
    2. Right-click on the folder you want to compare, and choose compare.
    3. Change the source version type to 'Date' and specify the start-date
    4. Change the target path to point to the same folder as the source path (i.e. the server-path)
    5. Change the target version type to Date and specify the end-date
    Hope this helps someone.

    This is the easiest way! You can even paste it into Excel for documentation purposes.


    • Edited by Xeromal2 Wednesday, May 09, 2012 5:07 PM
    Wednesday, May 09, 2012 5:06 PM