Get ClearCase Snapshot Views via ClearCase Automation Library (CAL)?
Asked Answered
W

1

1

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?

Warhol answered 28/7, 2009 at 12:34 Comment(1)
Answer updated, with a ccperl scriptKitchenette
K
1

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++;
}
Kitchenette answered 28/7, 2009 at 13:1 Comment(3)
Argh, it actually does work properly (to retrieve dynamic & snapshot views alike)... but the problem is I create a view with the name/tag 'abc_someview' and for some reason the view is named 'username_abc_someview' thereafter.. that's why I couldn't retrieve it after the creation with the original name. But thanks!Warhol
@Jörg: may be that is because you are using the GUI or a custom script, and it enforces a view name with the username as prefix? I prefer a good old 'ct mkview -tag myViewTag -stg myViewStorage' (plus other options if this is for a snapshot view): at least I am sure of the name ;)Kitchenette
@Jörg B. VonC is right.. when you create a view from the GUI, check the "Advanced Options", you'll be able to see username being prefixed to the abc_someviewHypervitaminosis

© 2022 - 2024 — McMap. All rights reserved.