GETLABEL will not get files recursively, only folders (V2.0)

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

Moderator: SourceGear

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

Post by dan » Wed Feb 25, 2004 1:19 pm

There is no way in the current release to Get by label on a folder if the label doesn't exist at that folder, and labels are always recursive.

So, the best we could do is to label the folder, and then remove items that don't apply. Users could then add the files back to the label if they wanted to.

Since we provide the source code to our command line client, you could try to implement the "Get recursive file label of the same name" functionality. It might be extremely slow though, depending on the size of your tree.

I can't really promise that this will be in a release in the immediate future, but we will add it to the feature request list.

jeremymc
Posts: 9
Joined: Sat Feb 21, 2004 12:39 am

Post by jeremymc » Wed Feb 25, 2004 3:29 pm

Can you please give a simple description of how to set up and run the command line client source code? I have been able to compile it OK, but I always get an error in the following location:

void Logout(bool bForceLogout)
{

if ( (_ci != null) &&
((bForceLogout == true) || (_args.InBatchMode == false))
)
{
// log out when forced or not in batch mode.
_ci.Logout();
_ci = null; // <-- Error happens here
}

}

Here is the stack trace of the error:

Unhandled Exception: System.NullReferenceException: Object reference not set to an instance of an object.
at VaultClientNetLib.VaultConnection.Logout()
at VaultClientOperationsLib.ClientInstance.Logout()
at VaultCmdLineClient.VaultCmdLineClient.Logout(Boolean bForceLogout) in d:\source\hydra\system\other\vaultcmdline\v01\windowsapp\vaultcmdlineclient\vaultcmdlineclient.cs:line 437 at VaultCmdLineClient.VaultCmdLineClient.Main(String[] args) in d:\source\hydra\system\other\vaultcmdline\v01\windowsapp\vaultcmdlineclient\vaultcmdlineclient.cs:line 3830

sterwill
Posts: 256
Joined: Thu Nov 06, 2003 10:01 am
Location: SourceGear

Post by sterwill » Thu Feb 26, 2004 1:49 pm

Are you trying to compile and run the command-line client code unmodified, or have you made changes to it?
Shaw Terwilliger
SourceGear LLC
`echo sterwill5sourcegear6com | tr 56 @.`

DarrenS

Post by DarrenS » Thu Feb 26, 2004 2:04 pm

I'm pretty sure Jeremy compiled the vanilla code. However, he may have neglected to set up a working folder - and I believe the "null pointer" error can occur in the absence of a working folder? (I think I saw an item in the KB forum about that).

sterwill
Posts: 256
Joined: Thu Nov 06, 2003 10:01 am
Location: SourceGear

Post by sterwill » Thu Feb 26, 2004 2:47 pm

Hm... logout should be unaffected by working folder configuration, though. If the stacktrace is correct, and the exception really comes from VaultConnection.Logout, the error may be related to the connection's _clientService member getting set to null somewhere. I can't find any functions in VaultConnection that set _clientService to null, except Init, which is supposed to.
Shaw Terwilliger
SourceGear LLC
`echo sterwill5sourcegear6com | tr 56 @.`

jeremymc
Posts: 9
Joined: Sat Feb 21, 2004 12:39 am

Post by jeremymc » Thu Feb 26, 2004 4:05 pm

It compiles and runs fine under VS.NET 2003. I was using VS.NET 2002 before. Maybe that was the problem?

sterwill
Posts: 256
Joined: Thu Nov 06, 2003 10:01 am
Location: SourceGear

Post by sterwill » Thu Feb 26, 2004 4:08 pm

It's possible that the DLLs that contain the implementation of ClientInstance and VaultConnection don't work correctly when called from code compiled with Visual Studio .NET 2002, although I think .NET assemblies are designed to be able to do this. Releases of Vault 2.0 are compiled with Visual Studio .NET 2003.
Shaw Terwilliger
SourceGear LLC
`echo sterwill5sourcegear6com | tr 56 @.`

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

Post by dan » Thu Feb 26, 2004 10:52 pm

Yes, that's definitely the problem. Vault 2.0 libraries won't work with VS 2002, because they were compiled with the 1.1 .Net framework, which won't work with VS 2002.

DarrenS

Post by DarrenS » Fri Feb 27, 2004 11:44 am

dan wrote:Since we provide the source code to our command line client, you could try to implement the "Get recursive file label of the same name" functionality. It might be extremely slow though, depending on the size of your tree.
Thanks Dan - we implemented your suggestion, and it's working! For a tree 5000+ files, it took the client around 5 minutes to locate the couple that we'd labelled.

This is very comparable with the time taken by SourceSafe to do the same thing. We implemented it as a really simple-minded O(n) "schlemiel the painter" algorithm, but even with that is matches VSS in speed.

Speaking of which - any comments from the Sourcegear developers on a better way of doing this? Here's what we're doing:

- call _ci.TreeCache.Repository.Root.FindFolderRecursive() to access the folder we're "getting" at.
- call GetFilesRecursive() to get the files under that folder.
- iterate (foreach) file in the collection
- call GetLabeledFileToNonWorkingFolder() for that file, passing in the label we want.

Files that don't have a matching label throw an exception, which we catch and ignore.

Files that match are "got".

Any comments?

This is the last piece we needed...now at last we have the authority to purchase Vault licenses for all our developers.

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

Post by dan » Fri Feb 27, 2004 5:29 pm

Excellent! Thanks for taking the initiative on this.

I'm not familiar with that part of the code, so I can't comment on your approach, but if it works, and you're happy with the performance, then it fine with me :)

montek
Posts: 107
Joined: Mon Jan 05, 2004 8:46 am

Post by montek » Wed Mar 31, 2004 7:27 pm

jclausius wrote:jeremy / darren:

just want to make sure i understand you. are you saying you individually label each and every file?

in other words... in the example you provided, would you go to file1.vb and apply a label named "Ver2.3", and then go to file3.vb and apply a label named "Ver2.3"?
FWIW, we do the same thing. Whilst I have not yet attempted to fetch everything by a label, this thread might lead me to believe that I will be unsuccessful in my attempts because of the way I label files (one-by-one).

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

Post by dan » Wed Mar 31, 2004 9:05 pm

montek wrote: FWIW, we do the same thing. Whilst I have not yet attempted to fetch everything by a label, this thread might lead me to believe that I will be unsuccessful in my attempts because of the way I label files (one-by-one).
That's correct - if you label a single file at a time, you have to get by individual file too. If you want to get an entire folder with a label name, you need to apply the label to the folder.

montek
Posts: 107
Joined: Mon Jan 05, 2004 8:46 am

Post by montek » Wed Mar 31, 2004 9:31 pm

dan wrote:
montek wrote: FWIW, we do the same thing. Whilst I have not yet attempted to fetch everything by a label, this thread might lead me to believe that I will be unsuccessful in my attempts because of the way I label files (one-by-one).
That's correct - if you label a single file at a time, you have to get by individual file too. If you want to get an entire folder with a label name, you need to apply the label to the folder.
Well that's not useful at all. I can't label an entire folder because I can only deploy SOME versions of SOME files in it...hence the labeling.

This might work great if I were working on a non-web project where you solidify the whole thing before you release, but that just doesn't represent our environment at all. :(

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

Post by dan » Thu Apr 01, 2004 8:36 am

Sorry this doesn't work for your process - we've added this request to the feature enhancement list, and added your name to the list, and bumped it in priority

Post Reply