例: ベースラインを比較する

' 2 つのベースラインの間で変更されたバージョンとアクティビティ、
' および 2 つのベースラインの特定のアクティビティで変更されたバージョンについての
' 情報を表示します。

Dim CC As New ClearCase.Application

' ¥projects というタグが付いたプロジェクト VOB を取得します。
Dim PVOB As CCProjectVOB
Set PVOB = CC.ProjectVOB("¥projects")

' プロジェクト VOB 内の特定のベースラインを取得します。
Dim Baseline1 As CCBaseline
Dim Baseline2 As CCBaseline
Set Baseline1 = PVOB.Baseline("V1.0.BL2.0004.test@¥projects")
Set Baseline2 = PVOB.Baseline("V1.0.BL2.0005.test@¥projects")

' バージョン比較のためのビュー コンテキストを設定します。
ChDir "W:¥automation"

' ベースライン比較オブジェクトを作成し、比較する 2 つのベースラインを割り当てます。
Dim BaselineComp As CCBaselineComparison
Set BaselineComp = CC.CreateBaselineComparison
BaselineComp.BaselineOne = Baseline1
BaselineComp.BaselineTwo = Baseline2

' ベースラインの比較を実行します。
Dim Str As String
On Error Resume Next
BaselineComp.Compare
If Err.Number <> 0 Then
     MsgBox "Error in baseline comparison: " & Err.Description
Else
     Dim Versions As CCVersions
     Dim Version As CCVersion
     Set Versions = BaselineComp.VersionsInTwoButNotOne
     Str = ""
     For Each Version In Versions
         Str = Str & Version.Identifier & vbCrLf
     Next
     If Str = "" Then
          MsgBox "There are no versions in " & Baseline2.Title & _
          "and not in " & Baseline1.Title
     Else
          MgBox "The versions in " & Baseline2.Title & " and not " & _
          Baseline1.Title & " are: " & vbCrLf & Str
     End If
     Set Versions = BaselineComp.VersionsInOneButNotTwo
     Str = ""
     For Each Version In Versions
          Str = Str & Version.Identifier & vbCrLf
     Next
     If Str = "" Then
          MsgBox "There are no versions in " & Baseline1.Title & _
          "and not in " & Baseline2.Title
     Else
          MsgBox "The versions in " & Baseline1.Title & " and not " & _
          Baseline2.Title & " are: " & vbCrLf & Str
     End If

' ベースライン間で変更されたアクティビティを表示します。
     Dim Activity As CCActivity
     Dim Activities As CCActivities
     Set Activities = BaselineComp.ChangedActivities
     Str = ""
     For Each Activity In Activities
          Str = Str & Activity.Name & vbCrLf
     Next
     If Str = "" Then
          MsgBox "There are no changed activities between the baselines"
     Else
          MsgBox "Activities that changed between the baselines are:" & _
          vbCrLf & Str
     End If
End If