[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: cvs doesn't checkout correct revision in vendor branch with -D date
From: |
鯉江英隆 |
Subject: |
RE: cvs doesn't checkout correct revision in vendor branch with -D date |
Date: |
Thu, 30 Nov 2000 11:06:47 +0900 |
From: FUJISHIMA Satsuki <k5@cheerful.com>
Subject: Re: cvs doesn't checkout correct revision in vendor branc ..
Date: Wed, 29 Nov 2000 01:13:41 +0900
Message-Id: <86zoiknk7y.wl@cheerful.com>
| > CVS resets a default branch to commit a imported file.
| > (Try "cvs log -h VERSION | grep branch:")
| > When using -D option, you can not specify a branch.
| > So, the result you get is legal.
|
| No. This is the special case defined in src/rcs.c and it has a bug.
|
| --- src/rcs.c:
| /* This is 1.1; if the date of 1.1 is not the same as that for the
| 1.1.1.1 version, then return 1.1. This happens when the first
| version of a file is created by a regular cvs add and commit,
| and there is a subsequent cvs import of the same file. */
I UNDERSTAND.
This spec is UNDOCUMENTED, but CONVENTIONAL.
I reviewed RCS_getdate() in src/rcs.c.
According to commit log,
this spec has been introduced since revision 1.1,
and codes were fixed by meyering at 1.209:
>1998-12-16 Jim Meyering <meyering@ascend.com>
> * rcs.c (RCS_getdate): Handle the case in which a file is first
> imported after its initial version has been created.
> * sanity.sh (import-after-initial): New test for that.
sanity.sh is incomplete, and I append a test (commit-after-import).
outline:
(1) first import. (rev 1.1.1.1) [at date1]
(2) modify file, and second import. (rev 1.1.1.2) [at date2]
(3) checkout
(4) modify file, and commit. (rev 1.2) [at date3]
(5) modify file, and commit. (rev 1.3) [at date4]
(6) checkout -D date1 outputs rev 1.1.1.1?
(7) checkout -D date2 outputs rev 1.1.1.2?
(8) checkout -D date3 outputs rev 1.2?
(8) checkout -D date4 outputs rev 1.3?
--------------------BEGIN--------------------
Index: sanity.sh
===================================================================
RCS file: /home2/cvsroot/ccvs/src/sanity.sh,v
retrieving revision 1.635
diff -p -u -b -B -r1.635 sanity.sh
--- sanity.sh 2000/11/29 21:18:46 1.635
+++ sanity.sh 2000/11/30 02:03:24
@@ -618,6 +618,7 @@ if test x"$*" = x; then
tests="${tests} branches branches2 tagc tagf"
tests="${tests} rcslib multibranch import importb importc"
tests="${tests} import-after-initial"
+ tests="${tests} commit-after-import"
tests="${tests} join join2 join3 join-readonly-conflict"
tests="${tests} join-admin join-admin-2"
tests="${tests} new newb conflicts conflicts2 conflicts3"
@@ -5322,6 +5323,81 @@ done"
cd ../..
rm -rf 1
rm -rf ${CVSROOT_DIRNAME}/$module
+ ;;
+
+ commit-after-import)
+ module=x
+ file=foo
+ mkdir $module.1; cd $module.1
+ contents1="111"
+ echo $contents1 > $file
+ dotest commit-after-import-1 \
+ "${testcvs} -Q import -m. $module TEST test1" ''
+ sleep 1
+ date1=`date "+%Y-%m-%d %H:%M:%S"`
+ sleep 1
+
+ contents2="222"
+ echo "$contents2" > $file
+ dotest commit-after-import-2 \
+ "${testcvs} -Q import -m. $module TEST test2" ''
+ sleep 1
+ date2=`date "+%Y-%m-%d %H:%M:%S"`
+ sleep 1
+
+ cd ..
+ dotest commit-after-import-3 \
+ "${testcvs} -Q checkout $module" ''
+ cd $module
+
+ contents3="333"
+ echo $contents3 > $file
+ dotest commit-after-import-4 \
+ "${testcvs} -Q commit -m. $file" \
+"Checking in $file;
+${TESTDIR}/cvsroot/$module/$file,v <-- $file
+new revision: 1\.2; previous revision: 1\.1
+done"
+ sleep 1
+ date3=`date "+%Y-%m-%d %H:%M:%S"`
+ sleep 1
+
+ contents4="444"
+ echo $contents4 > $file
+ dotest commit-after-import-5 \
+ "${testcvs} -Q commit -m. $file" \
+"Checking in $file;
+${TESTDIR}/cvsroot/$module/$file,v <-- $file
+new revision: 1\.3; previous revision: 1\.2
+done"
+ sleep 1
+ date4=`date "+%Y-%m-%d %H:%M:%S"`
+ sleep 1
+
+ #${testcvs} annotate $file
+
+ cd ..
+
+ for X in 1 2 3 4; do
+ dotest commit-after-import-6a-$X \
+ "${testcvs} -Q release -d $module" ''
+ eval date=\"\$date$X $TZ\"
+ dotest commit-after-import-6b-$X \
+ "${testcvs} -Q checkout -D \"$date\" $module" ''
+ cd $module
+ #${testcvs} stat $file
+ eval Y=\"\$contents$X\"
+ eval Z=`cat $file`
+ if [ "$Y" = "$Z" ]; then
+ : OK
+ else
+ fail "Unexpected revision. ($X: $Y != $Z)"
+ fi
+ cd ..
+ done
+
+ rm -rf $module.1
+ rm -rf $module
;;
join)
--------------------END--------------------
--
KOIE Hidetaka <hide@koie.org>