2


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 ??

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
Madan
  • 21
  • 1
  • 1
  • 2

2 Answers2

4

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.

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • You have mentioned to always end the cs with: element * /main/LATEST, 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 ? – Madan Nov 22 '10 at 15:02
  • @Madan: I have addressed your questions in my - updated - answer. – VonC Nov 22 '10 at 15:18
  • Thanks a lot. Will try this solution and come back with queries, if any. – Madan Nov 22 '10 at 15:23
0

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.

Vladimir Ivanov
  • 42,730
  • 18
  • 77
  • 103
  • I have checked out some files from the label 'LBL_MS_PHASE2_04-NOV-2010' to the branch BR_PHASE2. I got a confirmation that the files were successfully checked into the branch.But when i try to set the config to : element * CHECKEDOUT element * /main/BR_PHASE2/LATEST , i am getting the error. Also I am not able to open my VOBs and any folder structure under the newly created branch.It says folder or directory not found when I try to access it, but 'ls' lists the directory structure and all folders seems to be present. Any solution for this problem ?? – Madan Nov 22 '10 at 14:10
  • it seems to me, that the config spec doesn't show you the directory tree, because you just don't see it under your config spec. you should correct your last cs, see the updated answer. – Vladimir Ivanov Nov 22 '10 at 14:22
  • Thnx for the latest code. Seems to work , but the problem is I am not able to understand how the config spec chooses which branch to checkout the files from and since you have given both the label from main and latest from BR_PHASE2, the directory structure visible now is from main or from the branch ?? – Madan Nov 22 '10 at 15:00
  • You need to understand that all the versioning is applied not to the tree but to the partcular elements. So, if you can't see the tree, you can't see the files. try to read this manual, may be it will help: http://publib.boulder.ibm.com/infocenter/cchelp/v7r0m0/index.jsp?topic=/com.ibm.rational.clearcase.tutorial.doc/a_how_configspec_works.htm – Vladimir Ivanov Nov 22 '10 at 15:05
  • Thanks !! Will do some experimenting and come back with more queries. – Madan Nov 22 '10 at 15:14