views:

1223

answers:

3

For example, instead of writing the following:

element * .../my_branch_01/LATEST
element * .../base_branch/LATEST -mkbranch my_branch_01

I would want to write something like this:

MY_BRANCH=my_branch_01
element * .../%MY_BRANCH%/LATEST
element * .../base_branch/LATEST -mkbranch %MY_BRANCH%

Is this even possible? What is the correct syntax?

+1  A: 

It's been a while since I worked in ClearCase (we switched to Subversion), but if I recall correctly there is no way to do this native to ClearCase.

You could use or write a script generator that would create your spec file and then include that in the actual spec:

element * CHECKEDOUT
include scripted_file_output

Then run

cleartool setcs -current

The problem with this approach is that I believe the include spec would need to be regenerated and the cleartool setcs run whenever you change the value of MY_BRANCH.

Gary.Ray
+1  A: 

The only native way to do this in ClearCase is to use attribute within a config-spec.

According to the version selector rules, you can make a "selection by query" rule, based for instance on an attribute:

element * ...{MY_ATTRIBUTE_NAME=="aValue"}

would select the LATEST version on any branch with an attribute 'MY_ATTRIBUTE_NAME' with 'aValue' in it.

That mean you need to change the attribute value on the old branch, put it on the new branch, 'cleartool setcs' your view again, and you should have a new content based on a new version selection.

Not very straight forward, but it could work, except for the mkbranch part (which needs a fixed name).


Regarding GeekCyclist's answer, a few comments:

The solution to include a common config spec can work for Base ClearCase solution, but:

  • need to be in a share available by all concerned developer
  • the setcs is indeed necessary to Ccuses the view_server to flush its caches and reevaluate the current config spec, which is stored in file config_spec in the view storage directory. This includes:
    • Evaluating time rules with nonabsolute specifications (for example, now, Tuesday)
    • Reevaluating –config rules, possibly selecting different derived objects than previously
    • Re-reading files named in include rules
  • all the other developers need to be notified when the common included config spec file changes (there is no native notification included in ClearCase)


If you need to have one "environment" (i.e. one "view" or workspace) with a variable content (depending on a different branch), you need to define a symbolic link (or a windows subst) pointing to different views (each with their own config spec)

That way, you only have to change the link (or the path subst'ed) in order to change the config spec associated with a given fixed path.

VonC
A: 

Can i read the label name from any other file in config spec file?How can i get the variable in config spec file?

I am trying below one .but it's not working...

Select checked out versions element * CHECKEDOUT element -file * {Release.version} include /build.properties

Component selection rules...

Here i want to read this variable Release.version from build.properties file..

Plz help me..

sam
This should not be posted as a response to my question. Please post it as a new question.
LeopardSkinPillBoxHat