2012-01-06 59 views
2

我正在嘗試查找複合基線中關聯的所有組件基線。如何用管線描述建議基線

我能實現它使用下面的方法

cleartool desc -fmt %[rec_bls]CXp stream:[email protected]\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 

是否有可能兩者結合起來的命令,這樣我可以描述所有推薦的基線。

在上述方法中,我不得不使用一些腳本來保存基線,然後在Cleartool命令中使用它。如果可以在cleartool中組合它,它將會很好用。

回答

1

我沒有找到一種方法來處理複合基線與其成員基線之間的兩個describe

我的解決方案(這是不令人滿意的)是,在bash(適用於Windows通過msyswwin,與像msysgit工具):

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

我使用任何fmt我需要的(這裏只是名字與成員基線及其名稱相關聯的組件)

然後我執行每個輸出行以獲得'afile'中的最終結果。

您的PowerShell腳本方法當然更好。


其實,下面說OP Samselvaprabu確認PowerShell的方法:

$Baselinefile="C:\Baseline.txt" 
$project="[email protected]\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 
} 
+0

確定。我正在使用下面的PowerShell來解決這個問題。 「$ Baselinefile =」 C:\ Baseline.txt」 $項目= 「MyComponents @ \ My_PVOB」 $ PVOB = 「@ \ My_PVOB」 #尋找推薦的基線列表中的項目 $基線=(cleartool lsproject (%Bline in $ Baselines){ cleartool describe -l baseline:「$ Bline」$ $ pvob | Select-string -pattern「@ \\ My_PVOB \)」| Out-File $ BaselineFile -append }「希望以後可以幫助別人 – Samselvaprabu 2012-01-10 07:04:52

+0

@Samselvaprabu:有趣的反饋,謝謝。我已將您的腳本包含在我的答案中以提高可見度。 – VonC 2012-01-10 07:35:02

+0

@VonC:在你的命令管道中... | grep「b)」| ...這是否正確?什麼意義? – Jayan 2014-05-28 17:33:36