How to list only the name of the baselines in UCM

2020-07-24 03:57发布

问题:

If I do:

cleartool lsbl -stream stream:mystream@\mypvob

That will lists the baselines with details.
But I want to list only the name of the baselines.

Is there anyway I can do that?

回答1:

You can use the fmt_ccase options in order to format the result of a cleartool lsbl command.

cleartool lsbl -fmt "%n\n" -stream stream:mystream@\mypvob


回答2:

Here two examples in python, found on snip2code.com

1) Get the foundation baseline of a stream

import os
working_stream = "myStream"
pvob = "MyVobs"
foundation_bl = os.popen("cleartool descr -fmt \"%[found_bls]CXp\" stream:"
    + working_stream + "@" + pvob).readlines()[0].split(":")[1].split("@")[0]
print "Found Foundation baseline = " + str(foundation_bl)

Link: How To Get The Foundation Baseline

2) Get all baselines of a stream

import os
stream = "myStream@/myVobs"
latest_bl=os.popen("for a in `cleartool lsstream -fmt \"%[latest_bls]p\" " + 
               stream + "`; do echo $a; done").readlines()
print "Latest baseline found = " + str(latest_bl)

Link: How To Get The Baselines From UCM Stream