Example: Comparing baselines

' Display information about the versions and activities that changed between
' two baselines and the versions that have changed in a particular activity
' in the two baselines

Dim CC As New ClearCase.Application

' Get the project VOB with tag \projects
Dim PVOB As CCProjectVOB
Set PVOB = CC.ProjectVOB("\projects")

' Get particular baselines in the project 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")

' Set a view context for the version comparison
ChDir "W:\automation"

' Create a Baseline comparison object and assign the two baselines to compare
Dim BaselineComp As CCBaselineComparison
Set BaselineComp = CC.CreateBaselineComparison
BaselineComp.BaselineOne = Baseline1
BaselineComp.BaselineTwo = Baseline2

' Perform the baseline comparison
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

' Display the changed activities between the baselines
     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

Feedback