在 clearcase 中查找最近 30 天未修改的文件列表

find list of files not modified for last 30 days in clearcase

我需要找到最近 30 天未修改的文件列表。这意味着过去 30 天内任何分支下都不应有该文件的版本。这在基本的 clearcase 中可能吗?

首先尝试从 query_language and cleartool find 开始,语法

cleartool find <vobtag> -element "!{created_since(target-data-time)}" -print

如果这不起作用,您将不得不退回到:

  • 列出最近 30 天内创建的版本的所有文件
  • 列出所有文件并提取不属于第一个列表的文件。

关于第一个列表(来自“How to determine the last time a VOB was modified"), using 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);
}