How to rename member baseline? Is it acceptable practice? - clearcase

I have applied baseline for a component via cleartool. (we are using clearcase UCM).
I mistakenly put the wrong baseline name and i am unable to apply another one as it says no changes were done.
How to rename the baseline name in UCM ? (I tried via GUI but not finding a way).
If cleartool rmname can be used, can some one put an example how to do that? i did not find one

As mentioned in "Renaming a Baseline does not change the label type name", you can rename a baseline through the CLI) but you need to rename the assiciated lbtype as well, for ClearCase 7.0 and before (7.1 and 8, you can just rename the baseline, it should take care of the lbtype. If not, see below).
cleartool rename baseline:<old baseline name>#\<component vob tag> baseline:<new baseline name>#\<component vob tag>
Check if the lbtype is renamed by doing a:
cleartool descr -l baseline:<new baseline name>#\<component vob tag>.
ClearCase does not rename the lbtype automatically when a baseline is renamed because the lbtype is used as a version selector in every view that is attached to a stream using this baseline (as illustrated in [IBM technote swg1IC41518][2]).
If a UCM baseline lbtype is also renamed, it is necessary to run 'cleartool chstream -gen stream:<stream#pvob>' for every stream using this baseline.
It is then necessary to run 'cleartool setcs -stream' within every view associated to the stream.
Since it cannot be guaranteed that every view is available to the system that is renaming a UCM lbtype, this cannot be automated.
cleartool rename lbtype:<old baseline name>#\<component vob tag> lbtype:<new baseline name>#\<component vob tag>
In short, it is possible but not trivial to rename a baseline for CC7.0 and before: it is an UCM object which is assosiated (through an hyperlink) to the lbtype used to create the label on all the elements which have changed (incremental baseline), or all the elements of the component (even those which haven't changed since the last baseline: full baseline, see "What is the difference between Full baseline and Incremental baseline in Clearcase UCM?")
You need to rename both (baseline and lbtype).
It is an acceptable practice since its content doesn't change.
However, you would need to propagate and communicate the new baseline name along your release management process.

Related

ClearCase UCM: Access and change config spec from script

In our continuous integration we use ClearCase UCM. We occasionally need to access the sources from the recommended baseline (which not necessarily equals the newest baseline). Note: All baselines are full.
I figured out how to access the sources belonging to the recommend baseline manually, by entering cleartool edcs in the command line within the dynamic view and adding the line element * MyRecommendedBaseline below # Select checked out versions, saving and closing the text-file.
Unfortunately I don't know how to do this from a script. One way I could think about is read the contents of the config_spec into a stream, add the line, save it to a new text file and use "cleartool setcs newcs.txt".
But apart from being cumbersome I'm not exactly sure if this is possible. Anyone knows a simple way to do this?
You can script listing the recommended baselines of a given stream: see "How can I list the recommended base line in ClearCase"
On Windows:
cleartool descr -fmt "%[rec_bls]CXp" stream:streamName#\aPVob
On Unix:
cleartool descr -fmt "%[rec_bls]CXp" stream:streamName#/vobs/aPVob
From there, you can generate a new file with simple rules:
element * MyRecommendedBaseline1
element * MyRecommendedBaseline2
...
And you can setcs that file to a dedicate base-CC dynamic view (not an existing UCM view).
As Brian Cowan points out in the comments, this only works because those baselines, as the OP mentions, are full baselines (not incremental or not-labeled, like deliverbl are).
See also "What is the difference between Full baseline and Incremental baseline in Clearcase UCM?".

How to get list of activities included in new ClearCase baseline from commandline?

When making baseline manually, it shows the "Make Baseline" dialog with list of activities to include in new baseline.
How to get that list from commandline (from cleartool or other tool, in Windows and Linux)?
The closest would be described in the technote "Activities delivered since the last baseline"
When working in a UCM project, it is often useful to determine the activities delivered to an integration stream since the last baseline was applied.
The cleartool diffbl command can accomplish this.
However, cleartool diffbl must be run against each modifiable component that the project uses.
The command syntax is:
cleartool diffbl -activities baseline:<baseline> stream:<integration_stream>
That means you must determine that latest most recent baseline of a component on a given stream first.
As mentioned by the OP in the comments, the diffbl works with the most recent baseline:
either the one listed first by lsbl
or the foundation baseline if it is more recent.
cleartool lsbl -stream integration_stream -component user1_comp#/vobstore/pvob
Then make the diffbl in order to list the activities which are candidate for the next baseline.
The cleartool lsbl -stream ... -component ... seems to return the last baseline created in this stream.
But cleartool diffbl -activities baseline:... stream:... prints some useless junk if that baseline is not last in stream (this might happen if stream was rebased, and no new baseline was created since then; the last baseline becomes the foundation baseline).
So cleartool diffbl needs foundation baseline if it's newer than last baseline created in the stream. In this case it correctly outputs list of activities.

How to find the list of files changed after latest baseline in UCM?

I have to verify whether any elements are changed in a component vob after the last baseline in applied.
I was trying to find the cleartool command for that but i got upto "finding the list of files changed after a particular date " .
Is there any way to get the list of files changed after the last baseline applied?
One of the fastest way would be simply to try and make a baseline(!)
If nothing has changed, by default, ClearCase UCM will refuse to make one.
If one has change:
a/ You can compare the newly created baseline with its previous to get the list of versions modified:
cleartool diffbl -pred -ver newBaseline#\aPVob
b/ You can delete that newly created baseline if your intention was not to create one right away.
Another relatively fast way (since adding/removing a baseline can take time on a large component, or where there are already a lot of baselines) is:
"Find files in Clearcase view newer than a specific date?"
If you have the date of the last baseline, you can launch a search for newer version:
cleartool find <vobtag>/<component_root_dir> -element "{created_since(target-data-time)}" -print
To get the latest baseline, see "List the latest baseline of a component in a UCM stream one by one".
The date can then be obtain with an fmt_ccase directive:
cleartool describe -fmt "%d" aBaselineName#/aPVob
The best,simplest and easiest way to do that is by creating a view in that baseline and then give a cleartool rebase -recommended .Once you do this just give cleartool lspriv -co This will give you list of all the files that have been modified after your baseline in which you created the view.

How to find a particular file version in ClearCase?

Is there any command in which I provide a baseline name plus an element filename, and it returns the exact file version that is labeled by this baseline?
For instance:
baseline name: 7.5.3.1
element filename: a.java
Result:
/main/mystream/16
My question refers to UCM, where you can't move a baseline between versions...
If there's no such command, it seems I have to write a short script. In that case, I probably have to run cleartool lsvtree and then parsing the output - am I right? Is that the most rapid way?
Thank you
You could query the exact version by looking at the label on the version of that file.
But that would only work if the baseline is a full baseline (meaning it has set a label named after the baseline on each file part of the component associated with said baseline).
See "What is the difference between Full baseline and Incremental baseline in Clearcase UCM?".
If that is the case, then you can look to the exact version with a cleartool find command, like in "How to search files by label".
Other mechanisms are described in the IBM technote "How to determine which element version a label was moved from".

what is the difference between branch and branch type in rational clearcase

I am new to clearcase and it looks so confusing about branch and branch type and label and label type etc...
If i use this command:
cleartool mklbtype
What it will create, a label or a label type?
IBM Rational clearcase http://www.ibm.com/software/awdtools/clearcase/
We recently moved from subversion to clearcase for version control and when I relate the both terms it is quite confusing?
A branch belongs to an element (a file or directory). A brtype or branch type is a name for some branches, which can be applied to any number of elements.
For example, file.c##/main/int is a branch of the element file.c. Its brtype is int. And file.c##/main/int/2 is a version which belongs to that branch.
Similarly, a label belongs to a version of an element. An lbtype or label type is the name for some labels, and can be applied to any number of versions of different elements. A common use is to create labels with the same type for each element in your repository, to stamp a certain release.
cleartool mklbtype -global TEST
makes a label type.
cleartool mklabel TEST file.c
creates a label on the version of element file.c which is currently selected in your view. Now file.c##TEST is a permanent synonym for that version.
cleartool mklabel -rec TEST .
does the same for the current directory and all its contents, recursively.
Addition for those using ClearCase UCM:
One other difference between branch and branch type is the kind of metadata you can find associated with a branch type.
An UCM stream will be "guarded" a branch type, meaning it will be associated with a branch pattern, and if you change the name of the UCM Stream, you will also change the name of the underlying brtype.
Similarly, an UCM baseline will guard the lbtype corresponding to the physical label of the baseline applied to each versions included in said baseline.
You cannot use mklabel with an lbtype guarded by a baseline, because baselines are supposed to be immutable.
You can see an application of creating lbtype when adding said labels after an svn import to ClearCase: see "Moving from SVN to ClearCase"

Resources