How can I obtain foundation baseline for a component? - clearcase

I have used below command but it provides all foundation baselines.
cleartool descr -fmt "%[found_bls]CXp" stream:myStream#\myPVob
Is there any way to get foundation baseline of a single component?

I mentioned before how to get the foundation baselines for a stream.
But fmt_ccase does not include foundation baselines for a component.
The only two directives appplied to an UCM component are:
%[initial_bl]Xp: Initial baseline of the component
%[root_dir]p: The root directory for the component
So you have two options:
%[component]Xp (for an UCM baseline), for describing each baseline you get from %[found_bls]CX, getting each component name that way.
Once you get the expected component name, you know its baseline
%[components]CXp (for an UCM stream), listing the components for which the stream has foundation baselines.
If the second option (%[components]CXp), applied to a stream, lists the component in the same order than it list baselines with %[found_bls]CXp (for a stream), then it would be quicker (the baseline for the third component would be the third baseline listed by %[found_bls]CXp)
But if the order is not the same, then you must loop on each baseline from %[found_bls]CXp, and describe each of them with %[component]Xp, until you get the component you are after.

Components don't have "foundation" baselines. The concept of a "foundation" baseline only applies to streams. So, you will need to check this on a per-stream basis.
Complicating this further is the concept of "composite baselines" which are themselves a collection of baselines (and these can be nested).
Off the top of my head, you would start by looking at either the foundation or recommended baselines of integration streams, and breaking that down by component (including by drilling down into composite baselines). Unless the integration streams are very new, the "recommended" baseline may be more useful than the foundations.

Related

Forcing a view in clearcase to equal parent stream -- dynamic

I've seen Forcing a view in clearcase to equal parent stream
However I've got a dynamic stream, and I've got to the point of rebasing etc but there are still changes from files that have not been removed on the parent stream.
Question in clarity: How do you reset a dynamic view to exactly its parent? (and to save time so far I've generated a new stream and view, but I can't keep doing that.)
A stream is not "dynamic". A view (UCM or not) can be a dynamic view.
A simpler approach would be:
put baselines on the parent stream, to mark the current codebase state for each UCM component
to rebase the integration stream with the same latest baselines as the one you just created on the parent
do so with a new dynamic view (to make sure it reflects the stream, without any checked out or private file)
That way, the child stream would see the current LATEST of the parent stream.

How to add components in a stream using cleartool commands?

I want to add components to a stream (development and integration) in clearcase. How do I add the components using commands (cleartool) ?
A simple cleartool rebase should be enough: by rebasing a component baseline, that would add the component automatically to the stream.
Execute that in a dynamic view (faster than a snapshot view)
The related commands are:
cleartool chstream, that you can use to:
recommend baselines.
remove a component (but that is not your case)
And cleartool chproject, used to to convert non modifiable baseline to modifiable.
To add multiple baselines, assuming you don't have a composite baseline through a rootless component (which could group all those baselines under one), you would have to loop over your different baselines, ad rebase them one by one on your stream.
Note that with one command, you can list all existing foundation baselines of a stream, as I did here:
cleartool lsstream -fmt %[found_bls]p -cview
That means you can then double-check which baselines are already present (and would not need to be rebased again), and which baselines would have to be rebased.

how to create a preop trigger to prevent a new baseline in clearcase stream?

I have this issue while rebasing the stream:
cleartool: Error: Can't switch to baseline because the stream has made changes
based on the current baseline.
giraffe_pvob is a non modifiable component on
tiger_011 project and there were no changes done on this component
by the stream.
I would like to install the preop trigger to prevent any new baseline on this stream. so how should I proceed? Will this prevent any rebasing issue like above?
Thanks !!
You cannot prevent the creation of the baseline, but you can prevent the situation which leads to said baseline on a non-modifiable component.
This is called a parasite baseline, and is one of UCM flaws.
It is caused by a dependency, as explained in "ClearCase UCM - best practices using components".
A1
B1
B2
Putting a baseline on A will create a parasite baseline on B, even if B is a non-modifiable component...
(more details in this thread)
The only preop I usually put is one (on rebase) making sure none of the foundation components (like B) of a stream are part of the dependencies of another (modifiable) component (like A depending on B)

Keep element history when relocating elements between UCM components

For a variety of terrible yet neccessary reasons, our project needs to split a UCM VOB into multiple UCM VOBs. We currently have the follow VOB/component structure:
/vobs/companyA/teamA/dev
/vobs/companyA/teamB/dev
/vobs/companyB/teamC/dev
We are restructuring into the following structure:
/vobs/teamA/dev
/vobs/teamB/dev
/vobs/teamC/dev
Is there any way to move/relocate the elements to the new components in the new VOB and retain the elements' history?
The command to do that is cleartool relocate, and its man page explicitly mentions:
Note: You cannot use relocate in a UCM component VOB or PVOB. Before you perform any relocate operation, read the relocate reference page.
So it is best to select the last meaningful baselines, and 'clearfsimport' their content (at least the right subset) in the new vobs, in order to recreate those baselines.

ClearCase UCM: Is it possible to have a temporary view on any given baseline?

Is it possible to open a view (snapshot or dynamic, maybe readonly) on any given baseline (recommended or older) in a stream (integration, development or child) for performing some tasks and then remove the view when done? How?
To open a view to a given baseline, you actually need a view associated to a stream with said baseline as a foundation baseline.
That means you need to rebase that stream first, which is:
not always desirable (since you would need to merge said baseline with current content, and that doesn't always make sense)
not always possible (you can only rebase a sub-stream with baselines coming from its immediate parent).
What is possible is to:
get the stream on which your baseline has been put
make a sub-stream from that stream, taking said baseline as the foundatio one
create a snapshot or dynamic view on it
do your work
put a new baseline, and deliver it to its parent stream
obsolete that sub-stream (and you can delete your view if you want)
Note: you could create a base ClearCase dynamic view (ie non-UCM) with a config spec you could then change as you want, but that wouldn't allow you to checkout and modify any file.
That would only be a convenient way to visualize any baseline of your choice.

Resources