How to describe recommend baseline with pipeline

2019-02-19 05:21发布

I am trying to find all the components baselines associated in a composite baseline.

I am able to achieve it using following way

cleartool desc -fmt %[rec_bls]CXp stream:My_Integration@\My_PVOB

(I would save the receommended baselines in some variable using powershell and replace it in next command) 

cleartool describe -l baseline:"$Baseline"@\My_PVOB

Is it possible to combine both command so that i can describe all the recommended baselines.

In the above approach i am forced to use some script to save baselines then to use it in Cleartool command. If it can be combined in cleartool itself it will be good and handy.

1条回答
小情绪 Triste *
2楼-- · 2019-02-19 06:05

I didn4t find a way to pipe the two describe between the composite baseline and its member baselines.

My solution (which isn't satisfactory) is, in a bash (available on Windows through msyswwin, with a tool like msysgit):

$ ct descr -l baseline:P_Summit_HUB_12_30_2011@\\Summit_HUB_pvob |grep "b)"|awk '{print "cleartool descr -fmt \"%[component]Xp %n\\n\" baseline:" $1 " >> afile"}'

I use whatever fmt I need (here just the name of the component associated with the member baseline and its name)

Then I execute each output line in order to get the final result in 'afile'.

Your PowerShell script approach is certainly better.


Actually, the OP Samselvaprabu confirms following said PowerShell approach:

$Baselinefile="C:\Baseline.txt" 
$project="MyComponents@\My_PVOB" 
$pvob="@\My_PVOB" 

# Find the list of Recommended baseline for the project 
$Baselines=(cleartool lsproject -fmt "%[rec_bls]p" $project).split() 

#Foreach baseline get the baseline and Component Name 
foreach ($Bline in $Baselines) { 
  cleartool describe -l baseline:"$Bline"$pvob | Select-string -pattern "@\\My_PVOB)"| Out-File $BaselineFile -append 
}
查看更多
登录 后发表回答