Need script/utility to label MOST, if not all, ClearCase elements for a given path

…衆ロ難τιáo~ 提交于 2019-12-08 08:34:34

问题


I found out that labels must be applied starting at the VOB if you want to successfully recreate a specific code (label) release. I thought you wouldn't have to start at the VOB name but you do :-(

My VOB has many programs in it. For example:

VOBname\programs\Java\Program1\files...
VOBname\programs\Java\Program2\files...
VOBname\programs\VB\Program1\files...
VOBname\programs\VB\Program2\files...

What I would like to do is have a script or program that takes two parameters, a path and label, and applies that label to the proper directories and files in that path.

It should not apply the label to other, non related, directories (i.e., if I am labeling Java\Program1 it should not also label Java\Program 2.

I also need the reverse - If someone incorrectly applies the label, then I need to remove the label from the path.

It seems like this feature would have been incorporated into the GUI or a script long ago but I don't see one available. Of course, you can do this manually but this takes longer especially if you have a long path.

I know you can label a directory and all contents underneath that directory but if you start at the VOB, that would label everything (what I don't want).


回答1:


The simplest solution is to:

  • apply recursively a label from the path

    cd /path
    cleartool mklabel -replace -recurse LABEL
    
  • for a given path, extract the parent folders, and label those:

    avob/
    avob/aParentFolder
    avob/aParentFolder/aParentSubFolder
    

Depending on your scripting language, extracting the parent folders can be as easy as perl File::Basename

my($filename, $directories, $suffix) = fileparse($path);
# On Unix returns ("baz", "/foo/bar/", "")
fileparse("/foo/bar/baz");


来源:https://stackoverflow.com/questions/24810202/need-script-utility-to-label-most-if-not-all-clearcase-elements-for-a-given-pa

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!