看起来 CVS 不会仅仅因为$Name
扩展更改而更新文件。如果它必须创建文件,它会更新它。
我有一个 CVS 存储库/home/kst/CVS_smov
,其中有一个名为name-test
. 此脚本演示了该行为。更改前两个命令以使用不同的配置进行演示。
#!/bin/bash
export CVSROOT=/home/kst/CVS_smov
cd ~/cvs-smov/name-test
echo '$Id:$' > name.txt
echo '$Name:$' >> name.txt
cvs add name.txt
cvs commit -m 'First checkin' name.txt
echo "name.txt:"
cat name.txt
echo ''
cvs tag tag-name name.txt
cd ..
cvs checkout -r tag-name name-test
cd name-test
echo "After cvs checkout -r:"
cat name.txt
echo ''
cd ..
rm -r name-test
cvs checkout -r tag-name name-test
cd name-test
echo "After rm -r and cvs checkout -r:"
cat name.txt
这是我使用 CVS 1.12.13 得到的输出:
cvs add: scheduling file `name.txt' for addition
cvs add: use `cvs commit' to add this file permanently
/home/kst/CVS_smov/name-test/name.txt,v <-- name.txt
initial revision: 1.1
name.txt:
$Id: name.txt,v 1.1 2013/06/17 15:56:50 kst Exp $
$Name: $
T name.txt
cvs checkout: Updating name-test
After cvs checkout -r:
$Id: name.txt,v 1.1 2013/06/17 15:56:50 kst Exp $
$Name: $
cvs checkout: Updating name-test
U name-test/name.txt
After rm -r and cvs checkout -r:
$Id: name.txt,v 1.1 2013/06/17 15:56:50 kst Exp $
$Name: tag-name $
摘要:
我在创建并签入文件后显示文件的内容(不$Name
,因为没有标签),在创建标签并签出模块后($Name
仍未更新),然后在对目录进行核对并签出后再次(现在$Name
填写)。
这可能是 CVS 中的一个错误,但坦率地说,我没有使用 CVS 标签来确定它应该如何运行。
更新 :
Name
查看 CVS 源代码,我看到一些评论表达了对关键字的一些不确定性。
在src/rcs.c
, 函数RCS_gettag
:
/* We have found a numeric revision for the revision tag.
To support expanding the RCS keyword Name, if
SIMPLE_TAG is not NULL, tell the the caller that this
is a simple tag which co will recognize. FIXME: Are
there other cases in which we should set this? In
particular, what if we expand RCS keywords internally
without calling co? */
在src/rcscmds.c
, 函数RCS_exec_rcsdiff
:
/* Historically, `cvs diff' has expanded the $Name keyword to the
empty string when checking out revisions. This is an accident,
but no one has considered the issue thoroughly enough to determine
what the best behavior is. Passing NULL for the `nametag' argument
preserves the existing behavior. */
在src/update.c
, 函数中patch_file
:
/* FIXME - Passing vers_ts->tag here is wrong in the least number
* of cases. Since we don't know whether vn_user was checked out
* using a tag, we pass vers_ts->tag, which, assuming the user did
* not specify a new TAG to -r, will be the branch we are on.
*
* The only thing it is used for is to substitute in for the Name
* RCS keyword, so in the error case, the patch fails to apply on
* the client end and we end up resending the whole file.
*
* At least, if we are keeping track of the tag vn_user came from,
* I don't know where yet. -DRP
*/
最后一个让我印象深刻的是观察到的行为最可能的原因。