How to specify stream/project in ClearCase snapshot view load rules? - clearcase

How to specify load rules in this case?
Previously discussed in How do I create a snapshot view of some project or stream in ClearCase?

When you create a UCM snapshot view, you reference the stream at the creation:
cleartool mkview -snap -tag myView_myStream_snap -stream myStream#\myPVob -stg myStorge myRootDir
Note: "myView_myStream_snap" is a convention of mine for naming a UCM snapshot view using the stream "myStream". You can actually name that snapshot view with whatever naame you want.
The load rules are only there to specify what to load within a snapshot view whatever the selection rules are (the "element ..." rules which are before the load rules)
load /myVob/dirA
load /myVob/dirB/dirB1
load /myVob/dirB/dirB2
There is no notion of stream or projects here.
The stream represents the "configuration" (i.e. the list of labels referencing some files)
The load rules represent what you want to load, without making any assumptions on the exact version selected
The combination of the two (the select rules based on the stream + the load rules) enable you to see the actual files within your newly created snapshot view.

Related

How to list branches associated with a view in clearcase

I have checked in some files in a branch but unfortunately I forgot the branch name but I remember my view name to which my branch is associated. I also checked my config spec but the branch which is written in the config spec is not the branch that I want.
Actually I created two branches in a view but one branch name I forgot and as I said in config spec also only one branch name is written. Is there any way where I can list all branches associated with a particular view?
No: only an UCM view has an associated branch (through its stream).
See "How to obtain UCM stream and baseline with cleartool?" or "How to get ClearCase stream name by a given view path?"
cleartool lsstream -fmt "%n" -cview
A non-UCM view would have any selection rules you want in its config spec.
You need to do a cleartool lsvtree /path/to/a/file (add --graph for the graphical view) in order to see its versions and the branches involved.

How to add a fine in existing clearcase baseline? (Not the latest baseline)

Is it possible to add a file in existing ClearCase baseline (Not the latest baseline) ?
Scenario :
There is a component , say CC_COMP having a number of baselines created over time. Consider below baselines in the component CC_COMP
BL_Latest
BL_New
BL_Older
BL_Oldest
There is a file FILE already present in BL_Lastest which is ONLY version in the VOB.
Now I want to add the same file FILE ( logically different but same in name ) in the baseline BL_Older.
How can I add that file in that older baseline?
No: a baseline is, by its very definition, immutable.
See for instance the article "The power of Unified Change Management"
These baselines are semantically rich objects that identify a "version" of a UCM component.
By using them, you can be certain that all files in that component are associated with the same version.
You can also be certain that the baseline will not change out from under you.
Once created, UCM baselines are immutable and can be used for defining higher-level configurations. An entire system, for example, can be assembled from a set of component baselines.
You need to:
create a substream to the stream where BL_Older was created
rebase or initialize that substream with the BL_Older baseline
add your file (using an UCM view associated with that stream)
make a new baseline BL_Older.1 for example.

Clearcase [not loaded]

When I execute a "cleartool ls filename##specificVersion", I see
filename [not loaded]
What does this mean?
For background information, I was trying to also execute a cleartool mkbranch, and was a "Element not found" error. So, for a sanity check, I tried a cleartool ls.
"not loaded" means the file:
is selected (by the selection rules element * ...) but:
not loaded by the load rules (load /xx/yy...)
You can see both sets of rules by doing a cleartool catcs anywhere within your view (or cleartool edcs to edit said rules)
This is typical of a snapshot view, which is the only one having "load rules" (as opposed to a dynamic view)
See:
"Before accessing files not loaded into snapshot views":
A snapshot view contains only the set of elements that you specify in the load rules of your view. (In UCM, by default, your view loads all of your project source files.)
When you restrict the scope of a view, it contains only a subset of elements in the VOB. During the course of a development cycle, you may need to see a version of an element that is not loaded into your snapshot view.
You can view nonloaded files or copy them into your view for build purposes, but you cannot check them out. Only file elements that are loaded into your view can be checked out.
"To copy a nonloaded element into a snapshot view"
cleartool get -to filename path
cleartool get -to prog.c.previous.version prog.c##/main/v3.1_fix/10

How to create a snapshot view to certain baseline in a stream in ClearCase?

I'm using CC project explorer and when I right-click the stream I don't have possibility to choose the baseline. If I try to change the baseline on already existing snapshot CC says that I can't rebase on a baseline created in the same stream.
If I try to change the baseline on already existing snapshot CC says that I can't rebase on a baseline created in the some stream.
That is normal. It means some work (checkouts/checkins) have been done since the choice of the foundation baseline.
If you need to see (as in "just look, read-only access"), you can create another project with just one stream. On that empty stream, you will be able to select whatever baseline you need (as long as the associated component is non-modifiable, you will also be able to change that baseline).
Then you create your snapshot view referencing that new "consultation" stream.
The bottom line is that you cannot consult old baselines of a component on a stream where that same component is modifiable (and has been modified)
Another way to quickly consult the content of a Baseline is:
through dynamic view (because you skip the "update" -- loading of files -- entirely
more specifically a base dynamic view -- which does not reference any UCM stream.
in this dynamic view, you simply add a selection rule on your config spec:
element * MY_BASELINE_X.Y.Z
And here you go: instant access.
You will not be able to do any checkouts because ClearCase will detect those files are part of a UCM component.
But you will be able to:
explorer the files
edit the config spec and replace the baseline by any other baselines.
2 warnings:
use the complete name of the baseline, not its title
mount the correct vob (in a dynamic view, if no vob is mounted, you will not see one file!)

Config specs and Load rules difference

What is the difference between Config specs and Load rules in Clearcase?
Are both of them edited using "cleartool editcs -tag " command only?
A config spec is a collection of:
selection rules (for selection the right versions)
load rules (only for snapshot view) for loading into your "workspace" (the snapshot view) the files selected by... the selection rules just above!
You can edit both with ct edcs (just "ct edcs" if you are anywhere in a ClearCase view).
Of course, in a dynamic view, you will only edit selection rules, since there are no "load rules":
there is nothing to "load" on your disk, since the all point of dynamic view is network access to data (very quick, and dynamic as in "automatically refreshed" if the selection rule is on "LATEST" of a branch).
Simple tricks with load rules:
a/ Use "/" even on windows
No need of load \myVob: load /myVob works too
b/ Use them in combination with "cleaning selection rules":
a selection rule is a rule at the end (before the loading rules) which selections nothing
element /myVob/* -none
Since other selection rules placed before that one does select several sub-directories, that last selection rules only means: "if it is not previously selected before, do NOT select it at all".
Consequence for a snapshot view?
Instead of writing:
load /myVob/a
load /myVob/b/b1
load /myVob/b/b2
# do not load /myVob/c
# do not load /myVob/d
load /myVob/e
(because you only want specific directories within /myVob), you can just write:
load /myVob
One simple load rule: it won't load what is not selected. and since "/myVob/c" or "/myVob/d" are not selected, they will not appear (even empty) on the disk within your snapshot view.

Resources