11 12
发新话题
打印

[转贴] 详解 Rational ClearCase中的lost+found目录( 此文章被查看:2245次,被回复:10篇!! )

详解 Rational ClearCase中的lost+found目录

一、 lost+found目录简介
    在软件配置管理工具 Rational ClearCase中,当你创建一个VOB库后,将自动产生一个目录:lost+found,这个目录主要存放不再包含在VOB中任何一个目录版本中的元素(在ClearCase中,元素包括文件和目录),这句话听起来有些拗口,呵呵。简单来说,lost+found目录类似于Windows的回收站,所不同的是:在windows中进行删除操作后,文件将被放入回收站;而在ClearCase中,当一个元素在VOB中与其他元素的依赖关系被全部删除时,它才会被放入lost+found目录。
二、什么情况下 ClearCase的元素会被放入lost+found目录
    当你做如下操作的时候, VOB中的元素将被放入lost+found目录:
    1. 使用 rmname删除一个元素与其他元素的最后一个依赖关系
    Rename命令不会删除VOB中的元素,只会把该元素与父文件夹之间的关系删除。如果一个元素与其他元素的关系全部被renamed,没有路径能访问到该元素,这时这个元素将被自动放入lost+found目录中。如果这个元素是目录时,那么 它里面包含的子目录与文件都会被放入 lost+found目录。
    2. 使用 rmver、 rmbranch 或rmelem删除一个目录版本最后一个依赖关系
    在 Rational ClearCase 中,目录也做为配置项管理,如果你把目录删除了,其下的子目录与文件就会没有正确的链接,这时这些子目录与文件会放到 lost+found 中。如果你确实不需要,可以在 lost+found 目录对它们进行彻底清除。反之可以恢复,以避免误操作带来的损失。
    3. 当一个目录处于 checkout状态时,如果在该目录中创建新元素,然后又将处于checkout状态的这个目录进行了 undo checkout操作,这种情况下你新建的那个元素将被放入lost+found目录,因为它已经找不到对应关系了。
三、 lost+found中元素的命名规则
    当一个元素被放入 lost+found目录后,我们会看到它的名字很长,好像很乱,其实ClearCase对它有一套统一的命名规则。当元素被放入lost+found目录后,名字将增加一个OID(Objedct ID),格式为:element_leaf_name.id_number。
    举个例子:
    文件放入 lost+found前的名称:build.log;
    文件放入 lost+found后的名称:build.log.3e105a5cad674d0db12ad477fd11026c;
    它的 element_leaf_name为build.log,3e105a5cad674d0db12ad477fd11026c是id_number。
四、 lost+found目录的特点
    lost+found目录有几个独有的特性:
    1. lost+found目录本身不能进行checkout操作。
    2. 该目录里面的内容可以进行修改,即进行检入、检出操作。
    3. 在 lost+found目录上无法创建分支,但是目录里面的内容可以创建。
五、 lost+found中元素的处理方法
    一个有经验的配置管理人员不应该把文件移到 lost+found中,而应定期把文件归回原位或者清除lost+found文件夹中不再使用的文件。
    为了节约空间,定期清理 lost+found目录的方法是必要的,方法如下:
    1. 如果 lost+found目录中的内容仍然有用,可以将其移出并恢复:
      •  将 lost+found中的内容移动到本VOB库中,使用命令:cleartool mv;
      •  将 lost+found中的内容移动到其他VOB库中,使用命令:cleartool relocate;
    误删除了元素后,不要着急,看看能否在 lost+found目录中找到并恢复它。如果被彻底删除,再通过备份的VOB库来恢复也不迟。
    2. 使用 cleartool rmelem 命令将不再使用的元素删除;
    如果 lost+found中的内容确实不再需要,可以使用rmelem彻底清除,以节约VOB的空间,就像你经常整理Windows的回收站一样。 需要强调的是,使用 rmelem 命令前一定要慎重,因为该命令将永久删除元素。
六、总结
    平时大家在工作中可能不太关注 lost+found目录,其实它在文件恢复、节约工作空间方面都有不少的价值,希望本文能对你有所启示和帮助。
本帖最近评分记录
  • 懂你 金钱 +3 2006-10-31 10:52



© 本文为 makeSCMLife 共同所有,未经同意,请勿转载 ©如该文侵犯了您的版权,请联系管理员
针对问题学习是最好的方法.
http://bbs.scmlife.com/?fromuid=81

TOP

此文在很多网站都有,应该是转贴的吧!



© 本文为 懂你SCMLife 共同所有,未经同意,请勿转载 ©如该文侵犯了您的版权,请联系管理员
优惠购买Rational,Telelogic,Hansky产品,企业VIP服务、实施
VIP服务电话:13581809377

TOP

对的,写的不错,给大家分享.



© 本文为 makeSCMLife 共同所有,未经同意,请勿转载 ©如该文侵犯了您的版权,请联系管理员
针对问题学习是最好的方法.
http://bbs.scmlife.com/?fromuid=81

TOP

嗯。豁然开朗了。以前都没关注过

© 本文为 刘刘 所有,未经同意,请勿转载
©如该文侵犯了您的版权,请联系管理员
i am on my way ....

TOP

lost+found目录里有文件的时候,好像提交不容易成功

© 本文为 cissy 所有,未经同意,请勿转载
©如该文侵犯了您的版权,请联系管理员

TOP

一直对lost+found目录不是很清楚,现在应该明白些了,谢谢了,

© 本文为 tuohz 所有,未经同意,请勿转载
©如该文侵犯了您的版权,请联系管理员

TOP

"lost+found"目录本身被删除了,如何恢复??

