3

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

all
  • 31
  • 1
  • 1
  • 3

1 Answers1

3

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.

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • Thank you very much! I am an absolute beginner, and it is hard for me. i do not understand "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.". when I do check out test.c again what will be chosen on view? – all Apr 14 '13 at 16:13
  • 1
    @all the *second* checkout will be done according to the current config spec (that you have modified), so it will be still `branch1` (because only LATEST of main are to be checked out in `branch2`). If you want top see branch2 on the second checkout, you need an additional selection rule: `element * .../branch1/LATEST -mkbranch branch2`, put in second position. – VonC Apr 14 '13 at 16:16
  • @all no problem, I have edited my answer to add some other elements for explanation. – VonC Apr 14 '13 at 17:37
  • ok! thank you! I do this things into ClearCase and I have a result: created /main/branch_1/1, but selected /main/1 . I need help) I understand (thank you!!!:) ) that was created /main/branch_1/1 , but why do I see in tree /main/1 "reserved" ? – all Apr 14 '13 at 18:30
  • 1
    @all you mean during the second checkout? Note that reserved is set on a version which has no number in it. So in your case, a version created from `/main/1`, but not `/main/1` itself. – VonC Apr 14 '13 at 18:36
  • I am sorry, may be I say no correctly. My task: I have Conf Spec (1). ClearCase object test.c selected by view has /main/1 version. User has enough rights for branc_1 and branch_2. What will happen after the following command sequence is executed? 1. check out test.c 2. modify test.c 3. change Config Spec (2). 5. check in test.c . In result I have: created /main/branch_1/1 version of test.c and selected /main/1 version. And I do not understand it(( – all Apr 14 '13 at 18:55
  • I made mistake in second config spec! 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. AND celected /main/1 version again. BUT WHY??? – all Apr 14 '13 at 20:44
  • @all I believe my answer has all the answer you need. – VonC Apr 14 '13 at 20:45
  • @all note that you can edit your question. Read also attentively http://stackoverflow.com/about – VonC Apr 14 '13 at 20:47
  • @all my latest edit answer your revised question. See the last four lines. – VonC Apr 14 '13 at 22:03