Details of config spec in base ClearCase - clearcase

My base ClearCase config spec reads like this:
element * CHECKEDOUT
element * .../Branch_F13R2/LATEST
All is good, but I am wondering what is the .../ doing at the beginning of the path? In UCM, we can see the streams and VOBS in Clear Case explorer, but in base ClearCase, how to know that if I want to check out from Branch_F13R2, I need .../ at the beginning?

That is because you don't know the parent branch.
.../ in a selection rule allows for ClearCase to select that branch, from whatever branch it comes from: /main, or any other branch.
To see more about that notation, called ellipsis wildcard, see "Find all files modified in a specific ClearCase branch?".
I would also recommend to add the rule
element * /main/LATEST
Not every parent directory has a version in the branch you are looking for, and without this last selection rule, it would have nothing to select, making any sub element inaccessible.

Related

Clearcase config spec for different selection rules per vob in view

The team would like to perform their work with one webview (instead of a view for each vob). vob1 work should be done on main, whereas vob2 work should be done on a different branch (branch1 below). I am not sure what the conceptual problem is with my rules below. I expected that since clearcase will match rules from top to bottom it would apply the selections for vob1 I have specified.
The config Spec I tried will checkout files for vob1 on branch1 instead of main.
element * CHECKEDOUT
element /vobs/vob1/* .../main/LATEST
element /vobs/vob1/* /main/LATEST
element * .../branch1/LATEST
element * /main/LATEST -mkbranch branch1
element * /main/0 -mkbranch branch1
load /vobs/vob1
load /vobs/vob2
Is my desired goal possible? What is the error above?
First, don't hesitate to make a dynamic view in order to test your selection rules: you will see immediately if said selection matches what you need, without having to re-update your snapshot view.
Second, try element /vobs/vob1/... instead of /vobs/vob1/*: that will include the vob root folder itself.
See "Pattern" in the page "config_spec".

ClearCase checkout branch in VOB

I'm new to CC and I'm coming from Git and Mercurial background, probably thats why ClearCase confused me so much. I've been assigned a task to migrate latest CC's revisions to Git. Problem is that I couldn't manage to checkout any branch other than main in CC.
I have a view that displays all VOB's /main/LATEST revision. I assume, main branch's latest revision.
element * CHECKEDOUT
element * /main/LATEST
Now I need to get the list of other branches in a particular VOB. To do that, I navigate from terminal in that folder and run
cleartool lstype -kind brtype -invob /%VOB_NAME%
and I can see the list of branches. Correct me if I'm wrong, but I assume, it displays only the branches relevant to VOB(%VOB_NAME%).
Now I need to checkout the branches. What is the standard way of doing this. I tried updating config spec with something like:
element * /%VOB_NAME%/%BRANCH_NAME%/LATEST but it doesn't seem to work.
Pretty sure I'm not doing it correctly.
Also for migration purpose, I'll need to automate the steps to acquire branches and checkout the branches. I guess updating config spec to switch branch in a view takes some time and probably is an async operation, so is there a way to determine when view finishes updating?
Or maybe there's command line option to switch branch for a particular VOB in a view?
So in short, here's my questions I'm struggling with:
Than
Am I acquiring VOB branches correctly?
How can I checkout a particular branch?
Is there a way to determine when checkout finishes?
thanks
UPDATE
ok I tried #VonC's recommendation so my config spec looks like this:
element * CHECKEDOUT
element * .../heine_1/LATEST
element * /main/LATEST
If I'm guessing correctly, one VOB containing branch named heine_1 should checkout that particular branch, the rest of VOBs will stay on main branch, but this is not the case. When I run cleartool ls inside that VOB, its still on main branch. All folders are postfixed with Rule: /main/LATEST. So I guess it didn't switch the branch.
Thanks
There are a few questions in the original question and the comments.
Addressing the configspec issue first...
The syntax of an element rule is:
element {path} {version rule} {optional clauses}
If you need a VOB-specific rule, you can do something like this:
element \myvob\... ...\myvobbranch\LATEST
element \myvob\... \main\LATEST -mkbranch myvobbranch
The "..." in the path means "this location and everything underneath it."
The "..." in the "version rule" means that the branch name is at the end, so this would match /main/myvobbranch/LATEST, /main/br1/myvobbranch/LATEST, etc.
If you're working on a branch, you generally want new files or work to appear on the branch you are working in, and the second line makes that happen.
Everything in a configspec is case sensitive, so be aware that "LATEST" is not "latest."
Since the view was created for you, I'm reasonably certain that it is a dynamic view. If it is mapped to a drive, it's definitely dynamic. If you need to know for sure, you can CD into the "working area" of your view and run "cleartool lsview -pro -full -cview" and look at the "attributes" line. The line for a dynamic view will look like this:
Properties: dynamic readwrite shareable_dos
On the direct questions:
Yes, you are acquiring the branch list correctly.
By default the checkout is done using the version selected by the view, you can use cleartool checkout -branch {full branch path} {file name} to check out the latest on a branch, or cleartool checkout -version {version id} {file name} to check out a version other than the latest on a branch. I would not recommend either as a normal practice. The -branch will cause checkins to go to the element's parent branch. The -version would require add a requirement to perform a merge to get the checkin to complete, which would also go to the version's parent branch.
Checkout is finished when the command finishes.
A big "new user gotcha" is that directories are also versioned objects. If you're adding files to source control, you need to remember to check the directory in so that they are visible by others with similarly configured views. The ClearCase GUIs have this behavior as a default if you started the process with the directory NOT checked out, but not if you explicitly checked out the directory beforehand.

Editing config spec after creating branch

I wanted to create a dynamic view with the following config spec:
element * CHECKEDOUT
element * .../view_1_1/LATEST
element * LABEL_1 -mkbranch view_1_1
element * /main/LATEST -mkbranch view_1_1
Unfortunately I have written the config spec wrong; I didn't write the "..." in the second line (element * /view_1_1/LATEST). After this, I have given the 'mkbrtype -global -c "some comment" view_1_1' command and make it visible in Windows (ClearCase Explorer) using Region Synchronizer.
And I realized that I have forgotten '...', so I corrected the config spec. I corrected this before any checkouts, checkins or something.
Does this edit cause any problems, or any differences than other views created with the correct config specs?
Does this edit cause any problems, or any differences than other views created with the correct config specs?
No, this edit is in the config spec of your view, and remains local to this view.
It has nothing to do with the fact the view tag was made visible through the Region Synchronizer.
The OP groove asks in the comments:
Is this true for editing config spec after "mkbrtype" too?
Yes: the brtype can change, the config spec will use that modified brtype at the next refresh.
The '...' is a simple selection rule modification, which means it will select different elements based on the new rule (.../view_1_1/LATEST instead of /view_1_1/LATEST or /main/view_1_1/LATEST).
If the brtype doesn't exist yet, or if its comment changes, that selection rule would simply be ignored.
config spec is read from the top to bottom by actived view. If the view finds one version of file/folder's tree, stop reading the next config spec.
In your case, when the view read second line element * /view_1_1/LATEST, since there is no branch /view_1_1, just ignore it, nothing happens, and continuously read the rest.
mkbrtype is used to define the properties and create branch type view_1_1 (not create the branch on that element). You need know command mkbrtype and mkbranch are different.
mkbranch
Creates a new branch in the version tree of an element
http://publib.boulder.ibm.com/infocenter/cchelp/v7r0m0/index.jsp?topic=/com.ibm.rational.clearcase.cc_ref.doc/topics/ct_mkbranch.htm
mkbrtype
Creates/updates a branch type object
http://publib.boulder.ibm.com/infocenter/cchelp/v7r0m0/index.jsp?topic=/com.ibm.rational.clearcase.cc_ref.doc/topics/ct_mkbrtype.htm

Maintain Checkout Across Merge

I have a file checked out unreserved, and am looking to merge it to the newest version, but not check it in.
IE, I have a file I have made extensive (but not complete) changes to, and want to merge it up to the current version (which also has extensive changes). I do not want to check it in because it would break other folks projects.
Is this even possible / how would I go about doing it?
Thanks in advance
One way would be to change your config spec in order to add an mkbranch option:
(assuming base ClearCase here, not UCM ClearCase)
element * .../aPrivateBranch/LATEST
element /path/to/file .../aBranch/LATEST -mkbranch aPrivateBranch
element * /main/0 -mkbranch aPrivateBranch
That way, a checkin of your file would:
trigger the merge with the LATEST version of the branch you are currently in ('aBranch')
check a new version in another branch ('aPrivateBranch'), not disturbing your colleagues.
And you would continue other works in a private branch.

How can I retrieve a file through Label in Config Spec?

I have labelled a file "Test.java" with a label called "My_Label".
When I try creating a view with the below config specs, I am unable to get the file in Clearcase Explorer.
element * CHECKEDOUT
element * My_Label
Could anyone please tell where am I going wrong in the above config spec?
That selection rule alone isn't enough.
You need to add, before that rule, other rules that will select the right version of the parent directories.
In other words, if your parent directory (or one of the ancestors) of Test.java isn't labelled with My_Label, it won't be selected at all.
So your file won't be accessible by your view, even though you have the correct selection rule for you file.
Check if the Vob itself has been labelled with MyLabel.
If not, I would recommend at least to add one final "stop" rule (/main/LATEST: see "ClearCase Branching using configspec" for an illustration of that rule):
element * CHECKEDOUT
element * My_Label
element * /main/LATEST

Resources