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?

Machavity
  • 30,841
  • 27
  • 92
  • 100
Jörg Battermann
  • 4,044
  • 5
  • 42
  • 79

1 Answers1

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++;
}
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • 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! – Jörg Battermann Jul 30 '09 at 09:24
  • @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 ;) – VonC Jul 30 '09 at 10:33
  • @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_someview` – Pulak Agrawal Nov 21 '11 at 04:04