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.
Related
I have a branch created into the main with this config spec:
element * CHECKEDOUT
element * /main/teste_branch_nv0/LATEST
element * /main/LATEST -mkbranch teste_branch_nv0
element * /main/LATEST
Now, I want to create other branch into this branch. I am trying to use:
element * CHECKEDOUT
element * /main/teste_branch_nv0/teste_branch_nv1/LATEST
element * /main/teste_branch_nv0/LATEST -mkbranch teste_branch_nv1
element * /main/teste_branch_nv0/LATEST
but, I have a mistake:
Problems performing setcs.
ClearCase CM Server: Error: Unable to determine version for VOB root directory element.
ClearCase CM Server: Error: Unable to access "\PROJECT\IMPLEMENTATION\Fonts\ENVIRONMENT\workspace": No such file or directory.
ClearCase CM Server: Error: 1 config spec load rule problems encountered.
This is the same path that I use to create the branch teste_branch_nv0
How can I avoid this error?
You seem to have left out the rule
element * /main/LATEST -mkbranch teste_branch_nv0
element * /main/LATEST
The "stop rule" element * /main/LATEST is particularly important, because it is the one rule that will always apply.
If you have an element (like the root folder of your Vob) for which no rule apply, then you would get
Unable to determine version for VOB root directory element
That is why you should always keep as a last rule the element * /main/LATEST selection one.
See as an example "ClearCase Branching using configspec".
It will also show you that the LATEST selection rules should be written as:
element * .../teste_branch_nv1/LATEST
Because you don't know from which branch (main or teste_branch_nv0) the new teste_branch_nv1 branch will be created.
So the full config spec should be:
element * CHECKEDOUT
element * .../teste_branch_nv1/LATEST
element * .../teste_branch_nv0/LATEST -mkbranch teste_branch_nv1
element * /main/LATEST -mkbranch teste_branch_nv1
I have a code base which is drawn from the below config spec in clearcase.
element * CHECKEDOUT
element lost+found -none
element * ...\CRM_703_FP2_COE\LATEST
element * CRM_703_FP2_RELEASE -mkbranch CRM_703_FP2_COE
element * \main\0 -mkbranch CRM_703_FP2_COE
But from the above code base i have around 400 files to be drawn from another label called CRM_703_FP2_SPLIT instead of CRM_703_FP2_RELEASE.
How can i achieve this? Can i add these 400+ files along with their full path and the required release label in the above config spec to achieve this? If so how?
You need to add an extra selection rule at the right place
element * CHECKEDOUT
element lost+found -none
element * ...\CRM_703_FP2_COE\LATEST
element * CRM_703_FP2_SPLIT -mkbranch CRM_703_FP2_COE
element * CRM_703_FP2_RELEASE -mkbranch CRM_703_FP2_COE
element * \main\0 -mkbranch CRM_703_FP2_COE
The order is important (first rule that applies wins), and here versions labeled with CRM_703_FP2_SPLIT will be selected first, before versions labeled with CRM_703_FP2_RELEASE.
I have tiny question about ClearCase. Help me please! When does config spec start to work? When I click CHECK OUT or CHECK IN ? I have test.c and I have config spec
element * CHECKEDOUT
element * .../branch_1/LATEST
element * /main/LATEST -mkbranch branch_1
then I modify test.c, then I change config spec:
element * CHECKEDOUT
element * .../branch_2/LATEST
element * /main/LATEST -mkbranch branch_2
Then I Check in test.c and I have: created /main/branch_1/1. BUT WHY???
The config spec will apply the rules on each update and on checkout, and on checkin (but not as you think it would).
On checkin, the new version will be created in the branch it has been checked out (here branch_1).
That new version might not be selected by the new config spec, BUT the branch in which it has been checked out is NOT changed by said new config spec.
Changing branch1 in branch2 while test.c is already checked out (in branch1) doesn't change anything. It will be checked in in branch_1.
Now that you will create a version on branch1 on checkin for test.c (even with your second config spec), you need to realize that all future checkout/checkins will take place on that same branch for test.c, because:
the rule element * branch_1/LATEST will keep the new versions on that branch
the rule element * /main/LATEST -mkbranch branch_2 is only valid for version checked out from main (and test.c is no longer on /main, it is on branch1: /main/branch1)
This config spec would make sure that all new versions (after the first checkin of test.c on branch1) are done on branch2:
element * CHECKEDOUT
element * .../branch_2/LATEST
element * ../branch_1/LATEST -mkbranch branch_2
element * /main/LATEST -mkbranch branch_2
The order of the rules is important, because the first one that can be applied "wins" (i.e. the pothers are ignored).
See this concrete example of config spec in "Config Spec to display labeled files from 2 branches".
Note that after the first checkin of test.c, you will get a new version created on branch1, as explained before.
Yet your second config spec will select /main/1, not /main/branch1/1.
That is because of an incorrect rule in your second config spec:
element * branch_1/LATEST
This one would select the right version:
element * .../branch_1/LATEST
But if your second config spec has no rule regarding branch1, test.c will still be selected as /main/1: there is no version created on branch2, so element * /main/LATEST is the only rule that can be applied.
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.
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.