diff --git a/tests/test-convert-cvs.out b/tests/test-convert-cvs.out deleted file mode 100644 --- a/tests/test-convert-cvs.out +++ /dev/null @@ -1,321 +0,0 @@ -% create cvs repository -% create source directory -% import source directory -N src/a -N src/b/c - -No conflicts created by this import - -% checkout source directory -U src/a -U src/b/c -% commit a new revision changing b/c -checking in src/b/c,v -% convert fresh repo -initializing destination src-hg repository -connecting to cvsrepo -scanning source... -collecting CVS rlog -5 log entries -cvslog hook: 5 entries -creating changesets -3 changeset entries -cvschangesets hook: 3 changesets -sorting... -converting... -2 Initial revision -1 import -0 ci0 -updating tags -a -c -c -% convert fresh repo with --filemap -initializing destination src-filemap repository -connecting to cvsrepo -scanning source... -collecting CVS rlog -5 log entries -cvslog hook: 5 entries -creating changesets -3 changeset entries -cvschangesets hook: 3 changesets -sorting... -converting... -2 Initial revision -1 import -filtering out empty revision -rolling back to revision 0 (undo commit) -0 ci0 -updating tags -c -c -2 update tags files: .hgtags -1 ci0 files: b/c -0 Initial revision files: b/c -% convert full repository (issue1649) -U srcfull/src/a -U srcfull/src/b/c -CVS -CVSROOT -src -initializing destination srcfull-hg repository -connecting to cvsrepo -scanning source... -collecting CVS rlog -creating changesets -4 changeset entries -sorting... -converting... -updating tags -a -c -c -% commit new file revisions -checking in src/a,v -checking in src/b/c,v -% convert again -connecting to cvsrepo -scanning source... -collecting CVS rlog -7 log entries -cvslog hook: 7 entries -creating changesets -4 changeset entries -cvschangesets hook: 4 changesets -sorting... -converting... -0 ci1 -a -a -c -c -c -% convert again with --filemap -connecting to cvsrepo -scanning source... -collecting CVS rlog -7 log entries -cvslog hook: 7 entries -creating changesets -4 changeset entries -cvschangesets hook: 4 changesets -sorting... -converting... -0 ci1 -c -c -c -3 ci1 files: b/c -2 update tags files: .hgtags -1 ci0 files: b/c -0 Initial revision files: b/c -% commit branch -U b/c -T a -T b/c -checking in src/b/c,v -% convert again -connecting to cvsrepo -scanning source... -collecting CVS rlog -8 log entries -cvslog hook: 8 entries -creating changesets -5 changeset entries -cvschangesets hook: 5 changesets -sorting... -converting... -0 ci2 -c -d -% convert again with --filemap -connecting to cvsrepo -scanning source... -collecting CVS rlog -8 log entries -cvslog hook: 8 entries -creating changesets -5 changeset entries -cvschangesets hook: 5 changesets -sorting... -converting... -0 ci2 -c -d -4 ci2 files: b/c -3 ci1 files: b/c -2 update tags files: .hgtags -1 ci0 files: b/c -0 Initial revision files: b/c -% commit a new revision with funny log message -checking in src/a,v -% commit new file revisions with some fuzz -checking in src/a,v -checking in src/b/c,v -% convert again -connecting to cvsrepo -scanning source... -collecting CVS rlog -11 log entries -cvslog hook: 11 entries -creating changesets -8 changeset entries -cvschangesets hook: 8 changesets -sorting... -converting... -2 funny -1 fuzzy -0 fuzzy -o 8 (branch) fuzzy files: b/c -| -o 7 (branch) fuzzy files: a -| -o 6 (branch) funny -| ---------------------------- -| log message files: a -o 5 (branch) ci2 files: b/c - -o 4 () ci1 files: a b/c -| -o 3 () update tags files: .hgtags -| -o 2 () ci0 files: b/c -| -| o 1 (INITIAL) import files: -|/ -o 0 () Initial revision files: a b/c - -% testing debugcvsps -collecting CVS rlog -11 log entries -cvslog hook: 11 entries -creating changesets -10 changeset entries -cvschangesets hook: 10 changesets ---------------------- -PatchSet 1 -Date: -Author: -Branch: HEAD -Tag: (none) -Branchpoints: INITIAL -Log: -Initial revision - -Members: - a:INITIAL->1.1 - ---------------------- -PatchSet 2 -Date: -Author: -Branch: HEAD -Tag: (none) -Branchpoints: INITIAL, branch -Log: -Initial revision - -Members: - b/c:INITIAL->1.1 - ---------------------- -PatchSet 3 -Date: -Author: -Branch: INITIAL -Tag: start -Log: -import - -Members: - a:1.1->1.1.1.1 - b/c:1.1->1.1.1.1 - ---------------------- -PatchSet 4 -Date: -Author: -Branch: HEAD -Tag: (none) -Log: -ci0 - -Members: - b/c:1.1->1.2 - ---------------------- -PatchSet 5 -Date: -Author: -Branch: HEAD -Tag: (none) -Branchpoints: branch -Log: -ci1 - -Members: - a:1.1->1.2 - ---------------------- -PatchSet 6 -Date: -Author: -Branch: HEAD -Tag: (none) -Log: -ci1 - -Members: - b/c:1.2->1.3 - ---------------------- -PatchSet 7 -Date: -Author: -Branch: branch -Tag: (none) -Log: -ci2 - -Members: - b/c:1.1->1.1.2.1 - ---------------------- -PatchSet 8 -Date: -Author: -Branch: branch -Tag: (none) -Log: -funny ----------------------------- -log message - -Members: - a:1.2->1.2.2.1 - ---------------------- -PatchSet 9 -Date: -Author: -Branch: branch -Tag: (none) -Log: -fuzzy - -Members: - a:1.2.2.1->1.2.2.2 - ---------------------- -PatchSet 10 -Date: -Author: -Branch: branch -Tag: (none) -Log: -fuzzy - -Members: - b/c:1.1.2.1->1.1.2.2 - diff --git a/tests/test-convert-cvs b/tests/test-convert-cvs.t old mode 100755 new mode 100644 rename from tests/test-convert-cvs rename to tests/test-convert-cvs.t --- a/tests/test-convert-cvs +++ b/tests/test-convert-cvs.t @@ -1,154 +1,460 @@ -#!/bin/sh - -"$TESTDIR/hghave" cvs || exit 80 -cvscall() -{ - cvs -f "$@" -} + $ "$TESTDIR/hghave" cvs || exit 80 + $ cvscall() + > { + > cvs -f "$@" + > } + $ hgcat() + > { + > hg --cwd src-hg cat -r tip "$1" + > } + $ echo "[extensions]" >> $HGRCPATH + $ echo "convert = " >> $HGRCPATH + $ echo "graphlog = " >> $HGRCPATH + $ cat > cvshooks.py < def cvslog(ui,repo,hooktype,log): + > print "%s hook: %d entries"%(hooktype,len(log)) + > + > def cvschangesets(ui,repo,hooktype,changesets): + > print "%s hook: %d changesets"%(hooktype,len(changesets)) + > EOF + $ hookpath=`pwd` + $ echo "[hooks]" >> $HGRCPATH + $ echo "cvslog=python:$hookpath/cvshooks.py:cvslog" >> $HGRCPATH + $ echo "cvschangesets=python:$hookpath/cvshooks.py:cvschangesets" >> $HGRCPATH -hgcat() -{ - hg --cwd src-hg cat -r tip "$1" -} +create cvs repository + + $ mkdir cvsrepo + $ cd cvsrepo + $ CVSROOT=`pwd` + $ export CVSROOT + $ CVS_OPTIONS=-f + $ export CVS_OPTIONS + $ cd .. + $ cvscall -q -d "$CVSROOT" init + +create source directory + + $ mkdir src-temp + $ cd src-temp + $ echo a > a + $ mkdir b + $ cd b + $ echo c > c + $ cd .. + +import source directory -echo "[extensions]" >> $HGRCPATH -echo "convert = " >> $HGRCPATH -echo "graphlog = " >> $HGRCPATH + $ cvscall -q import -m import src INITIAL start + N src/a + N src/b/c + + No conflicts created by this import + + $ cd .. + +checkout source directory -cat > cvshooks.py <> b/c + $ cvscall -q commit -mci0 . | grep '<--' + */cvsrepo/src/b/c,v <-- *c (glob) + $ cd .. -def cvschangesets(ui,repo,hooktype,changesets): - print "%s hook: %d changesets"%(hooktype,len(changesets)) -EOF -hookpath=`pwd` +convert fresh repo -echo "[hooks]" >> $HGRCPATH -echo "cvslog=python:$hookpath/cvshooks.py:cvslog" >> $HGRCPATH -echo "cvschangesets=python:$hookpath/cvshooks.py:cvschangesets" >> $HGRCPATH + $ hg convert src src-hg + initializing destination src-hg repository + connecting to */cvsrepo (glob) + scanning source... + collecting CVS rlog + 5 log entries + cvslog hook: 5 entries + creating changesets + 3 changeset entries + cvschangesets hook: 3 changesets + sorting... + converting... + 2 Initial revision + 1 import + 0 ci0 + updating tags + $ hgcat a + a + $ hgcat b/c + c + c + +convert fresh repo with --filemap -echo % create cvs repository -mkdir cvsrepo -cd cvsrepo -CVSROOT=`pwd` -export CVSROOT -CVS_OPTIONS=-f -export CVS_OPTIONS -cd .. + $ echo include b/c > filemap + $ hg convert --filemap filemap src src-filemap + initializing destination src-filemap repository + connecting to */cvsrepo (glob) + scanning source... + collecting CVS rlog + 5 log entries + cvslog hook: 5 entries + creating changesets + 3 changeset entries + cvschangesets hook: 3 changesets + sorting... + converting... + 2 Initial revision + 1 import + filtering out empty revision + rolling back to revision 0 (undo commit) + 0 ci0 + updating tags + $ hgcat b/c + c + c + $ hg -R src-filemap log --template '{rev} {desc} files: {files}\n' + 2 update tags files: .hgtags + 1 ci0 files: b/c + 0 Initial revision files: b/c -cvscall -q -d "$CVSROOT" init +convert full repository (issue1649) -echo % create source directory -mkdir src-temp -cd src-temp -echo a > a -mkdir b -cd b -echo c > c -cd .. + $ cvscall -q -d "$CVSROOT" checkout -d srcfull "." | grep -v CVSROOT + U srcfull/src/a + U srcfull/src/b/c + $ ls srcfull + CVS + CVSROOT + src + $ hg convert srcfull srcfull-hg \ + > | grep -v 'log entries' | grep -v 'hook:' \ + > | grep -v '^[0-3] .*' # filter instable changeset order + initializing destination srcfull-hg repository + connecting to */cvsrepo (glob) + scanning source... + collecting CVS rlog + creating changesets + 4 changeset entries + sorting... + converting... + updating tags + $ hg cat -r tip srcfull-hg/src/a + a + $ hg cat -r tip srcfull-hg/src/b/c + c + c + +commit new file revisions -echo % import source directory -cvscall -q import -m import src INITIAL start -cd .. + $ cd src + $ echo a >> a + $ echo c >> b/c + $ cvscall -q commit -mci1 . | grep '<--' + */cvsrepo/src/a,v <-- a (glob) + */cvsrepo/src/b/c,v <-- *c (glob) + $ cd .. + +convert again -echo % checkout source directory -cvscall -q checkout src + $ hg convert src src-hg + connecting to */cvsrepo (glob) + scanning source... + collecting CVS rlog + 7 log entries + cvslog hook: 7 entries + creating changesets + 4 changeset entries + cvschangesets hook: 4 changesets + sorting... + converting... + 0 ci1 + $ hgcat a + a + a + $ hgcat b/c + c + c + c + +convert again with --filemap -echo % commit a new revision changing b/c -cd src -sleep 1 -echo c >> b/c -cvscall -q commit -mci0 . | grep '<--' |\ - sed -e 's:.*src/\(.*\),v.*:checking in src/\1,v:g' -cd .. + $ hg convert --filemap filemap src src-filemap + connecting to */cvsrepo (glob) + scanning source... + collecting CVS rlog + 7 log entries + cvslog hook: 7 entries + creating changesets + 4 changeset entries + cvschangesets hook: 4 changesets + sorting... + converting... + 0 ci1 + $ hgcat b/c + c + c + c + $ hg -R src-filemap log --template '{rev} {desc} files: {files}\n' + 3 ci1 files: b/c + 2 update tags files: .hgtags + 1 ci0 files: b/c + 0 Initial revision files: b/c -echo % convert fresh repo -hg convert src src-hg | sed -e 's/connecting to.*cvsrepo/connecting to cvsrepo/g' -hgcat a -hgcat b/c +commit branch -echo % convert fresh repo with --filemap -echo include b/c > filemap -hg convert --filemap filemap src src-filemap | sed -e 's/connecting to.*cvsrepo/connecting to cvsrepo/g' -hgcat b/c -hg -R src-filemap log --template '{rev} {desc} files: {files}\n' + $ cd src + $ cvs -q update -r1.1 b/c + U b/c + $ cvs -q tag -b branch + T a + T b/c + $ cvs -q update -r branch > /dev/null + $ echo d >> b/c + $ cvs -q commit -mci2 . | grep '<--' + */cvsrepo/src/b/c,v <-- *c (glob) + $ cd .. + +convert again -echo % 'convert full repository (issue1649)' -cvscall -q -d "$CVSROOT" checkout -d srcfull "." | grep -v CVSROOT -ls srcfull -hg convert srcfull srcfull-hg \ - | sed -e 's/connecting to.*cvsrepo/connecting to cvsrepo/g' \ - | grep -v 'log entries' | grep -v 'hook:' \ - | grep -v '^[0-3] .*' # filter instable changeset order -hg cat -r tip srcfull-hg/src/a -hg cat -r tip srcfull-hg/src/b/c + $ hg convert src src-hg + connecting to */cvsrepo (glob) + scanning source... + collecting CVS rlog + 8 log entries + cvslog hook: 8 entries + creating changesets + 5 changeset entries + cvschangesets hook: 5 changesets + sorting... + converting... + 0 ci2 + $ hgcat b/c + c + d + +convert again with --filemap -echo % commit new file revisions -cd src -echo a >> a -echo c >> b/c -cvscall -q commit -mci1 . | grep '<--' |\ - sed -e 's:.*src/\(.*\),v.*:checking in src/\1,v:g' -cd .. + $ hg convert --filemap filemap src src-filemap + connecting to */cvsrepo (glob) + scanning source... + collecting CVS rlog + 8 log entries + cvslog hook: 8 entries + creating changesets + 5 changeset entries + cvschangesets hook: 5 changesets + sorting... + converting... + 0 ci2 + $ hgcat b/c + c + d + $ hg -R src-filemap log --template '{rev} {desc} files: {files}\n' + 4 ci2 files: b/c + 3 ci1 files: b/c + 2 update tags files: .hgtags + 1 ci0 files: b/c + 0 Initial revision files: b/c + +commit a new revision with funny log message + + $ cd src + $ sleep 1 + $ echo e >> a + $ cvscall -q commit -m'funny + > ---------------------------- + > log message' . | grep '<--' |\ + > sed -e 's:.*src/\(.*\),v.*:checking in src/\1,v:g' + checking in src/a,v -echo % convert again -hg convert src src-hg | sed -e 's/connecting to.*cvsrepo/connecting to cvsrepo/g' -hgcat a -hgcat b/c +commit new file revisions with some fuzz -echo % convert again with --filemap -hg convert --filemap filemap src src-filemap | sed -e 's/connecting to.*cvsrepo/connecting to cvsrepo/g' -hgcat b/c -hg -R src-filemap log --template '{rev} {desc} files: {files}\n' + $ sleep 1 + $ echo f >> a + $ cvscall -q commit -mfuzzy . | grep '<--' + */cvsrepo/src/a,v <-- a (glob) + $ sleep 4 # the two changes will be split if fuzz < 4 + $ echo g >> b/c + $ cvscall -q commit -mfuzzy . | grep '<--' + */cvsrepo/src/b/c,v <-- *c (glob) + $ cd .. + +convert again -echo % commit branch -cd src -cvs -q update -r1.1 b/c -cvs -q tag -b branch -cvs -q update -r branch > /dev/null -echo d >> b/c -cvs -q commit -mci2 . | grep '<--' |\ - sed -e 's:.*src/\(.*\),v.*:checking in src/\1,v:g' -cd .. + $ hg convert --config convert.cvsps.fuzz=2 src src-hg + connecting to */cvsrepo (glob) + scanning source... + collecting CVS rlog + 11 log entries + cvslog hook: 11 entries + creating changesets + 8 changeset entries + cvschangesets hook: 8 changesets + sorting... + converting... + 2 funny + 1 fuzzy + 0 fuzzy + $ hg -R src-hg glog --template '{rev} ({branches}) {desc} files: {files}\n' + o 8 (branch) fuzzy files: b/c + | + o 7 (branch) fuzzy files: a + | + o 6 (branch) funny + | ---------------------------- + | log message files: a + o 5 (branch) ci2 files: b/c + + o 4 () ci1 files: a b/c + | + o 3 () update tags files: .hgtags + | + o 2 () ci0 files: b/c + | + | o 1 (INITIAL) import files: + |/ + o 0 () Initial revision files: a b/c + + +testing debugcvsps -echo % convert again -hg convert src src-hg | sed -e 's/connecting to.*cvsrepo/connecting to cvsrepo/g' -hgcat b/c - -echo % convert again with --filemap -hg convert --filemap filemap src src-filemap | sed -e 's/connecting to.*cvsrepo/connecting to cvsrepo/g' -hgcat b/c -hg -R src-filemap log --template '{rev} {desc} files: {files}\n' - -echo % commit a new revision with funny log message -cd src -sleep 1 -echo e >> a -cvscall -q commit -m'funny ----------------------------- -log message' . | grep '<--' |\ - sed -e 's:.*src/\(.*\),v.*:checking in src/\1,v:g' -cd .. + $ cd src + $ hg debugcvsps --fuzz=2 + collecting CVS rlog + 11 log entries + cvslog hook: 11 entries + creating changesets + 10 changeset entries + cvschangesets hook: 10 changesets + --------------------- + PatchSet 1 + Date: * (glob) + Author: * (glob) + Branch: HEAD + Tag: (none) + Branchpoints: INITIAL + Log: + Initial revision + + Members: + a:INITIAL->1.1 + + --------------------- + PatchSet 2 + Date: * (glob) + Author: * (glob) + Branch: HEAD + Tag: (none) + Branchpoints: INITIAL, branch + Log: + Initial revision + + Members: + b/c:INITIAL->1.1 + + --------------------- + PatchSet 3 + Date: * (glob) + Author: * (glob) + Branch: INITIAL + Tag: start + Log: + import + + Members: + a:1.1->1.1.1.1 + b/c:1.1->1.1.1.1 + + --------------------- + PatchSet 4 + Date: * (glob) + Author: * (glob) + Branch: HEAD + Tag: (none) + Log: + ci0 + + Members: + b/c:1.1->1.2 + + --------------------- + PatchSet 5 + Date: * (glob) + Author: * (glob) + Branch: HEAD + Tag: (none) + Branchpoints: branch + Log: + ci1 + + Members: + a:1.1->1.2 + + --------------------- + PatchSet 6 + Date: * (glob) + Author: * (glob) + Branch: HEAD + Tag: (none) + Log: + ci1 + + Members: + b/c:1.2->1.3 + + --------------------- + PatchSet 7 + Date: * (glob) + Author: * (glob) + Branch: branch + Tag: (none) + Log: + ci2 + + Members: + b/c:1.1->1.1.2.1 + + --------------------- + PatchSet 8 + Date: * (glob) + Author: * (glob) + Branch: branch + Tag: (none) + Log: + funny + ---------------------------- + log message + + Members: + a:1.2->1.2.2.1 + + --------------------- + PatchSet 9 + Date: * (glob) + Author: * (glob) + Branch: branch + Tag: (none) + Log: + fuzzy + + Members: + a:1.2.2.1->1.2.2.2 + + --------------------- + PatchSet 10 + Date: * (glob) + Author: * (glob) + Branch: branch + Tag: (none) + Log: + fuzzy + + Members: + b/c:1.1.2.1->1.1.2.2 + -echo % commit new file revisions with some fuzz -cd src -sleep 1 -echo f >> a -cvscall -q commit -mfuzzy . | grep '<--' |\ - sed -e 's:.*src/\(.*\),v.*:checking in src/\1,v:g' -sleep 4 # the two changes will be split if fuzz < 4 -echo g >> b/c -cvscall -q commit -mfuzzy . | grep '<--' |\ - sed -e 's:.*src/\(.*\),v.*:checking in src/\1,v:g' -cd .. - -echo % convert again -hg convert --config convert.cvsps.fuzz=2 src src-hg | sed -e 's/connecting to.*cvsrepo/connecting to cvsrepo/g' - -hg -R src-hg glog --template '{rev} ({branches}) {desc} files: {files}\n' - -echo % testing debugcvsps -cd src -hg debugcvsps --fuzz=2 | sed -e 's/Author:.*/Author:/' -e 's/Date:.*/Date:/'