How can I select a specific version of the root folder (.) in a snapshot view (Base ClearCase 7.1.2.9, no UCM)? - clearcase

Stumbled over this at work yesterday: I have a small VOB and created a snapshot view to access the data (source files) in it. If I give the ConfigSpec as:
load /vob/extern
element * CHECKEDOUT
element * /main/LATEST
, I will see all elements in their "LATEST" version and running a cleartool describe or xlsvtree on a single element can confirm this. Fine.
There is a src folder at the top level, having the versions "0-2", and when I setup the ConfigSpec as
load /vob/extern
element * CHECKEDOUT
element src /main/1
element * /main/LATEST
I can select the "1" version of the src directory, while keeping all other elements at "LATEST". Super.
However, this doesn't seem to work with the root folder (versions "0-7"). When I edit the ConfigSpec to
load /vob/extern
element * CHECKEDOUT
element . /main/6
element * /main/LATEST
, the version "6" of "." doesn't get selected (it's at "7"=LATEST again)! How can I accomplish this in a snapshot view?
I have also made the following, admittedly desperate, attempts
element "." /main/6
and
element "\." /main/6
, but to no avail. Searched the web/stackoverflow for quite a while and the man pages for "version_selector", "config_spec" and "wildcards_ccase" didn't offer me any explanation for the current behaviour.
I also tried another
rm -rf *
cleartool update
after setting the ConfigSpec, but the version of "." stays at "7".

The relative path '.' does not seem to work, and the config spec falls back to the next valid rule.
Try and use, after reading config_spec Pattern, an absolute path:
element /vob/extern /main/6
# or
element /vob/extern/ /main/6

Related

Base Clearcase - A particular config spec

I want the LATEST archived elements everywhere except in folder /view/my_view/vobs/the_vob/xxx/yyy/ where I want elements tagged LBL_01. The config spec below doesn't work.
element /the_vob/xxx/yyy/... LBL_01
element * CHECKEDOUT
element * /main/LATEST
You cannot apply the rule directly to /the_vob/xxx/yyy/
You need first to select the parent folder versions:
/the_vob
/the_vob/xxx
So:
element * CHECKEDOUT
element /thevob /main/LATEST
element /thevob/xxx /main/LATEST
element /the_vob/xxx/yyy/... LBL_01
element * /main/LATEST
The order is important: first select the parent folders, then apply your special rules.
If this is on Unix, the VOB tag to use would be /vobs/the_vob and not /the_vob. The path in the element line needs to be the VOB tag as shown by lsvob on the view server.
I am guessing that by "doesn't work" you mean a cleartool ls shows that you're seeing /main/LATEST as the rule.

Can't Create Directory Element With Multi-Branching in Base ClearCase

I am workng with base ClearCase. Please consider my config spec:
element * CHECKEDOUT
element /cl5_sw_ste/DCT/*/... /main/rel_drop5/int_drop5/cl5_p65719_AUTE/LATEST
element /cl5_sw_ste/DCT/*/... /main/rel_drop5/int_drop5/LATEST -mkbranch cl5_p65719_AUTE
element /cl5_sw_ste/DCT/*/... /main/rel_drop5/LATEST -mkbranch int_drop5
element /cl5_sw_ste/DCT/*/... /main/0 -mkbranch rel_drop5
INTENT: Any checkout of existing elements automatically occurs on branch /main/rel_drop5/int_drop5/cl5_p65719_AUTE and that this branching scheme is used automatically for the creation of any new elements (of which I presently have none).
When I navigate to the root of VOB cl5_sw_ste in ClearCase Explorer, select New--> Folder from the right pane's context menu, and try to create my first element---directory element DCT---, I receive the following error:
The system cannot find the file specified.
Why is this occurring?
Thanks,
Dave
Those selection rules are for elements inside DCT, not for DCT itself.
When you are adding DCT, it creates a version in /main/0.
And none of your rules selects /main/0.
you should add least add one selection rule at the end:
element * /main/LATEST
That is called a "config stop-rule", as illustrated in "ClearCase Branching using configspec".

How can I update my branch from main and accept all of their changes in clearcase?

I grabbed a file and did: rm -f theFile.C && ct update . to watch it get reloaded. Then I went to a different snapshot view of main and ran ct update . and the files differ. I am very perplexed about this given after doing that I would expect them to be the same!
The EDCS for my "main snapshot" is:
element * CHECKEDOUT
element * /main/LATEST
load /ntrepo
and my EDCS for my branch is:
element * CHECKEDOUT
element * /main/branch_name/LATEST
element * /main/LATEST -mkbranch branch_name
element * /main/LATEST
load /ntrepo
In an snapshot view, when the file doesn't match the expected version, the first thing to check is:
cleartool ls /path/to/parent/directory
And see what cleartool returns for that file.
For instance:
it could be hijacked, which means a ct update . wouldn't overwrite the locally modified file.
it could have a different version on branch_name, since that selection rules comes before /main/LATEST.

Clearcase: moving a sub branch to a main branch

