API : GetByLabel except checked out files

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

Moderator: SourceGear

Post Reply
michaelF
Posts: 6
Joined: Thu Apr 27, 2006 8:56 am

API : GetByLabel except checked out files

Post by michaelF » Thu May 18, 2006 4:07 am

version 3.1.8

With the API, I am able to get a folder with a specific label (using the GetByLabel_GetData). I would like that the files that are currently checked out are not replaced.

1. When a checked out file has been locally modified, the PromptForOverwrite callback is correctly called. However, the VaultClientFile given in paramater seems to be invalid (full path is truncated for example and Repository.Root.FindFileRecursive(file) failed]). The file ID is correct. Moreover the parameter string origFile is empty.

2. When a checked out file has not been locally modified (but the checked out version is more recent that the labeled version to retrieve), the PromptForOverwrite callback is never called. In the Vault Client application, there is the same behavior and help say "Prompt before overwriting locally modified files will only be displayed for files that have been modified by the user. It does not apply to versions of files that can be re-created by the Vault server (e.g., files with an Old status)".
Does it exist a way to retrieve a folder with a specific label, wihout replacing files that are currently checked out and which version is more recent ?

Thanks for your advices.

dan
Posts: 2448
Joined: Wed Dec 17, 2003 5:03 pm
Location: SourceGear
Contact:

Re: API : GetByLabel except checked out files

Post by dan » Thu May 18, 2006 8:10 am

michaelF wrote:
1. When a checked out file has been locally modified, the PromptForOverwrite callback is correctly called. However, the VaultClientFile given in paramater seems to be invalid (full path is truncated for example and Repository.Root.FindFileRecursive(file) failed]). The file ID is correct. Moreover the parameter string origFile is empty.
I seem to remember it being this way because there is no guarantee that an item in a label is still in the tree - it could have been deleted or moved, so the path is relative to the root of the label.

Note that there is a version of FindFileRecursvie that takes the ID rather than the path, so you should still be able to locate the present location of the file in the tree, if it still exists.

2. When a checked out file has not been locally modified (but the checked out version is more recent that the labeled version to retrieve), the PromptForOverwrite callback is never called. In the Vault Client application, there is the same behavior and help say "Prompt before overwriting locally modified files will only be displayed for files that have been modified by the user. It does not apply to versions of files that can be re-created by the Vault server (e.g., files with an Old status)".
Does it exist a way to retrieve a folder with a specific label, wihout replacing files that are currently checked out and which version is more recent ?
Unfortunately, all the logic related to not overwriting is based on whether the file is modified or not, and not whether it is checked out. I can't think of a way around this, other than checking the files out after doing the Get Label, or possibly by changing the datetime stamp of every modified file before the Get Label, which will make Vault think it is modified.

michaelF
Posts: 6
Joined: Thu Apr 27, 2006 8:56 am

Post by michaelF » Thu May 18, 2006 10:14 am

Ok. Thanks for your answer.
For 1), I will use FindFileRecursive with the file.ID attribute.
For 2), I will probably get files one after the other recursively into the folder (and subfolders).

Post Reply