如何确定文件首次添加到CVS存储库的日期/时间

时间:2011-05-25 11:19:43

标签: version-control cvs

是否有任何简单的cvs命令,通过该命令,我可以在首次将文件添加到CVS存储库中的模块时获取日期/时间。

我实际上想要一个可以被我的某些脚本使用的单行输出。

1 个答案:

答案 0 :(得分:0)

这在CVS中是不可能的。可以获取文件的活动日志,然后从中识别日期。以下是单行命令,它像魅力一样工作,并提供文件首次添加到存储库中的日期。

cvs -Q -d :pserver:*User*:*Pass*@*HostName*:/cvsroot rlog -N *FilePath* | grep ^date: | sort | head -n 1 | cut -d\; -f1 | sed -e 's/date: //'

上面的命令查看整个存储库并提供日期。如果要在分支上查找该文件的第一个活动,请使用以下命令。

对于分支:

cvs -Q -d :pserver:*User*:*Pass*@*HostName*:/cvsroot rlog -N -r*BranchName* *FilePath* | grep ^date: | sort | head -n 1 | cut -d\; -f1 | sed -e 's/date: //'

对于Trunk:

cvs -Q -d :pserver:*User*:*Pass*@*HostName*:/cvsroot rlog -N -r::HEAD *FilePath* | grep ^date: | sort | head -n 1 | cut -d\; -f1 | sed -e 's/date: //'
相关问题