【问题标题】:find list of files not modified for last 30 days in clearcase在 clearcase 中查找过去 30 天未修改的文件列表
【发布时间】:2018-11-22 22:01:30
【问题描述】:

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

【问题讨论】:

    标签: find clearcase


    【解决方案1】:

    首先尝试,从query_languagecleartool find,语法

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

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

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

    关于所说的第一个列表(来自“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 
    

    【讨论】:

    • 我已经尝试了第一个选项。但是,由于文件数以千计,我不能 100% 确定它是否正确。
    • @user2636464 只需选择一个并查看其版本树,看看是否有过去 30 天以来创建的版本
    • 顶部的 cleartool find 命令将作用于元素创建日期,而不是版本时间戳...我认为有一种方法,让我看看我是否可以创建一些东西。我相信您可以使用 find -version "created_since..." 为您提供经过修改的元素列表,然后将其与 VOB 中所有元素的列表进行比较。
    • @BrianCowan 我也很怀疑。并且使用版本不会有任何好处,因为它会列出某个日期之前创建的所有版本,而之后仍然可以创建版本。
    • " 我相信你可以使用 find -version "created_since..." ":这就是我在回答的第二部分中提出的。
    【解决方案2】:

    这是一个示例 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);
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-05-19
      • 1970-01-01
      • 1970-01-01
      • 2021-12-08
      • 2012-04-16
      相关资源
      最近更新 更多