2

How to do check-in /check-out /Find and etc operation in Clearcase UCM using powershell.

Is there any way custom cmd-lets are available for this?

Samselvaprabu
  • 16,830
  • 32
  • 144
  • 230

2 Answers2

3

You can find an example in this IBM bug report, where you would use in your Powershell session the CAL API (ClearCase Automation Library)

PS C:\temp> $ct = new-object -com ClearCase.ClearTool
PS C:\temp> $ct.CmdExec('checkout -nc aFile')

Or, as in this thread, you would use directly cleartool.

In both cases, you will need to make sure the view in which you are doing the checkout/checkin operation as an UCM activity set (cleartool lsact -cact -cview should return an activity name, if done within the view).

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
3

For more advanced functionality and better response times, I'd recommend accessing the CAL API directly via COM. The best documentation for that is available locally in <ClearCase install dir>\bin\cc_cal.chm.

$cc = New-Object -COM ClearCase.Application
$ccItem = $cc.Version("<absolute path to file/dir>")
$coItem = $ccItem.CheckOut($cc.ccReservedState,"",$false,$cc.Latest,$false,$false)
Write-Output $coItem.IsReserved
Torbjörn Bergstedt
  • 3,359
  • 2
  • 21
  • 30
  • Hi , Thanks for your response. It works for me. And that's what i exactly wanted. in the above code "Write-Output $coItem.ReservedState" doesn't display anything. – Samselvaprabu Dec 20 '11 at 06:16
  • Sorry, mistake from me (corrected now). A real help (as always) is using `Get-Member` on the objects created; COM API calls are often more strict regarding the required number of parameters etc. – Torbjörn Bergstedt Dec 20 '11 at 06:54