GetOperations.ProcessCommandGetVersion doesn't get all files

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

Moderator: SourceGear

Post Reply
theobviater
Posts: 5
Joined: Mon May 09, 2011 8:39 am

GetOperations.ProcessCommandGetVersion doesn't get all files

Post by theobviater » Mon May 09, 2011 8:55 am

Hi Everybody!

I'm trying to pull data revision by revision out of the Vault system. The GetOperations.ProcessCommandGetVersion method seems to be working well for what I need, except that it doesn't pull files that were added for a given version (in other words, when the request type = VaultRequestType.AddFile ). What do I need to do to get these files as well? I don't understand why that data wouldn't be pulled. I must be missing something.

Here's a code sample, in case it helps:

Code: Select all

var items = ServerOperations.ProcessCommandTxDetail(txId).items;
string[] output;
foreach (var item in items)
{
    if (item.ItemPath1.StartsWith(repoPath, StringComparison.CurrentCultureIgnoreCase))
    {
        switch (item.RequestType)
        {
            case 3: // Try to get individual items of this type; not working!
                GetOperations.ProcessCommandGetVersion(
                    item.ItemPath1,
                    Convert.ToInt32(item.HistoryItems.Last().Version),
                    new GetOptions() {
                        MakeWritable = MakeWritableType.MakeAllFilesWritable,
                        Merge = MergeType.OverwriteWorkingCopy,
                        OverrideEOL = VaultEOL.None,
                        PerformDeletions = PerformDeletionsType.RemoveWorkingCopy,
                        SetFileTime = SetFileTimeType.Current,
                        Recursive = true
                    }
                );
                break;
        }
    }
}

// This gets everything, except request type 3
GetOperations.ProcessCommandGetVersion(
    item.ItemPath1,
    Convert.ToInt32(item.HistoryItems.Last().Version),
    new GetOptions() {
        MakeWritable = MakeWritableType.MakeAllFilesWritable,
        Merge = MergeType.OverwriteWorkingCopy,
        OverrideEOL = VaultEOL.None,
        PerformDeletions = PerformDeletionsType.RemoveWorkingCopy,
        SetFileTime = SetFileTimeType.Current,
        Recursive = true
    }
);
Any help would be appreciated. Thanks so much!

Jack

lbauer
Posts: 9736
Joined: Tue Dec 16, 2003 1:25 pm
Location: SourceGear

Re: GetOperations.ProcessCommandGetVersion doesn't get all f

Post by lbauer » Mon May 09, 2011 11:07 am

We could use more information on what you're trying to do? Are you doing some sort of export?
except that it doesn't pull files that were added for a given version
Are you saying that when you GET a folder version, you don't get files that were added in that version?

Is there an error message?
Linda Bauer
SourceGear
Technical Support Manager

theobviater
Posts: 5
Joined: Mon May 09, 2011 8:39 am

Re: GetOperations.ProcessCommandGetVersion doesn't get all f

Post by theobviater » Mon May 09, 2011 11:25 am

Thanks for the response!

Yes, I am doing an export. There are no error messages and there are no exceptions. The command executes properly (as far as I can tell) and it pulls the files into my working directory. I don't get files that were added in that version. I tried pulling the next revision to see if they would come down with that data set, but they weren't there either.

I guess I just don't understand why this data is different than something that is committed or moved/renamed. If there's any other information I can provide, please don't hesitate to ask.

Thanks again for the response!

Jack

lbauer
Posts: 9736
Joined: Tue Dec 16, 2003 1:25 pm
Location: SourceGear

Re: GetOperations.ProcessCommandGetVersion doesn't get all f

Post by lbauer » Mon May 09, 2011 2:42 pm

That's strange. Can you get the version with the Command Line Client?

Documentation here:
http://download.sourcegear.com/misc/vau ... GETVERSION
Linda Bauer
SourceGear
Technical Support Manager

theobviater
Posts: 5
Joined: Mon May 09, 2011 8:39 am

Re: GetOperations.ProcessCommandGetVersion doesn't get all f

Post by theobviater » Tue May 10, 2011 8:12 am

I used the command line client as you requested, and here is my (excessively sanitized) response:

Code: Select all

Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

