I'm using the OLE sample code in C# for VSS automation.
I tried to call GetByLabel recursively but it doesn't work.
Any one know how to get a tree by label in C# or other
language ?
Thanks
Hi,
I had the same problem some time ago.
I had to implement the recursion my self, here is how I did it:
private void GetVssProjectVersion(string Spec, string GetPath, string
Version, bool Recursive)
{
VSSItem VSSProject;
VSSItem VSSProjectVersion;
VSSProject = mVSSDatabase.get_VSSItem(Spec,false);
VSSProjectVersion = VSSProject.get_Version("Version " + Version);
VSSProjectVersion.Get(ref GetPath,0);
if(Recursive == true)
{
IVSSItems items = VSSProject.get_Items(false);
foreach(VSSItem Item in items)
{
if(Item.Type == (int)VSSItemType.VSSITEM_PROJECT)
{
GetVssProjectVersion(Spec + "/" + Item.Name,GetPath +
"\\" +Item.Name,Version,Recursive);
}
}
}
}
On a side note:
If you are going to add items, then label them from code, make sure that you
don't do things to fast.
I was migrating several thousand versions from our old archive(UNIX) to
SourceSafe, and wrote a program to do it.
The problem I discovered was that things got labeled wrong, several versions
got checked in before the label was set.
The solution was to introduce a 1.5 second delay between the add and label
operation.
The program I wrote was in VB6 and used VSS prior to 6.0c that came with
VS.NET so things may have changed,
but you should be aware that it might still be a problem.
Chris
> I'm using the OLE sample code in C# for VSS automation.
> I tried to call GetByLabel recursively but it doesn't work.
> Any one know how to get a tree by label in C# or other
> language ?
>
> Thanks