Re: getting the list of files that have a particular label?

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Dmitry Goncharenko [MSFT] (dgonchREMOVETHECAPS_at_microsoft.com)
Date: 04/29/04


Date: Thu, 29 Apr 2004 21:06:14 GMT

Igor,

To do this programmatically you can use VSS automatiuon for example as in the script below:

                static void GetItemsOfLabel(string SrcSafeInitPath, string UserName, string PassWord, string RootItem, string Label)
                {
                        IVSSDatabase db = new VSSDatabaseClass();
                        db.Open(SrcSafeInitPath, UserName, PassWord);
                        IVSSItem Item = db.get_VSSItem(RootItem, false);
                        ShowItemsOfLabel(Item, Label);
                }

                static void ShowItemsOfLabel(IVSSItem Item, string Label)
                {
                        if (Item.Type == (int)VSSItemType.VSSITEM_FILE)
                        {
                                LookForLabelInItemHistory(Item, Label);
                        }
                        else
                        {
                                // Uncomment to see progress
                                // Console.WriteLine("Scanning " + Item.Spec + " ...");

                                foreach (IVSSItem ChildItem in Item.get_Items(false))
                                {
                                        ShowItemsOfLabel(ChildItem, Label);

                                        // This isn't pretty but is needed to release Versions collection
                                        GC.Collect();
                                        GC.WaitForPendingFinalizers();
                                        GC.Collect();
                                }
                        }
                }

                static void LookForLabelInItemHistory(IVSSItem Item, string Label)
                {
                        IVSSVersions Versions = Item.get_Versions(0);
                        foreach (IVSSVersion Version in Versions)
                        {
                                string VerLabel = Version.Label;
                                if (VerLabel == Label)
                                {
                                        Console.WriteLine("Found:" + Item.Spec);
                                        break;
                                }
                        }
                }
        }

Dmitry Goncharenko (dgonchREMOVETHECAPS@microsoft.com), Visual Studio Core Team
This posting is provided "AS IS" with no warranties, and confers no rights.

--------------------
> From: Steve Gentile (steven.gentile@wpafb.af.mil)
> Subject: Re: getting the list of files that have a particular label?
> References: <A4CA16A5-3CC3-43F9-A885-12BA73E3BC35@microsoft.com>
> Date: Thu, 29 Apr 2004 08:25:14 -0700
>
> Right mouse click on the folder you wish to see labels for and choose
> "Show History..." Check the Include Labels and you will see a list of
> files under labels.
>
>
> **********************************************************************
> Sent via Fuzzy Software @ http://www.fuzzysoftware.com/
> Comprehensive, categorised, searchable collection of links to ASP & ASP.NET resources...



Relevant Pages

  • Re: Tektro R200A brake levers-recommended!
    ... And I must add that in anticipation of posting those, ... new tires, I lined up the labels for the first time in my life ever. ...
    (rec.bicycles.tech)
  • Re: UserControl Key events dont fire?
    ... You are posting in every group you come across!!! ... >> I can't get any of the Key events to fire in my UserControl. ... >> The control only contains a few labels. ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Finding IP address
    ... We need to decided how many labels or which element we want in the ss ... When responding to posts, please "Reply to Group" via your newsreader so ... This posting is provided "AS IS" with no warranties, ...
    (microsoft.public.dotnet.languages.vb)
  • Re: My brainstorming and crank label
    ... > my making various claims, as about my pattern of posting, ... they are just labels that describe you concisely and appropriately. ...
    (sci.crypt)
  • Re: My brainstorming and crank label
    ... > my making various claims, as about my pattern of posting, ... they are just labels that describe you concisely and appropriately. ...
    (sci.math)