Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Export TFS 2010 History to Excel or Text Document

Tags:

How do you export history from TFS 2010 that includes the user, date and the complete comment (not truncated)?

For example, in Team Explorer: right-click team member name > show check-in history. This will bring up the user's check-in history, but the comments are truncated.

like image 426
Metro Smurf Avatar asked Apr 23 '12 14:04

Metro Smurf


2 Answers

You have 3 options here:

  1. Parse output from the tf.exe history command.
  2. Write code against the TFS client object model.
  3. Write a query directly against the TFS database.

Number 1 is probably the easiest so I'll start with that. You can read the documentation for the tf history command here. In order to get the comment non-truncated you will need to use the /format:detailed option. If you want all of the history, try something like this:

tf history $/ /r /format:detailed /noprompt

If you are looking for all of the changesets for a given user, try this:

tf history $/ /r /format:detailed /user: /noprompt

That will produce a fair amount of text output that you would need to parse to be able to put it into excel. Give that a shot and if you are interested in options 2 or 3 let me know and I can give you more details.

like image 111
Taylor Lafrinere Avatar answered Sep 23 '22 12:09

Taylor Lafrinere


The easiest way is to connect to the TFSWharehouse from excel, then pull the data from the source control history in a excel sheet. This is really simple and very powerful.

You'll find useful info here: http://www.woodwardweb.com/vsts/getting_started.html

Edit:

Using the TFS API to enumerate the changesets when you don't have access to SSAS (e.g. tfspreview.com for instance):

TeamProjectPicker tpp = new TeamProjectPicker(TeamProjectPickerMode.SingleProject, true); tpp.ShowDialog();  var tpc = tpp.SelectedTeamProjectCollection;  VersionControlServer versionControl = tpc.GetService<VersionControlServer>();  var tp = versionControl.GetTeamProject("MyTeamProject"); var path = tp.ServerItem;  var q = versionControl.QueryHistory(path, VersionSpec.Latest, 0, RecursionType.Full, null, new ChangesetVersionSpec(1), VersionSpec.Latest, Int32.MaxValue, false, true, false, false);  foreach (Changeset cs in q) {     var user = cs.Owner;     var comment = cs.Comment;     var date = cs.CreationDate;      Debug.WriteLine(string.Format("[{3}] Date: {0}, User: {1}, Comment {2}", date, user, comment, cs.ChangesetId)); } 
like image 39
Nock Avatar answered Sep 23 '22 12:09

Nock