Config spec in rational clearcase

2020-02-06 16:47发布

I am so much new to these clear case tool.I am learning because i have a project to work on. i just learned the default config spec is

element *CHECKEDOUT
element */main/LATEST 

So the new version is created in the main branch after the previous version.
But I have been trying these, and I just changed my config spec to these

element *CHECKEDOUT
element */main/2

After those settings, when I click the file it says "file not found": I cannot check in or check out.
And then I changed to default config spec its working again.

Whats wrong?
Also tell me these How can I go to a version 4 to create a branch over there if my latest version is 6 in main ?

1条回答
够拽才男人
2楼-- · 2020-02-06 17:37

By making a selection rule:

 element */main/2

You instruct ClearCase to only show you "version 2" of... Everything:

 /my/path/to/a/File

So if any of the parent directory of 'aFile' has no "version 2' yet, you won't be able to access aFile.

You should always keep a '/main/LATEST' selection rule at the end of your config spec in order, if any of the previous rules don't work, to fall back to that one universal rule (universal because any element has at least its version 0 stored in the 'main' branch, unless 'main' has been renamed, which is very bad)

For instance:

 element * CHECKEDOUT
 element * /main/2
 element * /main/LATEST

will work, and will show you version 2 of everything if they have one, or the LATEST version if they don't.

When you want to create a branch from a certain point, it is best to not rely on a version number (because what you call 'version 4' is only valid for your file, not for your directory).
Don't forget that files and directory are versioned in a element-basis: you version a file, then a directory, then another file...: it is file-centric, not repository-centric like other VCS (SVN, Git, Mercurial, ...) with an atomic commit and one revision number for the all repo: here you have individual version number for each element (file or directory).
See "What are the basic ClearCase concepts every developer should know?" for more

It is best to have set a label first, in order to branch from there.

But if you don't have a label, my advice would be to:

  • determine a point in time where your code where at the state you want it to be for your branch
  • make a time-based selection rule
  • complete that selection rule with a mkbranch directive
  • don't forget the new files you will add on that branch (that's the '/main/0' rule)

So:

element * CHECKEDOUT
element * .../myBranch/LATEST
element * /main/LATEST -time dd-Month-yyyy -mkbranch myBranch
element * /main/0 -mkbranch myBranch
element * /main/LATEST 

will create a new branch 'myBranch' for any element created at most at the dd-Month-yyy date.

查看更多
登录 后发表回答