© 本文为 fish_yu 所有,未经同意,请勿转载
©如该文侵犯了您的版权,请联系管理员

TOP

回复 #1 make 的帖子

这篇文章对Lost+found这个知识点分析得非常的透。
谢谢楼主!
下面我也转发一下另外一位大师的perl脚本,就是为了避免产生文件被误转移到Lost+found这个目录做的脚本。大家可以参考一下,提示的地方我用中文替代了,可能不是很准确,以下为代码:
****************************************************************
############################################################
#
# WARN_LOST_AND_FOUND.pl
#
# Directory uncheckouts are checked to see if the resulting
# uncheckout will send any child elements to lost+found.  If
# so then any elements are listed for the user and the user
# is then given the option to continue the uncheckout or
# cancel.
#
# Note:
#
# Arguments: None
#
# Author: A Better Solution, Inc.
# email:  support@abs-consulting.com
# URL:    http://www.abs-consulting.com
# Date:   Oct. 01, 2005
############################################################
# History: 10/01/2005 : Created for A Better Solution, Inc.
############################################################
############################################################


###################################
########  Site Static Data ########
###################################

$MAX_SHOW = 10;
$OS       = "$ENV{'OS'}";

if ($OS =~ /[Ww]indows/)
{
   $CLEARTOOL   = "cleartool";
   $CLEARPROMPT = "clearprompt";
}
else
{
   $CLEARTOOL   = "/usr/atria/bin/cleartool";
   $CLEARPROMPT = "/usr/atria/bin/clearprompt";
}

#################################
########  Passed In Data ########
#################################

        # NONE #

##################################
########  Calculated Data ########
##################################

$dir                = $ENV{CLEARCASE_PN};
@my_children        = `$CLEARTOOL ls -nxname -s -vob_only "$dir"`;
$pred_version       = `$CLEARTOOL desc -fmt %PSn "$dir"`;
$pred_dir           = "$dir\@\@$pred_version";
@my_preds_children  = `$CLEARTOOL ls -nxname -s -vob_only "$pred_dir"`;

############################
########  Test Data ########
############################

        # NONE #

#############################
########  PROCEDURES ########
#############################

        # NONE #

########################
########  MAIN  ########----------------------------------------------------------------
########################

@my_kids=();
@my_preds_kids=();

printf ("检查该目录下的元素...   \n     ($dir)\n这些元素有可能会成为孤儿被扔到lost+found中 ...");

##################################################
# Get a list of the current directories children #
##################################################

foreach $child (@my_children)
{
   chomp ($child);

   @components = split (/[\\\/]/, $child);

   push ( @my_kids, $components[$#components]);
}

###################################################
# Get a list of the previous directories children #
###################################################

foreach $child (@my_preds_children)
{
   chomp ($child);

   @components = split (/[\\\/]/, $child);

   push ( @my_preds_kids, $components[$#components]);
}

#################################################################
# Get a list of children added in this version of the directory #
#################################################################

@orphans_to_be = ();


foreach $child (@my_kids)
{
   $found = 0;
  
   ###########################################################################
   # This loop below could be replaced with $found = grep (child, @my_kids); #
   # in most versions of perl, but not ccperl.                               #
   ###########################################################################

   foreach $preds_child (@my_preds_kids)
   {
      if ($child eq $preds_child)
         { $found = 1 ; last; }
   }

   if ($found == 0)
   {
      push ( @orphans_to_be, "       $child\n");
   }
}

##############################
# If none found then bail OK #
##############################

if ($#orphans_to_be == -1)
{
   printf (" OK,没有发现...\n");
   exit 0;
}

############################################################################
# Display elements that will goto lost+found if the uncheckout is allowed. #
############################################################################

$num = $#orphans_to_be+1;

printf ("  $num found...\n");

if ($num == 1)
{
   $msg = "如果你不checkout该目录 ($dir)\\n那么以下元素:\\n\\n   $orphans_to_be[0]\\n\\n将由于父目录不存在而被扔到lost+found中.\\n";
}
else
{
   $msg = "如果你不checkout该目录那么将有 ($dir)\\n$num 元素由于父目录不存在而被扔到lost+found中.\\n它们是:\\n";

   $i = 1;

   ################################################################
   # List the more than 1 elements but show no more than MAX_SHOW #
   ################################################################

   foreach $child (@orphans_to_be)
   {
      chomp ($child);
      $list = $list.$child."\\n";

      if ($i == $MAX_SHOW)
         { $list = $list."..."."\\n"; }
            
      last if ($i == $MAX_SHOW);

      $i++;
   }

   $msg = "$msg\\n$list";
}  

####################################################################
# The operator has a choice to continue or not with the uncheckout #
####################################################################

$final_msg = "$msg\\n你真的希望不checkout吗?";
   
$rc = system ("$CLEARPROMPT yes_no -def no -mask no,yes -pre -newline -pro \"$final_msg\"  ");

if ($rc == 0)
   { exit 0; }
else
   { exit 1; }
**********************************************************
本帖最近评分记录
  • among 金钱 +1 不错 2006-11-8 22:03

© 本文为 singwa 所有,未经同意,请勿转载
©如该文侵犯了您的版权,请联系管理员

TOP

上午建立了一个View,正对这两个文件夹摸不到头脑呢,非常感谢

© 本文为 lvluo 所有,未经同意,请勿转载
©如该文侵犯了您的版权,请联系管理员

TOP

写的很明白,易懂,感谢!

© 本文为 hanson 所有,未经同意,请勿转载
©如该文侵犯了您的版权,请联系管理员

TOP

 11 12
发新话题