Mercurial > hg-stable
changeset 12522:7813e6b44a0b
tests: unify test-convert-cvs-synthetic
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Sun, 26 Sep 2010 16:39:52 -0500 |
parents | 539480ce1c89 |
children | a164a9cff771 |
files | tests/test-convert-cvs-synthetic tests/test-convert-cvs-synthetic.out tests/test-convert-cvs-synthetic.t |
diffstat | 3 files changed, 216 insertions(+), 252 deletions(-) [+] |
line wrap: on
line diff
--- a/tests/test-convert-cvs-synthetic Sun Sep 26 15:42:48 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,118 +0,0 @@ -#!/bin/sh - -# This feature requires use of builtin cvsps! -"$TESTDIR/hghave" cvs || exit 80 - -set -e - -echo "[extensions]" >> $HGRCPATH -echo "convert = " >> $HGRCPATH -echo "graphlog = " >> $HGRCPATH - -echo % create cvs repository with one project -mkdir cvsrepo -cd cvsrepo -CVSROOT=`pwd` -export CVSROOT -CVS_OPTIONS=-f -export CVS_OPTIONS -cd .. - -filterpath() -{ - eval "$@" | sed "s:$CVSROOT:*REPO*:g" -} - -cvscall() -{ - echo cvs -f "$@" - cvs -f "$@" 2>&1 -} - -# 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 -q co proj - -echo % create file1 on the trunk -cd proj -touch file1 -cvscall -Q add file1 -cvsci -m"add file1 on trunk" file1 - -echo % create two branches -cvscall -q tag -b v1_0 -cvscall -q tag -b v1_1 - -echo % create file2 on branch v1_0 -cvscall -Q up -rv1_0 -touch file2 -cvscall -Q add file2 -cvsci -m"add file2" file2 - -echo % create file3, file4 on branch v1_1 -cvscall -Q up -rv1_1 -touch file3 -touch 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 -Q up -jv1_0 -cvsci -m"MERGE from v1_0: add file2" - -# Step things up a notch: now we make the history really hairy, with -# changes bouncing back and forth between trunk and v1_2 and merges -# going both ways. (I.e., try to model the real world.) - -echo "% create branch v1_2" -cvscall -Q up -A -cvscall -q tag -b v1_2 - -echo "% create file5 on branch v1_2" -cvscall -Q up -rv1_2 -touch file5 -cvs -Q add file5 -cvsci -m"add file5 on v1_2" - -echo "% create file6 on trunk post-v1_2" -cvscall -Q up -A -touch file6 -cvscall -Q add file6 -cvsci -m"add file6 on trunk post-v1_2" - -echo "% merge file5 from v1_2 to trunk" -cvscall -Q up -A -cvscall -Q up -jv1_2 file5 -cvsci -m"MERGE from v1_2: add file5" - -echo "% merge file6 from trunk to v1_2" -cvscall -Q up -rv1_2 -cvscall up -jHEAD file6 -cvsci -m"MERGE from HEAD: add file6" - -echo % cvs rlog output -filterpath cvscall -q rlog proj | egrep '^(RCS file|revision)' - -echo "% convert to hg (#1)" -cd .. -filterpath hg convert --datesort proj proj.hg - -echo "% hg glog output (#1)" -hg -R proj.hg glog --template "{rev} {desc}\n" - -echo "% convert to hg (#2: with merge detection)" -filterpath hg convert \ - --config convert.cvsps.mergefrom='"^MERGE from (\S+):"' \ - --datesort \ - proj proj.hg2 - -echo "% hg glog output (#2)" -hg -R proj.hg2 glog --template "{rev} {desc}\n"
--- a/tests/test-convert-cvs-synthetic.out Sun Sep 26 15:42:48 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,134 +0,0 @@ -% create cvs repository with one project -cvs -f -d *REPO* init -cvs -f -q co proj -% create file1 on the trunk -cvs -f -Q add file1 -cvs -f ci -madd file1 on trunk file1 -% create two branches -cvs -f -q tag -b v1_0 -T file1 -cvs -f -q tag -b v1_1 -T file1 -% create file2 on branch v1_0 -cvs -f -Q up -rv1_0 -cvs -f -Q add file2 -cvs -f ci -madd file2 file2 -% create file3, file4 on branch v1_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 -f -Q up -jv1_0 -cvs -f ci -mMERGE from v1_0: add file2 -% create branch v1_2 -cvs -f -Q up -A -cvs -f -q tag -b v1_2 -T file1 -% create file5 on branch v1_2 -cvs -f -Q up -rv1_2 -cvs -f ci -madd file5 on v1_2 -% create file6 on trunk post-v1_2 -cvs -f -Q up -A -cvs -f -Q add file6 -cvs -f ci -madd file6 on trunk post-v1_2 -% merge file5 from v1_2 to trunk -cvs -f -Q up -A -cvs -f -Q up -jv1_2 file5 -cvs -f ci -mMERGE from v1_2: add file5 -% merge file6 from trunk to v1_2 -cvs -f -Q up -rv1_2 -cvs -f up -jHEAD file6 -U file6 -cvs -f ci -mMERGE from HEAD: add file6 -% 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 -RCS file: *REPO*/proj/file5,v -revision 1.2 -revision 1.1 -revision 1.1.2.1 -RCS file: *REPO*/proj/file6,v -revision 1.1 -revision 1.1.2.2 -revision 1.1.2.1 -% convert to hg (#1) -initializing destination proj.hg repository -connecting to *REPO* -scanning source... -collecting CVS rlog -15 log entries -creating changesets -8 changeset entries -sorting... -converting... -7 add file1 on trunk -6 add file2 -5 add file3, file4 on branch v1_1 -4 MERGE from v1_0: add file2 -3 add file5 on v1_2 -2 add file6 on trunk post-v1_2 -1 MERGE from v1_2: add file5 -0 MERGE from HEAD: add file6 -% hg glog output (#1) -o 7 MERGE from HEAD: add file6 -| -| o 6 MERGE from v1_2: add file5 -| | -| o 5 add file6 on trunk post-v1_2 -| | -o | 4 add file5 on v1_2 -|/ -| o 3 MERGE from v1_0: add file2 -| | -| o 2 add file3, file4 on branch v1_1 -|/ -| o 1 add file2 -|/ -o 0 add file1 on trunk - -% convert to hg (#2: with merge detection) -initializing destination proj.hg2 repository -connecting to *REPO* -scanning source... -collecting CVS rlog -15 log entries -creating changesets -8 changeset entries -sorting... -converting... -7 add file1 on trunk -6 add file2 -5 add file3, file4 on branch v1_1 -4 MERGE from v1_0: add file2 -3 add file5 on v1_2 -2 add file6 on trunk post-v1_2 -1 MERGE from v1_2: add file5 -0 MERGE from HEAD: add file6 -% hg glog output (#2) -o 7 MERGE from HEAD: add file6 -|\ -| o 6 MERGE from v1_2: add file5 -| | -| o 5 add file6 on trunk post-v1_2 -| | -o | 4 add file5 on v1_2 -|/ -| o 3 MERGE from v1_0: add file2 -| |\ -+---o 2 add file3, file4 on branch v1_1 -| | -| o 1 add file2 -|/ -o 0 add file1 on trunk -
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-convert-cvs-synthetic.t Sun Sep 26 16:39:52 2010 -0500 @@ -0,0 +1,216 @@ +This feature requires use of builtin cvsps! + + $ "$TESTDIR/hghave" cvs || exit 80 + $ echo "[extensions]" >> $HGRCPATH + $ echo "convert = " >> $HGRCPATH + $ echo "graphlog = " >> $HGRCPATH + +create cvs repository with one project + + $ mkdir cvsrepo + $ cd cvsrepo + $ CVSROOT=`pwd` + $ export CVSROOT + $ CVS_OPTIONS=-f + $ export CVS_OPTIONS + $ cd .. + $ cvscall() + > { + > cvs -f "$@" + > } + +output of 'cvs ci' varies unpredictably, so just discard it + + $ cvsci() + > { + > cvs -f ci "$@" >/dev/null + > } + $ cvscall -d "$CVSROOT" init + $ mkdir cvsrepo/proj + $ cvscall -q co proj + +create file1 on the trunk + + $ cd proj + $ touch file1 + $ cvscall -Q add file1 + $ cvsci -m"add file1 on trunk" file1 + +create two branches + + $ cvscall -q tag -b v1_0 + T file1 + $ cvscall -q tag -b v1_1 + T file1 + +create file2 on branch v1_0 + + $ cvscall -Q up -rv1_0 + $ touch file2 + $ cvscall -Q add file2 + $ cvsci -m"add file2" file2 + +create file3, file4 on branch v1_1 + + $ cvscall -Q up -rv1_1 + $ touch file3 + $ touch file4 + $ cvscall -Q add file3 file4 + $ cvsci -m"add file3, file4 on branch v1_1" file3 file4 + +merge file2 from v1_0 to v1_1 + + $ cvscall -Q up -jv1_0 + $ cvsci -m"MERGE from v1_0: add file2" + cvs commit: Examining . + +Step things up a notch: now we make the history really hairy, with +changes bouncing back and forth between trunk and v1_2 and merges +going both ways. (I.e., try to model the real world.) +create branch v1_2 + + $ cvscall -Q up -A + $ cvscall -q tag -b v1_2 + T file1 + +create file5 on branch v1_2 + + $ cvscall -Q up -rv1_2 + $ touch file5 + $ cvs -Q add file5 + $ cvsci -m"add file5 on v1_2" + cvs commit: Examining . + +create file6 on trunk post-v1_2 + + $ cvscall -Q up -A + $ touch file6 + $ cvscall -Q add file6 + $ cvsci -m"add file6 on trunk post-v1_2" + cvs commit: Examining . + +merge file5 from v1_2 to trunk + + $ cvscall -Q up -A + $ cvscall -Q up -jv1_2 file5 + $ cvsci -m"MERGE from v1_2: add file5" + cvs commit: Examining . + +merge file6 from trunk to v1_2 + + $ cvscall -Q up -rv1_2 + $ cvscall up -jHEAD file6 + U file6 + $ cvsci -m"MERGE from HEAD: add file6" + cvs commit: Examining . + +cvs rlog output + + $ cvscall -q rlog proj | egrep '^(RCS file|revision)' + RCS file: */cvsrepo/proj/file1,v (glob) + revision 1.1 + RCS file: */cvsrepo/proj/Attic/file2,v (glob) + revision 1.1 + revision 1.1.4.2 + revision 1.1.4.1 + revision 1.1.2.1 + RCS file: */cvsrepo/proj/Attic/file3,v (glob) + revision 1.1 + revision 1.1.2.1 + RCS file: */cvsrepo/proj/Attic/file4,v (glob) + revision 1.1 + revision 1.1.2.1 + RCS file: */cvsrepo/proj/file5,v (glob) + revision 1.2 + revision 1.1 + revision 1.1.2.1 + RCS file: */cvsrepo/proj/file6,v (glob) + revision 1.1 + revision 1.1.2.2 + revision 1.1.2.1 + +convert to hg (#1) + + $ cd .. + $ hg convert --datesort proj proj.hg + initializing destination proj.hg repository + connecting to */cvsrepo (glob) + scanning source... + collecting CVS rlog + 15 log entries + creating changesets + 8 changeset entries + sorting... + converting... + 7 add file1 on trunk + 6 add file2 + 5 add file3, file4 on branch v1_1 + 4 MERGE from v1_0: add file2 + 3 add file5 on v1_2 + 2 add file6 on trunk post-v1_2 + 1 MERGE from v1_2: add file5 + 0 MERGE from HEAD: add file6 + +hg glog output (#1) + + $ hg -R proj.hg glog --template "{rev} {desc}\n" + o 7 MERGE from HEAD: add file6 + | + | o 6 MERGE from v1_2: add file5 + | | + | o 5 add file6 on trunk post-v1_2 + | | + o | 4 add file5 on v1_2 + |/ + | o 3 MERGE from v1_0: add file2 + | | + | o 2 add file3, file4 on branch v1_1 + |/ + | o 1 add file2 + |/ + o 0 add file1 on trunk + + +convert to hg (#2: with merge detection) + + $ hg convert \ + > --config convert.cvsps.mergefrom='"^MERGE from (\S+):"' \ + > --datesort \ + > proj proj.hg2 + initializing destination proj.hg2 repository + connecting to */cvsrepo (glob) + scanning source... + collecting CVS rlog + 15 log entries + creating changesets + 8 changeset entries + sorting... + converting... + 7 add file1 on trunk + 6 add file2 + 5 add file3, file4 on branch v1_1 + 4 MERGE from v1_0: add file2 + 3 add file5 on v1_2 + 2 add file6 on trunk post-v1_2 + 1 MERGE from v1_2: add file5 + 0 MERGE from HEAD: add file6 + +hg glog output (#2) + + $ hg -R proj.hg2 glog --template "{rev} {desc}\n" + o 7 MERGE from HEAD: add file6 + | + | o 6 MERGE from v1_2: add file5 + | | + | o 5 add file6 on trunk post-v1_2 + | | + o | 4 add file5 on v1_2 + |/ + | o 3 MERGE from v1_0: add file2 + | | + | o 2 add file3, file4 on branch v1_1 + |/ + | o 1 add file2 + |/ + o 0 add file1 on trunk +