[PATCH]: test-convert-cvs-synthetic: be less picky about CVS output.
Greg Ward
greg-hg at gerg.ca
Thu Mar 26 20:54:34 CDT 2009
This should fix the problems in the tests introduced by issue #1558,
which aims to recognize and eliminate CVS' synthetic "file x added on
branch y" revisions.
Incidentally, I've just tonight discovered a bug introduced by that
patch -- it interacts badly with convert.cvsps.mergefrom. More
patches forthcoming. But this one should go in soon, so that the
tests in hg-stable pass again.
Oh yeah, if this patch is accepted, IMHO it would be a good idea to do
similar things in the other test-convert-cvs* scripts. You just can't
trust various versions of CVS to print the same output under the same
conditions. Sigh.
# HG changeset patch
# User Greg Ward <greg-hg at gerg.ca>
# Date 1237660774 14400
# Node ID 4b34b35789f7dd218ecc4c613bc11f7e591badbc
# Parent 67e59a9886d5902de5b94cd2552d854b6292ec63
test-convert-cvs-synthetic: be less picky about CVS output.
diff --git a/tests/test-convert-cvs-synthetic b/tests/test-convert-cvs-synthetic
--- a/tests/test-convert-cvs-synthetic
+++ b/tests/test-convert-cvs-synthetic
@@ -3,10 +3,6 @@
# This feature requires use of builtin cvsps!
"$TESTDIR/hghave" cvs || exit 80
-# XXX lots of duplication with other test-convert-cvs* scripts
-
-set -e
-
echo "[extensions]" >> $HGRCPATH
echo "convert = " >> $HGRCPATH
echo "[convert]" >> $HGRCPATH
@@ -19,47 +15,62 @@
export CVS_OPTIONS=-f
cd ..
-filter='sed "s:$CVSROOT:*REPO*:g"'
+filterpath()
+{
+ eval "$@" | sed "s:$CVSROOT:*REPO*:g"
+}
+
cvscall()
{
- cvs -f "$@" | eval $filter
+ echo cvs -f "$@"
+ cvs -f "$@" 2>&1
}
-cvscall -q -d "$CVSROOT" init
+# output of 'cvs ci' varies unpredictably, so just discard it
+cvsci()
+{
+ echo cvs -f ci "$@"
+ cvs -f ci "$@" >/dev/null 2>&1
+}
+
+filterpath cvscall -d "$CVSROOT" init
mkdir cvsrepo/proj
-cvscall co proj
+cvscall -q co proj
echo % create file1 on the trunk
cd proj
touch file1
-cvscall add file1
-cvscall ci -m"add file1 on trunk" file1
+cvscall -Q add file1
+cvsci -m"add file1 on trunk" file1
echo % create two branches
-cvscall tag -b v1_0
-cvscall tag -b v1_1
+cvscall -q tag -b v1_0
+cvscall -q tag -b v1_1
echo % create file2 on branch v1_0
-cvs up -rv1_0
+cvscall -q up -rv1_0
touch file2
-cvscall add file2
-cvscall ci -m"add file2 on branch v1_0" file2
+cvscall -Q add file2
+cvsci -m"add file2 on branch v1_0" file2
echo % create file3, file4 on branch v1_1
-cvs up -rv1_1
+cvscall -Q up -rv1_1
touch file3
touch file4
-cvscall add file3 file4
-cvscall ci -m"add file3, file4 on branch v1_1" file3 file4
+cvscall -Q add file3 file4
+cvsci -m"add file3, file4 on branch v1_1" file3 file4
echo % merge file2 from v1_0 to v1_1
-cvscall up -jv1_0
-cvscall ci -m"merge file2 from v1_0 to v1_1"
+cvscall -q up -jv1_0
+cvsci -m"merge file2 from v1_0 to v1_1"
+
+echo % cvs rlog output
+filterpath cvscall -q rlog proj | egrep '^(RCS file|revision)'
echo % convert to hg
cd ..
-hg convert proj proj.hg | eval $filter
+filterpath hg convert proj proj.hg
echo % hg log output
hg -R proj.hg log --template "{rev} {desc}\n"
diff --git a/tests/test-convert-cvs-synthetic.out b/tests/test-convert-cvs-synthetic.out
--- a/tests/test-convert-cvs-synthetic.out
+++ b/tests/test-convert-cvs-synthetic.out
@@ -1,37 +1,40 @@
% create cvs repository with one project
-cvs checkout: Updating proj
+cvs -f -d *REPO* init
+cvs -f -q co proj
% create file1 on the trunk
-cvs add: scheduling file `file1' for addition
-cvs add: use `cvs commit' to add this file permanently
-*REPO*/proj/file1,v <-- file1
-initial revision: 1.1
+cvs -f -Q add file1
+cvs -f ci -madd file1 on trunk file1
% create two branches
-cvs tag: Tagging .
+cvs -f -q tag -b v1_0
T file1
-cvs tag: Tagging .
+cvs -f -q tag -b v1_1
T file1
% create file2 on branch v1_0
-cvs update: Updating .
-cvs add: scheduling file `file2' for addition on branch `v1_0'
-cvs add: use `cvs commit' to add this file permanently
-*REPO*/proj/Attic/file2,v <-- file2
-new revision: 1.1.2.1; previous revision: 1.1
+cvs -f -q up -rv1_0
+cvs -f -Q add file2
+cvs -f ci -madd file2 on branch v1_0 file2
% create file3, file4 on branch v1_1
-cvs update: Updating .
-cvs update: `file2' is no longer in the repository
-cvs add: scheduling file `file3' for addition on branch `v1_1'
-cvs add: scheduling file `file4' for addition on branch `v1_1'
-cvs add: use `cvs commit' to add these files permanently
-*REPO*/proj/Attic/file3,v <-- file3
-new revision: 1.1.2.1; previous revision: 1.1
-*REPO*/proj/Attic/file4,v <-- file4
-new revision: 1.1.2.1; previous revision: 1.1
+cvs -f -Q up -rv1_1
+cvs -f -Q add file3 file4
+cvs -f ci -madd file3, file4 on branch v1_1 file3 file4
% merge file2 from v1_0 to v1_1
-cvs update: Updating .
+cvs -f -q up -jv1_0
U file2
-cvs commit: Examining .
-*REPO*/proj/Attic/file2,v <-- file2
-new revision: 1.1.4.2; previous revision: 1.1.4.1
+cvs -f ci -mmerge file2 from v1_0 to v1_1
+% cvs rlog output
+RCS file: *REPO*/proj/file1,v
+revision 1.1
+RCS file: *REPO*/proj/Attic/file2,v
+revision 1.1
+revision 1.1.4.2
+revision 1.1.4.1
+revision 1.1.2.1
+RCS file: *REPO*/proj/Attic/file3,v
+revision 1.1
+revision 1.1.2.1
+RCS file: *REPO*/proj/Attic/file4,v
+revision 1.1
+revision 1.1.2.1
% convert to hg
initializing destination proj.hg repository
using builtin cvsps
More information about the Mercurial-devel
mailing list