我是按IBM网站上面的一个脚本做的,给我们的开发人员用了之后,觉得还不错
我是按IBM网站上面的一个脚本做的,给我们的开发人员用了之后,觉得还不错。
1)、开始-运行-clearmenuadmin.exe,弹出ClearCase Context Menu Edit for Windows Explorer
2)、Application中选择ClearCase Explorer(因为我们习惯在ClearCase Explorer中操作CC,先加这个吧,如果习惯在windows中操作的,也可以选择windows Explorer,下面的操作同样)
3)、在Object Type中选择Snapshot views --VOB--Directory。(如果我们使用了动态视图,那么也要选择动态视图再加一次:Dynamic-views drive--Dynamic view--VOB--Directory)
4)、Object State中选择View Private
5)、选择Available Menu下方的New...按钮,在弹出的窗体中输入如下内容,然后点击确定按钮:
Menu Text: Add to source control (recursively)...
Help Text: Add to source control (recursively)...
Command Type: Executable
Command: \\机器名\script\add-to-src-control.bat
Initial Directory: $dir_or_file1
Arguments: $file
Comment: 加入目录及其子目录
6)、在Available Menu选择刚自定义Add to source control (recursively)...菜单,点击" < Add" 按钮,加入到左边的This menu Contents中
7)、选择Configuration下的Apply菜单,完成自定义菜单的设置。选择一个个私有目录,点击右键菜单,会发现多了一个Add to source control (recursively)... 的菜单。
Add to source control目录及其子目录
8)、在ClearCase explorer中,选择需要add to source control的文件夹,点击右键菜单,在弹出的菜单中选择Add to source control (recursively)... 菜单;
9)、开始运行配置好的Command: ,然后会弹出clearcase -choose elemements put over version control的窗体,选择所有列出来的,点击“Yes”按钮;
10)、会弹出add to source control的窗体,选择一个关联的活动,点"Apply to all"按钮,那么CC会自动把选中的这个目录及其子目录下的文件全部加进去。
1-7步)只要第一次设置就可以了,以后的add to source control目录及其子目录只要运行8-9)步就行了。
add-to-src-control.bat
@rem= 'PERL for Windows NT -- ccperl must be in search path
@echo off
ccperl %0 %1 %2 %3 %4 %5 %6 %7 %8 %9
goto endofperl
@rem ';
###########################################
# Begin of Perl section
$start_dir = $ARGV[0];
#
# Fixed variable
#
$S = "\\";
$list_file = "c:".$S."list_file";
$list_add = "c:".$S."list_add";
$choosed = "c:".$S."choosed";
sub clean_file
{
$status = system("del $list_file > NUL 2> NUL");
$status = system("del $list_add > NUL 2> NUL");
$status = system("del $choosed > NUL 2> NUL");
}
#
# Start of the script...
#
printf("add-to-src-control $start_dir...\n");
clean_file();
$status = system("cleartool ls -view_only -r -s $start_dir > $list_file");
open(LIST_ELEMENT,$list_file);
while ($element=<LIST_ELEMENT>)
{
chop $element;
# printf " Processing $element ";
if ($element =~ /CHECKEDOUT/)
{
# printf(" checkedout file \n");
}
else
{
# printf " view private \n";
printf " Processing $element ...\n";
#
# For files with spaces...
#
if ($element =~ / /)
{
$status = system("cmd /c echo \"$element\" >> $list_add");
}
else
{
$status = system("cmd /c echo $element >> $list_add");
}
}
}
close(LIST_ELEMENT);
if (-e $list_add)
{
$listelement = `type $list_add`;
$listelement =~ s/\n/,/g;
$status = `echo $listelement > $list_add`;
$status = system("clearprompt list -outfile $choosed -dfile $list_add -choices
-prompt \"Choose element(s) to put over version control : \" -prefer_gui");
if ($status != 0)
{
# printf("\n Aborting ...\n");
clean_file();
exit $status;
}
#
$listtoadd = `type $choosed`;
$listtoadd =~ s/\n//g;
printf("\n cleardlg /addtosrc $listtoadd");
$status = system("cleardlg /addtosrc $listtoadd");
clean_file();
exit $status;
}
else
{
# printf("\n No files founded...\n");
clean_file();
exit $status;
}
# End of Perl section
__END__
:endofperl