{--prompt--}> vault.exe GETVERSION -host host -user user -password pass -repository repo -verbose 5 $/MyDir
<vault>
  <!-- Fetched $/MyDir/MyDir2/MyDir9/MyDir10/MyDir11/MyFile1.txt -->
  <!-- Fetched $/MyDir/MyDir2/MyDir3/MyDir4/MyFile2.txt -->
  <!-- Fetched $/MyDir/MyDir2/MyDir3/MyDir4/MyDir12/MyDir13/MyDir14/MyDir15/MyDir16/MyDir17/THE_FILE_I_WANT_BUT_CANT_GET.txt -->
  <!-- Fetched $/MyDir/MyDir2/MyDir3/MyDir4/MyDir5/MyFile3.txt -->
  <!-- Fetched $/MyDir/MyDir2/MyDir3/MyDir4/MyDir5/MyFile4.txt -->
  <!-- Fetched $/MyDir/MyDir2/MyDir3/MyDir4/MyDir5/MyFile5.txt -->
  <!-- Fetched $/MyDir/MyDir2/MyDir3/MyDir4/MyDir5/MyFile6.txt -->
  <!-- Fetched $/MyDir/MyDir2/MyDir3/MyDir4/MyDir5/MyDir18/MyFile7.txt -->
  <!-- Fetched $/MyDir/MyDir2/MyDir3/MyDir4/MyDir5/MyDir18/MyFile8.txt -->
  <!-- Fetched $/MyDir/MyDir2/MyDir6/MyDir7/MyDir8/MyFile9.txt -->
  <!-- Fetched $/MyDir/MyDir2/MyDir6/MyDir7/MyDir8/MyDir19/MyDir20/MyFile10.txt -->
  <result>
    <success>True</success>
  </result>
</vault>
The file is retrieved successfully, and appears in my working folder. I suppose I could just use the command line client in my script, but it would be nicer to interface with the API.

Let me know if there is any other information that I can provide that might shed some light on this issue. Thanks so much for your help! I'm using the API version 5.0.3.18802.

Jack

lbauer
Posts: 9736
Joined: Tue Dec 16, 2003 1:25 pm
Location: SourceGear

Re: GetOperations.ProcessCommandGetVersion doesn't get all f

Post by lbauer » Tue May 10, 2011 2:19 pm

It could be a problem with your API code or it might be a bug -- we'll try to reproduce the problem.

Was this repository an import from VSS?
Linda Bauer
SourceGear
Technical Support Manager

theobviater
Posts: 5
Joined: Mon May 09, 2011 8:39 am

Re: GetOperations.ProcessCommandGetVersion doesn't get all f

Post by theobviater » Wed May 11, 2011 5:14 am

No, this repository was not an import. We've been using Vault since the beginning. If you give it a go and it works, at least I'll know it's a bug in my code. Much appreciated! You should be able to copy and paste the code from my original post to see what I'm doing. You'll just need to get a transaction id to pass. Let me know what you find.

Thanks again!

Jack

lbauer
Posts: 9736
Joined: Tue Dec 16, 2003 1:25 pm
Location: SourceGear

Re: GetOperations.ProcessCommandGetVersion doesn't get all f

Post by lbauer » Wed May 11, 2011 10:28 am

Since the Command Line Client worked, most likely the problem is your code when using the API.

For example, when you use the CLC, you specify the exact version to get (5). You may be passing along incorrect information within your code using the API , which is why the CLC and the API code return different results.

The API comes with the CLC Code (under the API/CommandLineClientCode folder). We suggest you compare the code that you are using in the API to the code that we use in the CLC. That should help you to figure out where the error lies.
Linda Bauer
SourceGear
Technical Support Manager

theobviater
Posts: 5
Joined: Mon May 09, 2011 8:39 am

Re: GetOperations.ProcessCommandGetVersion doesn't get all f

Post by theobviater » Tue May 17, 2011 5:42 am

Sorry for the late response!

After poking through the code as you suggested, I discovered that it behaved the way I expected when I pulled the data outside my working directory. Not sure what I'm doing wrong when I setup my working directory, but since I'm just doing some stuff with the data and don't need Vault to track it that is just fine. I'm sure there's an answer to that problem too, but I'm out of time to fiddle with it.

Thanks so much for your help!

Jack

lbauer
Posts: 9736
Joined: Tue Dec 16, 2003 1:25 pm
Location: SourceGear

Re: GetOperations.ProcessCommandGetVersion doesn't get all f

Post by lbauer » Tue May 17, 2011 9:25 am

Thanks for the update. Glad you were able to get it to retreive the files to a non-working folder.
Linda Bauer
SourceGear
Technical Support Manager

Post Reply