VersionHistoryBegin method of the VaultConnection class

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

Moderator: SourceGear

Post Reply
chris
Posts: 6
Joined: Thu May 10, 2007 8:29 pm

VersionHistoryBegin method of the VaultConnection class

Post by chris » Tue Jan 01, 2008 8:54 pm

Is there any documentation on the method and class stated above?

I'm having problem figuring out how to make use of this function. I can't retrieve the version information of the root folder that i need.

public void VersionHistoryBegin(int nRowLimit, int nRepID, long nObjID, DateTime dtBeginRange, DateTime dtEndRange, long nStartVersion, ref int nRowsRetrieved, ref string strQryToken);

What is the nObjID parameter?



I'm using the Vault 3.19 API.

jclausius
Posts: 3702
Joined: Tue Dec 16, 2003 1:17 pm
Location: SourceGear
Contact:

Post by jclausius » Tue Jan 01, 2008 9:18 pm

First you call BeginXXXQuery to start the history query on the server. The Object ID is the ID property of the item found within the tree cache.

After a successful call, you pick up the results with the Fetch method.

Since the results are cached on the server, you close the query with EndXXXQuery.
Jeff Clausius
SourceGear

mmoayyed
Posts: 26
Joined: Tue Feb 26, 2008 12:43 pm

Post by mmoayyed » Tue Feb 26, 2008 12:48 pm

Could anyone help me figure out how to call this method in VaultClientAPI_4_0_5_15922 ??

This is the signature:
public void VersionHistoryBegin(int nRowLimit, int nRepID, long nStartVersion, VaultHistoryQueryRequest hqr, ref int nRowsRetrieved, ref string strQryToken);


...and this is how I have tried to call it:

file is a VaultClientFile;


int retrieved = 0;
String token = String.Empty;

VaultHistoryQueryRequest request = new VaultHistoryQueryRequest();

request.IsFolder = false;
request.Recursive = true;
request.RepID = ActiveRepositoryID;
request.SubstringType = VaultQueryRequestSubstrings.DoNotFilter;
request.DateFilterType = VaultQueryRequestDateTypes.DoNotFilter;
request.CommentFilter = VaultQueryRequestComments.DoNotFilter;
request.TopName = file.FullPath;

moClient.Connection.VersionHistoryBegin(1, ActiveRepositoryID, file.Version, request, ref retrieved, ref token);

moClient.Connection.VersionHistoryEnd(token);

problem is, retrieved is always 0.

jeremy_sg
Posts: 1821
Joined: Thu Dec 18, 2003 11:39 am
Location: Sourcegear
Contact:

Post by jeremy_sg » Tue Feb 26, 2008 2:12 pm

If you're using 4.0, then you should be using the VaultClientIntegrationLib call for VersionHistory, which just takes simple strings and ints. For information on how to get started with IntegrationLib, see: http://support.sourcegear.com/viewforum.php?f=31

mmoayyed
Posts: 26
Joined: Tue Feb 26, 2008 12:43 pm

Post by mmoayyed » Tue Feb 26, 2008 3:39 pm

Thanks. I looked at the help and it looks like it specifically retrieves versions for a folder path. I am not sure what that means. By folder path, could that be "$/MyProject" ??

Mainly, what I am looking for is, how I can retrieve version 10 of a specific file inside a project. If my assumption above is correct, I dont think that would be the way to go. I have tried passing it the actual item path "$/MyProject/HelloWorld.cs" and it retrieves none.

I am not at all interested in the different version of a folder. I only care about the different history versions of items (files). Currently, I am retrieving the entire version list and then going through the list one by one to find the version I want. Is there an easier way to do this using VersionHistoryBegin ?

jeremy_sg
Posts: 1821
Joined: Thu Dec 18, 2003 11:39 am
Location: Sourcegear
Contact:

Post by jeremy_sg » Tue Feb 26, 2008 3:56 pm

Are you trying to get the contents of version 10, or the details of the transaction that created version 10 (date, user, etc)?

mmoayyed
Posts: 26
Joined: Tue Feb 26, 2008 12:43 pm

Post by mmoayyed » Tue Feb 26, 2008 3:57 pm

Just the details.

jeremy_sg
Posts: 1821
Joined: Thu Dec 18, 2003 11:39 am
Location: Sourcegear
Contact:

Post by jeremy_sg » Tue Feb 26, 2008 4:07 pm

You're right, VersionHistory was designed for folders. You can use normal history to get details for files. In ServerOperations.ProcessCommandHistory, you can provide a beginVersion and endVersion to limit the history query. Will that work for you?

mmoayyed
Posts: 26
Joined: Tue Feb 26, 2008 12:43 pm

Post by mmoayyed » Tue Feb 26, 2008 4:51 pm

I'll check again and will get back to you.

Thank you for your time :)

Post Reply