How to obtain previous baseline from stream - clearcase

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;

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.

Related

How to get list of all the versions and labels applied for a particular file in clearcase?

I have a file
"N:\E123_view\ABC\XYZ\data.doc"
I want to get all the versions of the file and all the labels tagged to it.
One approach, in command line, is to use a version tree: cleartool lsvtree.
cd N:\E123_view\ABC\XYZ
cleartool lsvtree -all data.doc > afile.txt
lists all versions on a branch, not the selected versions only; annotates each version with all of its version labels.
Another approach is to use lshistory combined with fmt_ccase
cleartool lshistory -fmt "%n %l\n" data.doc
%n will print the version, as in /main/rel2_bugfix/1
%l will print the label (if present).

Getting previous activity ids of a file in clearcase commandline

I'm using windows. I need to extract activity ids of check ins in ClearCase.
I can get the current one through cleartool describe and then parsing the response for the word 'Activity'.
I'm looking to get the activity ids of it's previous versions.
How can I do that?
You don't have to parse the output of cleartool describe, if you combine it with fmt_ccase.
That allows you to:
get the previous version of an existing version
cd /path/to/view
cleartool describe -fmt "%[version_predecessor]p" afile
get all activity id with that version involved:
cd /path/to/view
cleartool describe -fmt "%[activity]p" afile##/a/previous/version
(that is using the version-extended pathname ##/... returned by the first cleartool describe)

ClearCase: how to list non-obsolete sub-streams?

I have an integration stream in ClearCase. I want to get a list with the names of all of its child streams that aren't marked as obsolete. Which command should I run?
A simple cleartool lsstream -tree myIntStream#\myPvob should be enough.
(Unix: cleartool lsstream -tree myIntStream#/vobs/myPvob)
As mentioned in cleartool lsstream:
Default
Lists only nonobsolete streams.
neves adds in the comments:
This also list all the activities of the stream. I think it is necessary to pass something the fmt option. I'd like just the name of the streams.
As I mention in "cleartool lsstream -tree get only list of child streams" (using fmt_ccase):
cleartool describe -fmt "%[dstreams]CXp" stream:myStream#\myPVob
The OP neves mentions in the comments having just the names with:
cleartool describe -fmt "%[dstreams]p" stream:myStream#\myPVo

how to list only the name of the baselines and name of the stream from particular component in UCM ClearCase

Is there any way that I can list all baselines' name and stream name for those baselines from a particular component?
The basic command would be cleartool lsbl:
cleartool lsbl -comp aComponent#\aPVob
You can then use fmt_ccase to display the stream as well as the baseline.
cleartool lsbl -fmt "%n %[bl_stream]Xp\n" -comp aComponent#\aPVob
A similar command would be:
cleartool lsbl -tree -comp aComponent#\aPVob
(to see the stream, and its location within the UCM project).
If that doesn't work, you can, for each baseline returned by the first command, do a:
cleartool descr -fmt "%n %[bl_stream]Xp\n" aBaseline#\aPVob

How to filter the baselines(UCM) alone from describe command?

As we are having many components , I am trying to describe all the baselines using following command
cleartool describe -l baseline:Baseline_2.1.0.13#\My_PVOB
It provides output like follows
"Build 13"
master replica: My_PVOB#\My_PVOB
owner: Admin
group: ABC
stream:Components_Integration#\My_PVOB
component: Baselines#\My_PVOB
label status: No Versions to Label
change sets:
promotion level: INITIAL
depends on:
Baseline_2.1.0.13.8206#\My_PVOB (Comp1#\My_PVOB)
Baseline_2.1.0.13.433#\My_PVOB (Comp2#\My_PVOB)
Baseline_2.1.0.13.423#\My_PVOB (Comp3#\My_PVOB)
Baseline_2.1.0.13.3763#\My_PVOB (Comp4#\My_PVOB)
Actually i want to get contents only below depends on: ( Want to get Just following contents)
Baseline_2.1.0.13.8206#\My_PVOB (Comp1#\My_PVOB)
Baseline_2.1.0.13.433#\My_PVOB (Comp2#\My_PVOB)
Baseline_2.1.0.13.423#\My_PVOB (Comp3#\My_PVOB)
Baseline_2.1.0.13.3763#\My_PVOB (Comp4#\My_PVOB)
How to omit the remaining information?
From the fmt_ccase man page:
%[depends_on]Cp
(UCM baselines) The baselines that the composite baseline directly depends on
So for a composite baseline:
cleartool descr -fmt "%[depends_on]Cp" baseline:aBaseline#\apvob
could do the trick, except it will print only the dependent baselines on one line, each name separated by space, and without their associated component name.
So you need to parse that output, and for each baseline name, do a:
cleartool descr -fmt "%[component]Xp" baseline:aBaseline#\apvob
(Or, if your naming convention for baselines allows for it, a simple:
cleartool describe -l baseline:Baseline_2.1.0.13#\My_PVOB | grep Baseline_
would be easier!)
Actually, the OP samselvaprabu took the last proposition to grep what he needed from the initial output. His grep is better than my proposal, because it doesn't depend on the Baseline naming convention, but on the PVob name of said baselines:
I am using windows so your last(simple) command gave me the idea.
Following command works in Dos
cleartool describe -l baseline:Baseline_2.1.0.13#\My_PVOB | find "#\My_PVOB)"
Read "fmt_ccase" manual, you'll find it over there:
cleartool man fmt_ccase

Resources