需要脚本/实用工具来标记给定路径的MOST(如果不是全部)ClearCase元素 [英] Need script/utility to label MOST, if not all, ClearCase elements for a given path

查看:37
本文介绍了需要脚本/实用工具来标记给定路径的MOST(如果不是全部)ClearCase元素的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我发现,如果要成功地重新创建特定的代码(标签)发行版,则必须从VOB开始应用标签.我以为您不必以VOB名称开头,但是您可以:-(

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 :-(

我的VOB中包含许多程序.例如:

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.

它不应将标签应用于其他不相关的目录(即,如果我要标记Java \ Program1,则它也不应也标记Java \ Program 2.

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.

似乎很早以前该功能已经合并到GUI或脚本中,但是我看不到可用的功能.当然,您可以手动执行此操作,但这会花费更长的时间,尤其是如果您的路径很长.

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.

我知道您可以标记目录以及该目录下的所有内容,但是如果您从VOB开始,则会标记所有内容(我不想要的内容).

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).

推荐答案

最简单的解决方案是:

  • 从路径中递归应用标签

  • 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
    

  • 根据您的脚本语言,提取父文件夹可以像perl一样容易. File:: Basename

    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");
    

    这篇关于需要脚本/实用工具来标记给定路径的MOST(如果不是全部)ClearCase元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    相关文章
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