How to view tree from history

Post your questions regarding using the Vault and Fortress API in your programs.

Moderator: SourceGear

Post Reply
HakanL
Posts: 6
Joined: Wed Feb 20, 2008 2:05 am

Post by HakanL » Mon Jul 21, 2008 5:53 pm

I need to get the full tree (under a specified path) for a particular version in the history. For example let's say that folder $/A latest version is 200. $/A has files and subfolders. I'd like to view the complete file structure for what it looked like at version 100. I've found the ProcessCommandGetVersion which gets the files to the local disk, but I just want to view it, I don't want to actually get the files. What I'm looking for is what's in the Vault Client under Version History, View Tree. How can I do that in the API?

Thanks,
/Hakan

shannon

Post by shannon » Tue Jul 22, 2008 7:47 am

There's no way to easily bring up any of our GUI components, because we haven't released an API for doing graphical operations in Vault.

You want to run your version history command on the folder, then run this command:

ClientInstance.Connection.GetBranchStructure(ClientInstance.ActiveRepositoryID, strObjName, vtxhi.ID, vtxhi.Version, ref vfd, true);

where vtxhi is the VaultTxHistoryItem from your ProcessCommandVersionHistory and vfd is going to be a VaultFolderDelta for the version you wanted.

Construct a VaultClientFolder like this:
VaultClientFolder vcfolder = new VaultClientFolder(vfd, null);

Then you just construct your tree from vcfolder (loop over it's child files and folders recursively).

HakanL
Posts: 6
Joined: Wed Feb 20, 2008 2:05 am

Post by HakanL » Fri Jul 25, 2008 2:07 pm

Excellent, just what I needed. I'm not interested in bringing up the GUI, I want to do it in code, so this is perfect. I haven't had a chance to test it yet, but if I have any further problems I'll let you know.

Thanks!
/Hakan

Post Reply