GetLatest

If you are having a problem using Vault, post a message here.

Moderator: SourceGear

Post Reply
EXODUS

GetLatest

Post by EXODUS » Fri Sep 10, 2004 12:22 am

I Have create a wrapped to handle some of the function call to the vault api.

The wrapper was written in c#.

I have written a small app in delphi which access the vault api throught the c# wrapper that I create.

I'm having problem with the GetLatest procedure.

e.g

In vault I have a filename "File1.txt",
now I rename the file "File1.txt" into "File2.txt"

so now. my local working folder I do not have the file " File2.txt",

now I do a Getlatest to retrieve the file "File2.txt",

now I then CheckOut the "File2.txt"

and the state has become "Need Merge",


the weird thing is. why is this happen. Even thought the file was created.
Even when the file did not exist in teh local working folder.

Is this a bug with the api.?

or I'm not call the GetLatest rite.

here is the code in C# which get teh latest from Vault.

-----------------------------------------------

VaultClientFile LFile = AClient.TreeCache.Repository.Root.FindFileRecursive(AFileName);
AClient.GetToNonWorkingFolder(LFile, true, true, MakeWritableType.MakeAllFilesReadOnly, SetFileTimeType.Modification, LVaultFolder, ALocalFolder, null);

-----------------------------------------------

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

Post by jeremy_sg » Fri Sep 10, 2004 7:28 am

The problem is that you're calling GetToNonWorkingFolder, which will not update the state information. Use the regulart Get method instead.

EXODUS

Post by EXODUS » Sun Jun 05, 2005 11:20 pm

when I try to used the Get

I get this error message
-------
An unhandled exception of type 'VaultClientOperationsLib.GetLatestVersionFailedException' occurred in vaultclientoperationslib.dll
-------

this is the function I use
-------
private void GetFile(ClientInstance AClient, string ARepositoryPath, string AObjectName)
{
string LTempStr = "";
if(AClient.TreeCache.Repository.Root.FindFileRecursive(ARepositoryPath + FolderTree.PathSeparator + AObjectName) != null)
{
AClient.Refresh();
VaultClientFile LFile = AClient.TreeCache.Repository.Root.FindFileRecursive(ARepositoryPath + FolderTree.PathSeparator + AObjectName);
AClient.Get(LFile, true, MakeWritableType.MakeAllFilesWritable, SetFileTimeType.CheckIn, MergeType.OverwriteWorkingCopy, null);
LTempStr = "Getlastest successfully";
}
else
{
LTempStr = "File not found: " + AObjectName + "\n\nPlease verify that this file exists" + " and that the path is correct.";
}
MessageEdit.AppendText(LTempStr + "\n");
}
-------

Post Reply