Search code examples
clearcasecleartool

How to obtain previous baseline from stream


I can retrieve latest baseline which is always recommended in my case using following command

"cleartool desc -fmt \"%[rec_bls]CXp\" stream:".$SourceStream."\@\\".$pvob

I want to retrieve second latest baseline.Is it possible to obtain previous baseline from a given stream using cleartool command? previous applied baseline on any given component will also works.I need this to get difference between two streams from different projects which can be done by following command.

"cleartool diffbl -elements baseline:".$LastComponentBaseline." stream:".$CurrentStream;

Solution

  • You can start by looking at the output of cleartool lsbl: it does list (for a given stream and/or component).
    Combined with fmt_ccase, you can grep the recommended baseline you know, and the line before, since lsbl lists baselines from the oldest to the newest

    cleartool lsbl -fmt "%[component]Xp %n" -stream aStream@\aVob | grep -B 1 -E "yourComponent.*yourBaseline"
    

    You need to grep for the right component name (displayed by the %[component]Xp format), as lsbl (on a stream) would list all baselines of all components.