【发布时间】:2018-11-22 22:01:30
【问题描述】:
我需要查找过去 30 天内未修改的文件列表。这意味着在过去 30 天内,任何分支下都不应有该文件的版本。这在基本的 clearcase 中是否可行?
【问题讨论】:
我需要查找过去 30 天内未修改的文件列表。这意味着在过去 30 天内,任何分支下都不应有该文件的版本。这在基本的 clearcase 中是否可行?
【问题讨论】:
首先尝试,从query_language和cleartool find,语法
cleartool find <vobtag> -element "!{created_since(target-data-time)}" -print
如果这不起作用,您将不得不退回到:
关于所说的第一个列表(来自“How to determine the last time a VOB was modified”),使用cleartool find:
cleartool find <vobtag> -element "{created_since(target-data-time)}" -print
or
cleartool find <vobtag> -version "{created_since(target-data-time)}" -print
该文档还提到了cleartool lshistory -minor -all .,但这并不可靠,因为它使用了可以随时废弃的本地元数据。
对于第二个列表:
cleartool find . -cview -ele -print
【讨论】:
这是一个示例 Perl 脚本,用于执行您的要求。这有一个硬编码的日期字符串,以避免陷入 Perl 日期算术的困境。它获取 VOB 中所有元素的列表,然后从该列表中删除自指定日期以来修改版本的元素,最后输出未修改的元素。
#!/usr/bin/Perl -w
my %elem_hash;
my $datestring="01-jan-2014";
my $demarq= "-------------------------------------------------";
my $allelemtxt="-- All elements located in the current VOB --";
my $ver_hdr ="-- Versions modified since $datestring --";
my $nonmodtext="-- Elements not modified since $datestring --";
#
# Get all elements in the current VOB.
#
$cmdout=`cleartool find -all -print`;
@elemtext=split('\n',$cmdout);
#
# Add them to a hashmap, simply because it's easier to delete from this list type
#
foreach $elem (@elemtext)
{
# Quick and dirty way to remove the @@
$elem = substr($elem,0,length($elem)-2);
$elem_hash{$elem} = 1;
}
#
printf("\n%s\n%s\n%s\n",$demarq,$allelemtxt,$demarq);
foreach $elem2 (sort (keys (%elem_hash)))
{
printf("Element: %s\n",$elem2);
}
#
# Get VERSIONS modified since the specified date string
#
$cmdout=`cleartool find -all -version "created_since($datestring)" -print`;
@vertext=split('\n',$cmdout);
#
# strip the trailing version id's and then delete the resulting key from the hashmap.
#
printf("\n%s\n%s\n%s\n",$demarq,$ver_hdr,$demarq);
foreach $version (@vertext)
{
printf("Version: %s\n",$version);
$version=substr($version,0,length($version)-(length($version)- rindex($version,"@@")));
if (exists($elem_hash{$version}))
{
delete $elem_hash{$version};
}
}
printf("\n%s\n%s\n%s\n",$demarq,$nonmodtext,$demarq);
foreach $elem2 (sort (keys (%elem_hash)))
{
printf("Element: %s\n",$elem2);
}
【讨论】: