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.
Related
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
I have created a symbolic link for folder1 to make it available in vob2\rootdir from vob1\rootdir.
And I labeled the whole directory folder1 recursively in vob1.
But when I modified the configspec of dynamic view to load folder1, it was loaded under vob1; But I couldn't see that folder in vob2\rootdir. Pls help.
First you don't modify a config spec to load anything in a dynamic view: you only modify selection rules, there is no load rules (as opposed to snapshot view).
If you were actually using a snapshot view (with a path different from M:\ or /views), then beware of symlink resolution issue like this one.
Finally, if your config spec doesn't select vob2/rootdir, or if it doesn't select the version which recorded the symlink, you wouldn't be able to see said symlink.
That means, labelling vob1/folder1 isn't enough: you need to make sure that:
/vob2 is labelled
/vobs2/rootdir is labelled as well
In other words, the parent folders of your final selection target (target being '/vobs/rootdir/folder1) must be selected.
Is it possible in clearcase to checkout a file for modification such that it is impossible to check it back in? I’m going to be hacking some files on a private branch, only some of which I want to ever check in. I want to eliminate the possibility of accidentally checking in unwanted changes. (I know we can write a trigger to check for magic keywords in the checkout comment; I'm look for something built-in to CC.)
"Hacking some files" is spelled in ClearCase lingo: hijacked files in a snapshot view.
All you have to do is to:
lock those files (except for the few developers you know are likely to checkout/checkin the files: cleartool lock -nusers userA,userB,... aFile)
create a snapshot view
change the read/write right (at the OS level, nothing to do with ClearCase here)
modify them directly (without checkout them first, hence the "hijacked" state)
The OP Kevin Little adds in the comment:
Alas, we only use dynamic views
Easy enough:
"Hacking some files" is also spelled in ClearCase lingo: eclipsed files in a dynamic view.
All you have to do is to:
lock those files (except for the few developers you know are likely to checkout/checkin the files: cleartool lock -nusers userA,userB,... aFile)
create a dynamic view
copy the files you need to modify as aFile.tmp
modify the config spec to not select them
copy them back to their original name (they became "eclipsed" as their private version override their official versioned counterpart)
remove the "none" selection rules from the config spec
modify them directly
To not select them, add to the config spec (ct edcs) before the other rules:
element /a/path/to/aFile1 -none
element /a/path/to/aFile2 -none
...
To restore them, all you have to do is move or remove those files.
They will be dynamically be replaced by their original and still versioned element.
I don't know about the administration. From a user standpoint, you could have 2 views. In one view, checkout the files you don't want to check in. In the other view (your view), check them out unreserved. Then, if you try to check them in, you'll get an error because they're checked out to the other view.
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.
Good morning,
is there any way to exclude only one particular directory from a snapshot's load statement, e.g. I want to load a whole vob named 'PM_CT' except the \PM_CT\lost+found directory
... is there an elegant way to do it? And how would I generally exclude all lost+found directories across multiple loaded vobs?
Cheers and Thanks,
-Jörg
I would like to make an addition to the previously posted answer:
The lost+found directories
To exclude the lost+found directories across all VOBs you can modify the previously proposed selection rule to be more generic:
#Skip the lost+found directories
element .../lost+found -none
However, using the '-none' flag causes the Windows ClearCase client to list errors when updating a snapshot view:
Unable to load "lost+found": no version selected in configuration specification.
Unable to load "lost+found".
It also does not properly unload any previously loaded folders or files, so you may need to recreate your snapshot view (or unload/reload the VOB) with the new selection rule if you really want to clean out the lost+found directories...
Elegance
For excluding any normal folder, the "elegant way" would be to specifically load the /main/0 version of the folder:
#Exclude the contents of a directory
element /VOB_name/folder_path /main/0
This will cause the folder to be loaded as empty and will not produce an error. It will also properly unload any loaded files. It unfortunately does not work for the lost+found directory, because it is always listed as version /main/0.
element /PM_CT/lost+found -none
The "elegant" way consists of:
adding a selection rule (here "-none")
loading all PM_CT without aking any question (load /PM_CT), if your view is a snapshot one
Note: in a config spec, always use "/": it is easier, and Windows as well as Unix ClearCase views will be able to interpret it.
Caveats:
the previous solution is for one vob, I do not think you could use "wildcard" for multiple vobs
the '-none' option can cause a snapshot view to fail during a deliver or rebase (UCM merge): for that kind of operation, a dynamic view would be more suited. That is for CC 2003.06 and early 7.0. I think it works better with the latest CC7.1.0.2
Note: that selection rule can also be used for dynamic views, in order to mask some directory you would not want to see.