Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get the full folder history from TFS programmatically?

Tags:

c#

tfs

I have a folder under TFS source control system, let's say under "$/My Project/Branches/Dev" path.

It was just recently moved from another location, which was "$/My Project/Dev".

Now when I request its history from the Source Control Explorer in VS I get the full history, where the described move operation was just one of the changesets.

But when I try to get the history using TFS SDK I only get the recent history started with the move of the folder. How can I get the full history?

I'm using the following code:

    TeamFoundationServer tfs = TeamFoundationServerFactory.GetServer(tfsServerURL);
    VersionControlServer vcs = (VersionControlServer)tfs.GetService(typeof(VersionControlServer));

    // Null means All
    VersionSpec versionFrom = null;

    System.Collections.IEnumerable enumerable = vcs.QueryHistory(_tfsPath,
          VersionSpec.Latest,
          0,
          RecursionType.Full,
          "",
          versionFrom,
          VersionSpec.Latest,
          Int32.MaxValue,
          true,
          true);
like image 379
Max Galkin Avatar asked Jun 22 '09 12:06

Max Galkin


1 Answers

You are passing slotMode = true. Change the final parameter to false.

"Slot mode" means "query by path, not by history." It's useful if you only remember the old name of an item but not where you moved it to, or if >1 item has occupied a given path.

For future reference, if you want to see what parameters VS (or tf.exe) is passing to the server so you can mimic them, turn on tracing.

like image 171
Richard Berg Avatar answered Oct 17 '22 02:10

Richard Berg