In clearcase I started work on a branch called main/release4/release5. After I had began my work, release4 was merged into main. My coworkers started work on main/release5. Is there anyway I can move my main/release4/release5 work to main/release5?
So far, I've tried to merge from main/release4/release5 to main/release5 but that didn't work. The files stayed on main/release4/release5.
Visual example of what it looks like in version tree:
main
| \
| release 4
| / \
main release 5
\ \
release 5 *move files from here
\
*to here
Here is the original config spec I was working with.
element * CHECKEDOUT
element - directory * /main/LATEST
element * /main/release4/release5/LATEST
element * /main/release4/LATEST -mkbranch release5
element * /main/LATEST -mkbranch release4
Here is the config spec my coworkers started with after merging release 4 with mainline
element * CHECKEDOUT
element - directory * /main/LATEST
element * main/release5/LATEST
element * main/LATEST -mkbranch release5
The idea of those selection rules ending with branchname/LATEST -mkbranch newBranch is to allow an element (file or directory) to start a new branch from whatever version happens to be the LATEST, unless there are already versions on said newbranch.
So it is a file-by-file mechanism.
To ensure all files to start from the release4 merged into main, put a label on all elemenents of main/LATEST right after that merge (preferably using the snapshot view used for said merge), then use a config spec like:
element * CHECKEDOUT
element * .../release5/LATEST
element * REL4 -mkbranch release5
element * main/LATEST -mkbranch release5
Starting a branch from a fixed label is safer than starting from /main/LATEST (which can see a new version at any time)
The OP Gregory Peck comments:
using .../release5/LATEST fixed it!
The reason the "three dots" syntax worked (as illustrated in "clearcase latest version of a file on a particular branch") is that some versions had their branches starting from the release4 branch, other from main.
With .../release5/LATEST, you select the LATEST of release5, no matter which branch release5 is starting from.

ClearCase Branching using configspec

I have very little knowledge about ClearCase and would like to learn more.
I have created a branch BR_PHASE2 under /main.
I have used the following command to checkout the files into the branch:
element * CHECKEDOUT
element * .../BR_PHASE2/LATEST
element * /main/LBL_MS_PHASE2_04-NOV-2010 -mkbranch BR_PHASE2
The problem now is how do I access files from the branch ??
I am not able to even open the VOB if I switch to this config spec:
element * CHECKEDOUT
element * /main/BR_PHASE2/LATEST
Am I writing the config spec wrong ?? The error i am getting when I try to set the config spec as above:
Warning: New config spec makes current working dir invisible.
What are the steps to actually access the branch that I have created ??
The problem is:
What directories actually have:
a version in the branch BR_PHASE2 ?
a version labeled LBL_MS_PHASE2_04-NOV-2010 ?
If you only branch/labeled all files under /myVob/myDirectory, then the directory /myVob itself won't never be branched/labeled.
That means the following config spec won't be able to select any version for /myVob, making all the other rules for any file under /myVob useless:
Until ClearCase is able to select at leat one valid version of /myVob, it won't be able to select any version for any file under /myVob.
element * CHECKEDOUT
element * /main/BR_PHASE2/LATEST
You should always end your config spec with a "config stop-rule" like:
element * /main/LATEST
or at least:
element /myVob /main/LATEST
Add one of those at the end of your config spec, and the view should work as expected.
The ClearCase config spec mechanism is a composition-based one: to know more about it, see the SO answer "Flexible vs static branching (GIT vs Clearcase/Accurev)".
The OP adds:
You have mentioned to always end the cs with: element * /main/LATEST,
Not necessarily:
If you want to be sure to only view the files under /myVob/myDir with the right branch/label, you could use as I mentioned above:
element /myVob /main/LATEST
The rule applies only to /myVob (not to anything under /myVob).
That allows ClearCase to get past /myVob (because it can at least select a valid version for it) and start applying the other selection rules to the sub-directories.
but if I want to check out the files only from the branch BR_PHASE2, wont this create an error. I am saying that when I end it with /main/LATEST and checkout and check in files , it is updated in main branch. what do I do about it ?
It depends on the config spec you are using:
element * CHECKEDOUT
element * /main/BR_PHASE2/LATEST
element * /main/LATEST
would indeed create new version in the main branch
element * CHECKEDOUT
element * .../BR_PHASE2/LATEST
element * /main/LBL_MS_PHASE2_04-NOV-2010 -mkbranch BR_PHASE2
element * /main/LATEST
would not, because the third rule would apply first, if the element has been labeled LBL_MS_PHASE2_04-NOV-2010.
Your first config spec seems to be ok. It sais that all the files you try to change from the label 'LBL_MS_PHASE2_04-NOV-2010' will be branched to BR_PHASE2. Just try to checkout something, and watch the version tree.
Also, the second config spec tells to see all the files, that belong ONLY to the branch, but if you haven't checkout to branch any, then you will see nothing.
Try the following:
element * CHECKEDOUT
element * /main/LBL_MS_PHASE2_04-NOV-2010
element * /main/BR_PHASE2/LATEST
so that you have the directory structure by selecting the label and your files from branch.

Resources