Updating a shared file

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

Moderator: SourceGear

Post Reply
dConlin
Posts: 2
Joined: Thu Jan 19, 2012 8:45 am

Updating a shared file

Post by dConlin » Thu Jan 19, 2012 9:13 am

I have code that looks something like:

Code: Select all


private void UpgradeFile(string localPath, VaultClientFolder root){

   string remotePath = m_Client.TreeCache.GetCorrespondingRepositoryPath(localPath);
           
   VaultClientFile file = root.FindFileRecursive(remotePath);           

   m_Client.Get(file, false, MakeWritableType.MakeAllFilesWritable, SetFileTimeType.Current, MergeType.Unspecified, null);                

}

Which works just dandy most of the time. However, when the file in question is a shared file, the call to FindFileRecursive returns null, presumably because the thing that is there is a "soft link" rather than a "real" file. Is there a nice way to fix this?

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

Re: Updating a shared file

Post by Beth » Thu Jan 19, 2012 11:15 am

Which version of Vault are you using?
Beth Kieler
SourceGear Technical Support

dConlin
Posts: 2
Joined: Thu Jan 19, 2012 8:45 am

Re: Updating a shared file

Post by dConlin » Thu Jan 19, 2012 1:32 pm

Fixed! The problem was thus:

When you share a folder, it doesn't count as a change to the sharing location. So if A is a shared copy of B, when you ask A the time it was last changed, it replies with the time B was last changed.

This works fine unless you shared B as A after the last change to B. When this happens, when you ask A when it was last changed, it replies with the last time B was changed, which is actually *before* A was even created. This is pretty confusing, and led to me trying to update to a copy of the parent folder at a version when A didn't exist.

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

Re: Updating a shared file

Post by Beth » Thu Jan 19, 2012 2:13 pm

Thanks for the update. This may help others as well.
Beth Kieler
SourceGear Technical Support

Post Reply