Search code examples
clearcasecalibm-rational

Get ClearCase Snapshot Views via ClearCase Automation Library (CAL)?


Is anyone using the ClearCase Automation Library (CAL) successfully to retrieve snapshot views? I can get all the dynamic views just fine, but not a single one of my snapshot views appears in the 'Connection.get_Views(true, region);' command...

Is there any way to get these programmatically as ICCView instances?


Solution

  • How about:

    Dim CC As New ClearCase.Application 
    CC.Views(true, myRegionName)
    

    It should gets the collection of views in the specified region, including snapshot ones.
    (Note: this may be similar to what you proposed in your question, but with a more accurate CAL syntax)

    For instance, I do confirm the following ccperl script does return snapshot and dynamic views:

    Type 'ccperl listViews.pl', provided:

    • you did save the next line in a file named 'listViewws.pl'.
    • you replace 'myRegionName' by your current ClearCase region
    • you are using the same Region than the one in the script.

    Script:

    use Win32::OLE;
    $DEBUG = 1;
    
    print "Instantiating CAL CC\n" if $DEBUG;
    my $cal_cc = Win32::OLE->new('ClearCase.Application')
    or die "Could not create the ClearCase Application object\n";
    
    $cclsview = $cal_cc->Views("False","myRegionName");
    $Views_Entries = $cclsview->Count;
    print "nbViews $Views_Entries\n";
    $Views_Index = 1;
    while ($Views_Index <= $Views_Entries) {
        print "Processing View entry $CS_Index\n" if $DEBUG;
        $View = $cclsview->Item($Views_Index);
        $ViewName = $View->TagName;
        $ViewIsSnapshot = $View->IsSnapShot;
        print "View $ViewName $ViewIsSnapshot\n";
        $Views_Index++;
    }