Get local version value

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

Moderator: SourceGear

Post Reply
smartbear
Posts: 38
Joined: Thu Jan 24, 2008 10:13 am
Contact:

Get local version value

Post by smartbear » Mon Sep 27, 2010 1:51 pm

I have a local file at version 3, and the repository version is 4 having been rolled back to 2. Viewing the folder with the Vault GUI client shows that file with Local Version 3 and Remote Version 4, and getting the File Properties also shows Version 3 for the "Local copy" and Version 4 for the "Latest in Repository". How do I find out the local version of the file is 3? FindVaultTreeObjectAtReposOrLocalPath or FindVaultFileAtReposOrLocalPath with the local filename both return the repository version of the file.

Thanks,
Eric

Beth
Posts: 8550
Joined: Wed Jun 21, 2006 8:24 pm
Location: SourceGear
Contact:

Re: Get local version value

Post by Beth » Mon Sep 27, 2010 3:44 pm

You could try to check the version of the VaultClientFile from ClientInstance.TreeCache.Repository.Root.FindFileRecursive($/A/B/.../file).
Beth Kieler
SourceGear Technical Support

smartbear
Posts: 38
Joined: Thu Jan 24, 2008 10:13 am
Contact:

Re: Get local version value

Post by smartbear » Thu Oct 07, 2010 10:16 am

It didn't work - returns the same item as RepositoryUtil.FindVaultFileAtReposOrLocalPath(path), and has the repository version of the file, not the local version. Can you find out how the Vault client determines the local version?

Beth
Posts: 8550
Joined: Wed Jun 21, 2006 8:24 pm
Location: SourceGear
Contact:

Re: Get local version value

Post by Beth » Thu Oct 07, 2010 1:22 pm

What happens if you try something like the following?

Using the VaultClientFile's parent folder to get a working folder:

VaultClientFile f = ... <some file> ...; if ((f != null) && (f.Parent != null)) {
WorkingFolder wf = ClientInstace.TreeCache.GetBestWorkingFolder(f.Parent);

if (wf != null)
long nLocalVersion = wf.GetBaselineVersion(f); }
Beth Kieler
SourceGear Technical Support

Post Reply