diff --git a/contrib/check-code.py b/contrib/check-code.py --- a/contrib/check-code.py +++ b/contrib/check-code.py @@ -92,7 +92,8 @@ uprefix = r"^ \$ " utestpats = [ [ (r'^(\S| $ ).*(\S[ \t]+|^[ \t]+)\n', "trailing whitespace on non-output"), - (uprefix + r'.*\|\s*sed', "use regex test output patterns instead of sed"), + (uprefix + r'.*\|\s*sed[^|>\n]*\n', + "use regex test output patterns instead of sed"), (uprefix + r'(true|exit 0)', "explicit zero exit unnecessary"), (uprefix + r'.*(? baz--test--0--patch-1) -* committed baz@mercurial--convert/baz--test--0--patch-1 -% create link file and modify a -A src/.arch-ids/a-link.id -A src/a-link -M a -* update pristine tree (baz@mercurial--convert/baz--test--0--patch-1 => baz--test--0--patch-2) -* committed baz@mercurial--convert/baz--test--0--patch-2 -% create second link and modify b -A src/.arch-ids/a-link-2.id -A src/a-link-2 -Mb src/b -* update pristine tree (baz@mercurial--convert/baz--test--0--patch-2 => baz--test--0--patch-3) -* committed baz@mercurial--convert/baz--test--0--patch-3 -% b file to link and a-link-2 to regular file -fl src/b -lf src/a-link-2 -* update pristine tree (baz@mercurial--convert/baz--test--0--patch-3 => baz--test--0--patch-4) -* committed baz@mercurial--convert/baz--test--0--patch-4 -% move a-link-2 file and src directory -D/ src/.arch-ids -A/ test/.arch-ids -/> src test -=> src/.arch-ids/a-link-2.id .arch-ids/c.id -=> src/a-link-2 c -=> src/.arch-ids/=id test/.arch-ids/=id -=> src/.arch-ids/a-link.id test/.arch-ids/a-link.id -=> src/.arch-ids/b.id test/.arch-ids/b.id -* update pristine tree (baz@mercurial--convert/baz--test--0--patch-4 => baz--test--0--patch-5) -* committed baz@mercurial--convert/baz--test--0--patch-5 -% move and add the moved file again -A .arch-ids/e.id -A e -* update pristine tree (baz@mercurial--convert/baz--test--0--patch-5 => baz--test--0--patch-6) -* committed baz@mercurial--convert/baz--test--0--patch-6 -A .arch-ids/e.id -A e -=> .arch-ids/e.id .arch-ids/f.id -=> e f -* update pristine tree (baz@mercurial--convert/baz--test--0--patch-6 => baz--test--0--patch-7) -* committed baz@mercurial--convert/baz--test--0--patch-7 -% converting baz repo to Mercurial -initializing destination baz-repo-hg repository -analyzing tree version baz@mercurial--convert/baz--test--0... -scanning source... -sorting... -converting... -7 initial import -6 added a file, src and src/b (binary) -5 added link to a and modify a -4 added second link and modify b -3 file to link and link to file test -2 move and rename a-link-2 file and src directory -1 add e -0 move e and recreate it again -% show graph log -o 7 "move e and recreate it again" files: e f -| -o 6 "add e" files: e -| -o 5 "move and rename a-link-2 file and src directory" files: c src/a-link src/a-link-2 src/b test/a-link test/b -| -o 4 "file to link and link to file test" files: src/a-link-2 src/b -| -o 3 "added second link and modify b" files: src/a-link-2 src/b -| -o 2 "added link to a and modify a" files: a src/a-link -| -o 1 "added a file, src and src/b (binary)" files: a src/b -| -o 0 "initial import" files: - -c4072c4b72e1cabace081888efa148ee80ca3cbb 644 a -0201ac32a3a8e86e303dff60366382a54b48a72e 644 c -1a4a864db0073705a11b1439f563bfa4b46d9246 644 e -09e0222742fc3f75777fa9d68a5d8af7294cb5e7 644 f -c0067ba5ff0b7c9a3eb17270839d04614c435623 644 @ test/a-link -375f4263d86feacdea7e3c27100abd1560f2a973 644 @ test/b -copies: c (src/a-link-2) test/a-link (src/a-link) test/b (src/b) -copies: f (e) diff --git a/tests/test-convert-baz b/tests/test-convert-baz.t rename from tests/test-convert-baz rename to tests/test-convert-baz.t --- a/tests/test-convert-baz +++ b/tests/test-convert-baz.t @@ -1,79 +1,163 @@ -#!/bin/sh + $ "$TESTDIR/hghave" baz || exit 80 + + $ baz my-id "mercurial " -"$TESTDIR/hghave" baz || exit 80 - -baz my-id "mercurial " + $ echo "[extensions]" >> $HGRCPATH + $ echo "convert=" >> $HGRCPATH + $ echo 'graphlog =' >> $HGRCPATH -echo "[extensions]" >> $HGRCPATH -echo "convert=" >> $HGRCPATH -echo 'graphlog =' >> $HGRCPATH +create baz archive + $ baz make-archive baz@mercurial--convert hg-test-convert-baz -echo % create baz archive -baz make-archive baz@mercurial--convert hg-test-convert-baz +initialize baz repo + $ mkdir baz-repo + $ cd baz-repo/ + $ baz init-tree baz@mercurial--convert/baz--test--0 + $ baz import + * creating version baz@mercurial--convert/baz--test--0 + * imported baz@mercurial--convert/baz--test--0 -echo % initialize baz repo -mkdir baz-repo -cd baz-repo/ -baz init-tree baz@mercurial--convert/baz--test--0 -baz import +create initial files + $ echo 'this is a file' > a + $ baz add a + $ mkdir src + $ baz add src + $ cd src + $ dd count=1 if=/dev/zero of=b > /dev/null 2> /dev/null + $ baz add b +HACK: hide GNU tar-1.22 "tar: The --preserve option is deprecated, use --preserve-permissions --preserve-order instead" + $ baz commit -s "added a file, src and src/b (binary)" 2>&1 | grep -v '^tar' + * build pristine tree for baz@mercurial--convert/baz--test--0--base-0 + * Scanning for full-tree revision: . + * from import revision: baz@mercurial--convert/baz--test--0--base-0 + A/ .arch-ids + A/ src + A/ src/.arch-ids + A .arch-ids/a.id + A a + A src/.arch-ids/=id + A src/.arch-ids/b.id + A src/b + * update pristine tree (baz@mercurial--convert/baz--test--0--base-0 => baz--test--0--patch-1) + * committed baz@mercurial--convert/baz--test--0--patch-1 -echo % create initial files -echo 'this is a file' > a -baz add a -mkdir src -baz add src -cd src -dd count=1 if=/dev/zero of=b > /dev/null 2> /dev/null -baz add b -# HACK: hide GNU tar-1.22 "tar: The --preserve option is deprecated, use --preserve-permissions --preserve-order instead" -baz commit -s "added a file, src and src/b (binary)" 2>&1 | grep -v '^tar' +create link file and modify a + $ ln -s ../a a-link + $ baz add a-link + $ echo 'this a modification to a' >> ../a + $ baz commit -s "added link to a and modify a" + A src/.arch-ids/a-link.id + A src/a-link + M a + * update pristine tree (baz@mercurial--convert/baz--test--0--patch-1 => baz--test--0--patch-2) + * committed baz@mercurial--convert/baz--test--0--patch-2 -echo % create link file and modify a -ln -s ../a a-link -baz add a-link -echo 'this a modification to a' >> ../a -baz commit -s "added link to a and modify a" +create second link and modify b + $ ln -s ../a a-link-2 + $ baz add a-link-2 + $ dd count=1 seek=1 if=/dev/zero of=b > /dev/null 2> /dev/null + $ baz commit -s "added second link and modify b" + A src/.arch-ids/a-link-2.id + A src/a-link-2 + Mb src/b + * update pristine tree (baz@mercurial--convert/baz--test--0--patch-2 => baz--test--0--patch-3) + * committed baz@mercurial--convert/baz--test--0--patch-3 + +b file to link and a-link-2 to regular file + $ rm -f a-link-2 + $ echo 'this is now a regular file' > a-link-2 + $ ln -sf ../a b + $ baz commit -s "file to link and link to file test" + fl src/b + lf src/a-link-2 + * update pristine tree (baz@mercurial--convert/baz--test--0--patch-3 => baz--test--0--patch-4) + * committed baz@mercurial--convert/baz--test--0--patch-4 -echo % create second link and modify b -ln -s ../a a-link-2 -baz add a-link-2 -dd count=1 seek=1 if=/dev/zero of=b > /dev/null 2> /dev/null -baz commit -s "added second link and modify b" +move a-link-2 file and src directory + $ cd .. + $ baz mv src/a-link-2 c + $ baz mv src test + $ baz commit -s "move and rename a-link-2 file and src directory" + D/ src/.arch-ids + A/ test/.arch-ids + /> src test + => src/.arch-ids/a-link-2.id .arch-ids/c.id + => src/a-link-2 c + => src/.arch-ids/=id test/.arch-ids/=id + => src/.arch-ids/a-link.id test/.arch-ids/a-link.id + => src/.arch-ids/b.id test/.arch-ids/b.id + * update pristine tree (baz@mercurial--convert/baz--test--0--patch-4 => baz--test--0--patch-5) + * committed baz@mercurial--convert/baz--test--0--patch-5 -echo % b file to link and a-link-2 to regular file -rm -f a-link-2 -echo 'this is now a regular file' > a-link-2 -ln -sf ../a b -baz commit -s "file to link and link to file test" - -echo % move a-link-2 file and src directory -cd .. -baz mv src/a-link-2 c -baz mv src test -baz commit -s "move and rename a-link-2 file and src directory" +move and add the moved file again + $ echo e > e + $ baz add e + $ baz commit -s "add e" + A .arch-ids/e.id + A e + * update pristine tree (baz@mercurial--convert/baz--test--0--patch-5 => baz--test--0--patch-6) + * committed baz@mercurial--convert/baz--test--0--patch-6 + $ baz mv e f + $ echo ee > e + $ baz add e + $ baz commit -s "move e and recreate it again" + A .arch-ids/e.id + A e + => .arch-ids/e.id .arch-ids/f.id + => e f + * update pristine tree (baz@mercurial--convert/baz--test--0--patch-6 => baz--test--0--patch-7) + * committed baz@mercurial--convert/baz--test--0--patch-7 + $ cd .. -echo % move and add the moved file again -echo e > e -baz add e -baz commit -s "add e" -baz mv e f -echo ee > e -baz add e -baz commit -s "move e and recreate it again" -cd .. +converting baz repo to Mercurial + $ hg convert baz-repo baz-repo-hg + initializing destination baz-repo-hg repository + analyzing tree version baz@mercurial--convert/baz--test--0... + scanning source... + sorting... + converting... + 7 initial import + 6 added a file, src and src/b (binary) + 5 added link to a and modify a + 4 added second link and modify b + 3 file to link and link to file test + 2 move and rename a-link-2 file and src directory + 1 add e + 0 move e and recreate it again -echo % converting baz repo to Mercurial -hg convert baz-repo baz-repo-hg + $ baz register-archive -d baz@mercurial--convert + + $ glog() + > { + > hg glog --template '{rev} "{desc|firstline}" files: {files}\n' "$@" + > } -baz register-archive -d baz@mercurial--convert - -glog() -{ - hg glog --template '{rev} "{desc|firstline}" files: {files}\n' "$@" -} - -echo % show graph log -glog -R baz-repo-hg -hg up -q -R baz-repo-hg -hg -R baz-repo-hg manifest --debug -hg -R baz-repo-hg log -r 5 -r 7 -C --debug | grep copies +show graph log + $ glog -R baz-repo-hg + o 7 "move e and recreate it again" files: e f + | + o 6 "add e" files: e + | + o 5 "move and rename a-link-2 file and src directory" files: c src/a-link src/a-link-2 src/b test/a-link test/b + | + o 4 "file to link and link to file test" files: src/a-link-2 src/b + | + o 3 "added second link and modify b" files: src/a-link-2 src/b + | + o 2 "added link to a and modify a" files: a src/a-link + | + o 1 "added a file, src and src/b (binary)" files: a src/b + | + o 0 "initial import" files: + + $ hg up -q -R baz-repo-hg + $ hg -R baz-repo-hg manifest --debug + c4072c4b72e1cabace081888efa148ee80ca3cbb 644 a + 0201ac32a3a8e86e303dff60366382a54b48a72e 644 c + 1a4a864db0073705a11b1439f563bfa4b46d9246 644 e + 09e0222742fc3f75777fa9d68a5d8af7294cb5e7 644 f + c0067ba5ff0b7c9a3eb17270839d04614c435623 644 @ test/a-link + 375f4263d86feacdea7e3c27100abd1560f2a973 644 @ test/b + $ hg -R baz-repo-hg log -r 5 -r 7 -C --debug | grep copies + copies: c (src/a-link-2) test/a-link (src/a-link) test/b (src/b) + copies: f (e) diff --git a/tests/test-convert-p4-filetypes.out b/tests/test-convert-p4-filetypes.out deleted file mode 100644 --- a/tests/test-convert-p4-filetypes.out +++ /dev/null @@ -1,642 +0,0 @@ -% create p4 depot -% start the p4 server -% create a client spec -Client hg-p4-import saved. -% populate the depot -//depot/test-mercurial-import/file_text#1 - opened for add -//depot/test-mercurial-import/file_binary#1 - opened for add -//depot/test-mercurial-import/target_symlink#1 - opened for add -//depot/test-mercurial-import/file_symlink#1 - opened for add -//depot/test-mercurial-import/file_text+m#1 - opened for add -//depot/test-mercurial-import/file_text+w#1 - opened for add -//depot/test-mercurial-import/file_text+x#1 - opened for add -//depot/test-mercurial-import/file_text+k#1 - opened for add -//depot/test-mercurial-import/file_text+kx#1 - opened for add -//depot/test-mercurial-import/file_text+ko#1 - opened for add -//depot/test-mercurial-import/file_text+l#1 - opened for add -//depot/test-mercurial-import/file_text+c#1 - opened for add -//depot/test-mercurial-import/file_text+d#1 - opened for add -//depot/test-mercurial-import/file_text+f#1 - opened for add -//depot/test-mercurial-import/file_text+s#1 - opened for add -//depot/test-mercurial-import/file_text+s2#1 - opened for add -//depot/test-mercurial-import/file_binary+k#1 - opened for add -//depot/test-mercurial-import/file_binary+x#1 - opened for add -//depot/test-mercurial-import/file_binary+kx#1 - opened for add -//depot/test-mercurial-import/target_symlink+k#1 - opened for add -//depot/test-mercurial-import/file_symlink+k#1 - opened for add -//depot/test-mercurial-import/file_ctext#1 - opened for add -//depot/test-mercurial-import/file_cxtext#1 - opened for add -//depot/test-mercurial-import/file_ktext#1 - opened for add -//depot/test-mercurial-import/file_kxtext#1 - opened for add -//depot/test-mercurial-import/file_ltext#1 - opened for add -//depot/test-mercurial-import/file_tempobj#1 - opened for add -//depot/test-mercurial-import/file_ubinary#1 - opened for add -//depot/test-mercurial-import/file_uxbinary#1 - opened for add -//depot/test-mercurial-import/file_xbinary#1 - opened for add -//depot/test-mercurial-import/file_xltext#1 - opened for add -//depot/test-mercurial-import/file_xtempobj#1 - opened for add -//depot/test-mercurial-import/file_xtext#1 - opened for add -Submitting change 1. -Locking 33 files ... -add //depot/test-mercurial-import/file_binary#1 -add //depot/test-mercurial-import/file_binary+k#1 -add //depot/test-mercurial-import/file_binary+kx#1 -add //depot/test-mercurial-import/file_binary+x#1 -add //depot/test-mercurial-import/file_ctext#1 -add //depot/test-mercurial-import/file_cxtext#1 -add //depot/test-mercurial-import/file_ktext#1 -add //depot/test-mercurial-import/file_kxtext#1 -add //depot/test-mercurial-import/file_ltext#1 -add //depot/test-mercurial-import/file_symlink#1 -add //depot/test-mercurial-import/file_symlink+k#1 -add //depot/test-mercurial-import/file_tempobj#1 -add //depot/test-mercurial-import/file_text#1 -add //depot/test-mercurial-import/file_text+c#1 -add //depot/test-mercurial-import/file_text+d#1 -add //depot/test-mercurial-import/file_text+f#1 -add //depot/test-mercurial-import/file_text+k#1 -add //depot/test-mercurial-import/file_text+ko#1 -add //depot/test-mercurial-import/file_text+kx#1 -add //depot/test-mercurial-import/file_text+l#1 -add //depot/test-mercurial-import/file_text+m#1 -add //depot/test-mercurial-import/file_text+s#1 -add //depot/test-mercurial-import/file_text+s2#1 -add //depot/test-mercurial-import/file_text+w#1 -add //depot/test-mercurial-import/file_text+x#1 -add //depot/test-mercurial-import/file_ubinary#1 -add //depot/test-mercurial-import/file_uxbinary#1 -add //depot/test-mercurial-import/file_xbinary#1 -add //depot/test-mercurial-import/file_xltext#1 -add //depot/test-mercurial-import/file_xtempobj#1 -add //depot/test-mercurial-import/file_xtext#1 -add //depot/test-mercurial-import/target_symlink#1 -add //depot/test-mercurial-import/target_symlink+k#1 -Change 1 submitted. -//depot/test-mercurial-import/file_binary+k#1 - refreshing -//depot/test-mercurial-import/file_binary+kx#1 - refreshing -//depot/test-mercurial-import/file_ktext#1 - refreshing -//depot/test-mercurial-import/file_kxtext#1 - refreshing -//depot/test-mercurial-import/file_symlink+k#1 - refreshing -//depot/test-mercurial-import/file_text+k#1 - refreshing -//depot/test-mercurial-import/file_text+ko#1 - refreshing -//depot/test-mercurial-import/file_text+kx#1 - refreshing -% test keyword expansion -//depot/test-mercurial-import/file_binary#1 - opened for edit -//depot/test-mercurial-import/file_binary+k#1 - opened for edit -//depot/test-mercurial-import/file_binary+kx#1 - opened for edit -//depot/test-mercurial-import/file_binary+x#1 - opened for edit -//depot/test-mercurial-import/file_ctext#1 - opened for edit -//depot/test-mercurial-import/file_cxtext#1 - opened for edit -//depot/test-mercurial-import/file_ktext#1 - opened for edit -//depot/test-mercurial-import/file_kxtext#1 - opened for edit -//depot/test-mercurial-import/file_ltext#1 - opened for edit -//depot/test-mercurial-import/file_symlink#1 - opened for edit -//depot/test-mercurial-import/file_symlink+k#1 - opened for edit -//depot/test-mercurial-import/file_tempobj#1 - opened for edit -//depot/test-mercurial-import/file_text#1 - opened for edit -//depot/test-mercurial-import/file_text+c#1 - opened for edit -//depot/test-mercurial-import/file_text+d#1 - opened for edit -//depot/test-mercurial-import/file_text+f#1 - opened for edit -//depot/test-mercurial-import/file_text+k#1 - opened for edit -//depot/test-mercurial-import/file_text+ko#1 - opened for edit -//depot/test-mercurial-import/file_text+kx#1 - opened for edit -//depot/test-mercurial-import/file_text+l#1 - opened for edit -//depot/test-mercurial-import/file_text+m#1 - opened for edit -//depot/test-mercurial-import/file_text+s#1 - opened for edit -//depot/test-mercurial-import/file_text+s2#1 - opened for edit -//depot/test-mercurial-import/file_text+w#1 - opened for edit -//depot/test-mercurial-import/file_text+x#1 - opened for edit -//depot/test-mercurial-import/file_ubinary#1 - opened for edit -//depot/test-mercurial-import/file_uxbinary#1 - opened for edit -//depot/test-mercurial-import/file_xbinary#1 - opened for edit -//depot/test-mercurial-import/file_xltext#1 - opened for edit -//depot/test-mercurial-import/file_xtempobj#1 - opened for edit -//depot/test-mercurial-import/file_xtext#1 - opened for edit -//depot/test-mercurial-import/target_symlink#1 - opened for edit -//depot/test-mercurial-import/target_symlink+k#1 - opened for edit -//depot/test-mercurial-import/crazy_symlink+k#1 - opened for add -Submitting change 2. -Locking 34 files ... -add //depot/test-mercurial-import/crazy_symlink+k#1 -edit //depot/test-mercurial-import/file_binary#2 -edit //depot/test-mercurial-import/file_binary+k#2 -edit //depot/test-mercurial-import/file_binary+kx#2 -edit //depot/test-mercurial-import/file_binary+x#2 -edit //depot/test-mercurial-import/file_ctext#2 -edit //depot/test-mercurial-import/file_cxtext#2 -edit //depot/test-mercurial-import/file_ktext#2 -edit //depot/test-mercurial-import/file_kxtext#2 -edit //depot/test-mercurial-import/file_ltext#2 -edit //depot/test-mercurial-import/file_symlink#2 -edit //depot/test-mercurial-import/file_symlink+k#2 -edit //depot/test-mercurial-import/file_tempobj#2 -edit //depot/test-mercurial-import/file_text#2 -edit //depot/test-mercurial-import/file_text+c#2 -edit //depot/test-mercurial-import/file_text+d#2 -edit //depot/test-mercurial-import/file_text+f#2 -edit //depot/test-mercurial-import/file_text+k#2 -edit //depot/test-mercurial-import/file_text+ko#2 -edit //depot/test-mercurial-import/file_text+kx#2 -edit //depot/test-mercurial-import/file_text+l#2 -edit //depot/test-mercurial-import/file_text+m#2 -edit //depot/test-mercurial-import/file_text+s#2 -edit //depot/test-mercurial-import/file_text+s2#2 -edit //depot/test-mercurial-import/file_text+w#2 -edit //depot/test-mercurial-import/file_text+x#2 -edit //depot/test-mercurial-import/file_ubinary#2 -edit //depot/test-mercurial-import/file_uxbinary#2 -edit //depot/test-mercurial-import/file_xbinary#2 -edit //depot/test-mercurial-import/file_xltext#2 -edit //depot/test-mercurial-import/file_xtempobj#2 -edit //depot/test-mercurial-import/file_xtext#2 -edit //depot/test-mercurial-import/target_symlink#2 -edit //depot/test-mercurial-import/target_symlink+k#2 -Change 2 submitted. -//depot/test-mercurial-import/crazy_symlink+k#1 - refreshing -//depot/test-mercurial-import/file_binary+k#2 - refreshing -//depot/test-mercurial-import/file_binary+kx#2 - refreshing -//depot/test-mercurial-import/file_ktext#2 - refreshing -//depot/test-mercurial-import/file_kxtext#2 - refreshing -//depot/test-mercurial-import/file_symlink+k#2 - refreshing -//depot/test-mercurial-import/file_text+k#2 - refreshing -//depot/test-mercurial-import/file_text+ko#2 - refreshing -//depot/test-mercurial-import/file_text+kx#2 - refreshing -% check keywords in p4 -file_binary:$Header$ -file_binary:$Header$$Header$Header$ -file_binary+k:$Header: //depot/test-mercurial-import/file_binary+k#2 $ -file_binary+k:$Header: //depot/test-mercurial-import/file_binary+k#2 $$Header: //depot/test-mercurial-import/file_binary+k#2 $Header$ -file_binary+kx:$Header: //depot/test-mercurial-import/file_binary+kx#2 $ -file_binary+kx:$Header: //depot/test-mercurial-import/file_binary+kx#2 $$Header: //depot/test-mercurial-import/file_binary+kx#2 $Header$ -file_binary+x:$Header$ -file_binary+x:$Header$$Header$Header$ -file_ctext:$Header$ -file_ctext:$Header$$Header$Header$ -file_cxtext:$Header$ -file_cxtext:$Header$$Header$Header$ -file_ktext:$Header: //depot/test-mercurial-import/file_ktext#2 $ -file_ktext:$Header: //depot/test-mercurial-import/file_ktext#2 $$Header: //depot/test-mercurial-import/file_ktext#2 $Header$ -file_kxtext:$Header: //depot/test-mercurial-import/file_kxtext#2 $ -file_kxtext:$Header: //depot/test-mercurial-import/file_kxtext#2 $$Header: //depot/test-mercurial-import/file_kxtext#2 $Header$ -file_ltext:$Header$ -file_ltext:$Header$$Header$Header$ -file_symlink:$Header$ -file_symlink:$Header$$Header$Header$ -file_symlink+k:$Header$ -file_symlink+k:$Header$$Header$Header$ -file_tempobj:$Header$ -file_tempobj:$Header$$Header$Header$ -file_text:$Header$ -file_text:$Header$$Header$Header$ -file_text+c:$Header$ -file_text+c:$Header$$Header$Header$ -file_text+d:$Header$ -file_text+d:$Header$$Header$Header$ -file_text+f:$Header$ -file_text+f:$Header$$Header$Header$ -file_text+k:$Header: //depot/test-mercurial-import/file_text+k#2 $ -file_text+k:$Header: //depot/test-mercurial-import/file_text+k#2 $$Header: //depot/test-mercurial-import/file_text+k#2 $Header$ -file_text+ko:$Header: //depot/test-mercurial-import/file_text+ko#2 $ -file_text+ko:$Header: //depot/test-mercurial-import/file_text+ko#2 $$Header: //depot/test-mercurial-import/file_text+ko#2 $Header$ -file_text+kx:$Header: //depot/test-mercurial-import/file_text+kx#2 $ -file_text+kx:$Header: //depot/test-mercurial-import/file_text+kx#2 $$Header: //depot/test-mercurial-import/file_text+kx#2 $Header$ -file_text+l:$Header$ -file_text+l:$Header$$Header$Header$ -file_text+m:$Header$ -file_text+m:$Header$$Header$Header$ -file_text+s:$Header$ -file_text+s:$Header$$Header$Header$ -file_text+s2:$Header$ -file_text+s2:$Header$$Header$Header$ -file_text+w:$Header$ -file_text+w:$Header$$Header$Header$ -file_text+x:$Header$ -file_text+x:$Header$$Header$Header$ -file_ubinary:$Header$ -file_ubinary:$Header$$Header$Header$ -file_uxbinary:$Header$ -file_uxbinary:$Header$$Header$Header$ -file_xbinary:$Header$ -file_xbinary:$Header$$Header$Header$ -file_xltext:$Header$ -file_xltext:$Header$$Header$Header$ -file_xtempobj:$Header$ -file_xtempobj:$Header$$Header$Header$ -file_xtext:$Header$ -file_xtext:$Header$$Header$Header$ -% convert -initializing destination dst repository -reading p4 views -collecting p4 changelists -1 initial -2 keywords -scanning source... -sorting... -converting... -1 initial -0 keywords -rev=1 desc="keywords" tags="tip" files="crazy_symlink+k file_binary file_binary+k file_binary+kx file_binary+x file_ctext file_cxtext file_ktext file_kxtext file_ltext file_text file_text+c file_text+d file_text+f file_text+k file_text+ko file_text+kx file_text+l file_text+m file_text+s file_text+s2 file_text+w file_text+x file_ubinary file_uxbinary file_xbinary file_xltext file_xtext target_symlink target_symlink+k" -grev=0 desc="initial" tags="" files="file_binary file_binary+k file_binary+kx file_binary+x file_ctext file_cxtext file_ktext file_kxtext file_ltext file_symlink file_symlink+k file_text file_text+c file_text+d file_text+f file_text+k file_text+ko file_text+kx file_text+l file_text+m file_text+s2 file_text+w file_text+x file_ubinary file_uxbinary file_xbinary file_xltext file_xtext target_symlink target_symlink+k" -g% revision 0 -30 files updated, 0 files merged, 0 files removed, 0 files unresolved -==> dst/file_binary <== -this is binary -==> dst/file_binary+k <== -this is binary+k -==> dst/file_binary+kx <== -this is binary+kx -==> dst/file_binary+x <== -this is binary+x -==> dst/file_ctext <== -this is ctext - -==> dst/file_cxtext <== -this is cxtext - -==> dst/file_ktext <== -this is ktext - -==> dst/file_kxtext <== -this is kxtext - -==> dst/file_ltext <== -this is ltext - -==> dst/file_symlink <== -this is target symlink - -==> dst/file_symlink+k <== -this is target symlink+k - -==> dst/file_text <== -this is text - -==> dst/file_text+c <== -this is text+C - -==> dst/file_text+d <== -this is text+D - -==> dst/file_text+f <== -this is text+F - -==> dst/file_text+k <== -this is text+k - -==> dst/file_text+ko <== -this is text+ko - -==> dst/file_text+kx <== -this is text+kx - -==> dst/file_text+l <== -this is text+l - -==> dst/file_text+m <== -this is text+m - -==> dst/file_text+s2 <== -this is text+S2 - -==> dst/file_text+w <== -this is text+w - -==> dst/file_text+x <== -this is text+x - -==> dst/file_ubinary <== -this is ubinary - -==> dst/file_uxbinary <== -this is uxbinary - -==> dst/file_xbinary <== -this is xbinary - -==> dst/file_xltext <== -this is xltext - -==> dst/file_xtext <== -this is xtext - -% revision 1 -30 files updated, 0 files merged, 0 files removed, 0 files unresolved -==> dst/file_binary <== -this is binary$Id$ -$Header$ -$Date$ -$DateTime$ -$Change$ -$File$ -$Revision$ -$Header$$Header$Header$ - -==> dst/file_binary+k <== -this is binary+k$Id$ -$Header$ -$Date$ -$DateTime$ -$Change$ -$File$ -$Revision$ -$Header$$Header$Header$ - -==> dst/file_binary+kx <== -this is binary+kx$Id$ -$Header$ -$Date$ -$DateTime$ -$Change$ -$File$ -$Revision$ -$Header$$Header$Header$ - -==> dst/file_binary+x <== -this is binary+x$Id$ -$Header$ -$Date$ -$DateTime$ -$Change$ -$File$ -$Revision$ -$Header$$Header$Header$ - -==> dst/file_ctext <== -this is ctext -$Id$ -$Header$ -$Date$ -$DateTime$ -$Change$ -$File$ -$Revision$ -$Header$$Header$Header$ - -==> dst/file_cxtext <== -this is cxtext -$Id$ -$Header$ -$Date$ -$DateTime$ -$Change$ -$File$ -$Revision$ -$Header$$Header$Header$ - -==> dst/file_ktext <== -this is ktext -$Id$ -$Header$ -$Date$ -$DateTime$ -$Change$ -$File$ -$Revision$ -$Header$$Header$Header$ - -==> dst/file_kxtext <== -this is kxtext -$Id$ -$Header$ -$Date$ -$DateTime$ -$Change$ -$File$ -$Revision$ -$Header$$Header$Header$ - -==> dst/file_ltext <== -this is ltext -$Id$ -$Header$ -$Date$ -$DateTime$ -$Change$ -$File$ -$Revision$ -$Header$$Header$Header$ - -==> dst/file_symlink <== -this is target symlink -$Id$ -$Header$ -$Date$ -$DateTime$ -$Change$ -$File$ -$Revision$ -$Header$$Header$Header$ - -==> dst/file_symlink+k <== -this is target symlink+k -$Id$ -$Header$ -$Date$ -$DateTime$ -$Change$ -$File$ -$Revision$ -$Header$$Header$Header$ - -==> dst/file_text <== -this is text -$Id$ -$Header$ -$Date$ -$DateTime$ -$Change$ -$File$ -$Revision$ -$Header$$Header$Header$ - -==> dst/file_text+c <== -this is text+C -$Id$ -$Header$ -$Date$ -$DateTime$ -$Change$ -$File$ -$Revision$ -$Header$$Header$Header$ - -==> dst/file_text+d <== -this is text+D -$Id$ -$Header$ -$Date$ -$DateTime$ -$Change$ -$File$ -$Revision$ -$Header$$Header$Header$ - -==> dst/file_text+f <== -this is text+F -$Id$ -$Header$ -$Date$ -$DateTime$ -$Change$ -$File$ -$Revision$ -$Header$$Header$Header$ - -==> dst/file_text+k <== -this is text+k -$Id$ -$Header$ -$Date$ -$DateTime$ -$Change$ -$File$ -$Revision$ -$Header$$Header$Header$ - -==> dst/file_text+ko <== -this is text+ko -$Id$ -$Header$ -$Date$ -$DateTime$ -$Change$ -$File$ -$Revision$ -$Header$$Header$Header$ - -==> dst/file_text+kx <== -this is text+kx -$Id$ -$Header$ -$Date$ -$DateTime$ -$Change$ -$File$ -$Revision$ -$Header$$Header$Header$ - -==> dst/file_text+l <== -this is text+l -$Id$ -$Header$ -$Date$ -$DateTime$ -$Change$ -$File$ -$Revision$ -$Header$$Header$Header$ - -==> dst/file_text+m <== -this is text+m -$Id$ -$Header$ -$Date$ -$DateTime$ -$Change$ -$File$ -$Revision$ -$Header$$Header$Header$ - -==> dst/file_text+s <== -this is text+S -$Id$ -$Header$ -$Date$ -$DateTime$ -$Change$ -$File$ -$Revision$ -$Header$$Header$Header$ - -==> dst/file_text+s2 <== -this is text+S2 -$Id$ -$Header$ -$Date$ -$DateTime$ -$Change$ -$File$ -$Revision$ -$Header$$Header$Header$ - -==> dst/file_text+w <== -this is text+w -$Id$ -$Header$ -$Date$ -$DateTime$ -$Change$ -$File$ -$Revision$ -$Header$$Header$Header$ - -==> dst/file_text+x <== -this is text+x -$Id$ -$Header$ -$Date$ -$DateTime$ -$Change$ -$File$ -$Revision$ -$Header$$Header$Header$ - -==> dst/file_ubinary <== -this is ubinary -$Id$ -$Header$ -$Date$ -$DateTime$ -$Change$ -$File$ -$Revision$ -$Header$$Header$Header$ - -==> dst/file_uxbinary <== -this is uxbinary -$Id$ -$Header$ -$Date$ -$DateTime$ -$Change$ -$File$ -$Revision$ -$Header$$Header$Header$ - -==> dst/file_xbinary <== -this is xbinary -$Id$ -$Header$ -$Date$ -$DateTime$ -$Change$ -$File$ -$Revision$ -$Header$$Header$Header$ - -==> dst/file_xltext <== -this is xltext -$Id$ -$Header$ -$Date$ -$DateTime$ -$Change$ -$File$ -$Revision$ -$Header$$Header$Header$ - -==> dst/file_xtext <== -this is xtext -$Id$ -$Header$ -$Date$ -$DateTime$ -$Change$ -$File$ -$Revision$ -$Header$$Header$Header$ - -% crazy_symlink -target_$Header: //depot/test-mercurial-import/crazy_symlink+k#1 $ -target_$Header$ -% stop the p4 server diff --git a/tests/test-convert-p4-filetypes b/tests/test-convert-p4-filetypes.t rename from tests/test-convert-p4-filetypes rename to tests/test-convert-p4-filetypes.t --- a/tests/test-convert-p4-filetypes +++ b/tests/test-convert-p4-filetypes.t @@ -1,104 +1,733 @@ -#!/bin/sh + $ "$TESTDIR/hghave" p4 execbit symlink || exit 80 + + $ echo "[extensions]" >> $HGRCPATH + $ echo "convert = " >> $HGRCPATH + +create p4 depot + $ P4ROOT=`pwd`/depot; export P4ROOT + $ P4AUDIT=$P4ROOT/audit; export P4AUDIT + $ P4JOURNAL=$P4ROOT/journal; export P4JOURNAL + $ P4LOG=$P4ROOT/log; export P4LOG + $ P4PORT=localhost:16661; export P4PORT + $ P4DEBUG=1; export P4DEBUG + $ P4CHARSET=utf8; export P4CHARSET -"$TESTDIR/hghave" p4 execbit symlink || exit 80 +start the p4 server + $ [ ! -d $P4ROOT ] && mkdir $P4ROOT + $ p4d -f -J off -xi >$P4ROOT/stdout 2>$P4ROOT/stderr + $ p4d -f -J off >$P4ROOT/stdout 2>$P4ROOT/stderr & + $ echo $! >> $DAEMON_PIDS + $ trap "echo stopping the p4 server ; p4 admin stop" EXIT -echo "[extensions]" >> $HGRCPATH -echo "convert = " >> $HGRCPATH +wait for the server to initialize + $ while ! p4 ; do + > sleep 1 + > done >/dev/null 2>/dev/null + +create a client spec + $ P4CLIENT=hg-p4-import; export P4CLIENT + $ DEPOTPATH=//depot/test-mercurial-import/... + $ p4 client -o | sed '/^View:/,$ d' >p4client + $ echo View: >>p4client + $ echo " $DEPOTPATH //$P4CLIENT/..." >>p4client + $ p4 client -i T2=`echo $T | tr [:upper:] [:lower:]` + > case $T in + > apple) + > ;; + > symlink*) + > echo "this is target $T" >target_$T2 + > ln -s target_$T file_$T2 + > p4 add target_$T2 + > p4 add -t $T file_$T2 + > ;; + > binary*) + > python -c "file('file_$T2', 'wb').write('this is $T')" + > p4 add -t $T file_$T2 + > ;; + > *) + > echo "this is $T" >file_$T2 + > p4 add -t $T file_$T2 + > ;; + > esac + > done + //depot/test-mercurial-import/file_text#1 - opened for add + //depot/test-mercurial-import/file_binary#1 - opened for add + //depot/test-mercurial-import/target_symlink#1 - opened for add + //depot/test-mercurial-import/file_symlink#1 - opened for add + //depot/test-mercurial-import/file_text+m#1 - opened for add + //depot/test-mercurial-import/file_text+w#1 - opened for add + //depot/test-mercurial-import/file_text+x#1 - opened for add + //depot/test-mercurial-import/file_text+k#1 - opened for add + //depot/test-mercurial-import/file_text+kx#1 - opened for add + //depot/test-mercurial-import/file_text+ko#1 - opened for add + //depot/test-mercurial-import/file_text+l#1 - opened for add + //depot/test-mercurial-import/file_text+c#1 - opened for add + //depot/test-mercurial-import/file_text+d#1 - opened for add + //depot/test-mercurial-import/file_text+f#1 - opened for add + //depot/test-mercurial-import/file_text+s#1 - opened for add + //depot/test-mercurial-import/file_text+s2#1 - opened for add + //depot/test-mercurial-import/file_binary+k#1 - opened for add + //depot/test-mercurial-import/file_binary+x#1 - opened for add + //depot/test-mercurial-import/file_binary+kx#1 - opened for add + //depot/test-mercurial-import/target_symlink+k#1 - opened for add + //depot/test-mercurial-import/file_symlink+k#1 - opened for add + //depot/test-mercurial-import/file_ctext#1 - opened for add + //depot/test-mercurial-import/file_cxtext#1 - opened for add + //depot/test-mercurial-import/file_ktext#1 - opened for add + //depot/test-mercurial-import/file_kxtext#1 - opened for add + //depot/test-mercurial-import/file_ltext#1 - opened for add + //depot/test-mercurial-import/file_tempobj#1 - opened for add + //depot/test-mercurial-import/file_ubinary#1 - opened for add + //depot/test-mercurial-import/file_uxbinary#1 - opened for add + //depot/test-mercurial-import/file_xbinary#1 - opened for add + //depot/test-mercurial-import/file_xltext#1 - opened for add + //depot/test-mercurial-import/file_xtempobj#1 - opened for add + //depot/test-mercurial-import/file_xtext#1 - opened for add + $ p4 submit -d initial + Submitting change 1. + Locking 33 files ... + add //depot/test-mercurial-import/file_binary#1 + add //depot/test-mercurial-import/file_binary+k#1 + add //depot/test-mercurial-import/file_binary+kx#1 + add //depot/test-mercurial-import/file_binary+x#1 + add //depot/test-mercurial-import/file_ctext#1 + add //depot/test-mercurial-import/file_cxtext#1 + add //depot/test-mercurial-import/file_ktext#1 + add //depot/test-mercurial-import/file_kxtext#1 + add //depot/test-mercurial-import/file_ltext#1 + add //depot/test-mercurial-import/file_symlink#1 + add //depot/test-mercurial-import/file_symlink+k#1 + add //depot/test-mercurial-import/file_tempobj#1 + add //depot/test-mercurial-import/file_text#1 + add //depot/test-mercurial-import/file_text+c#1 + add //depot/test-mercurial-import/file_text+d#1 + add //depot/test-mercurial-import/file_text+f#1 + add //depot/test-mercurial-import/file_text+k#1 + add //depot/test-mercurial-import/file_text+ko#1 + add //depot/test-mercurial-import/file_text+kx#1 + add //depot/test-mercurial-import/file_text+l#1 + add //depot/test-mercurial-import/file_text+m#1 + add //depot/test-mercurial-import/file_text+s#1 + add //depot/test-mercurial-import/file_text+s2#1 + add //depot/test-mercurial-import/file_text+w#1 + add //depot/test-mercurial-import/file_text+x#1 + add //depot/test-mercurial-import/file_ubinary#1 + add //depot/test-mercurial-import/file_uxbinary#1 + add //depot/test-mercurial-import/file_xbinary#1 + add //depot/test-mercurial-import/file_xltext#1 + add //depot/test-mercurial-import/file_xtempobj#1 + add //depot/test-mercurial-import/file_xtext#1 + add //depot/test-mercurial-import/target_symlink#1 + add //depot/test-mercurial-import/target_symlink+k#1 + Change 1 submitted. + //depot/test-mercurial-import/file_binary+k#1 - refreshing + //depot/test-mercurial-import/file_binary+kx#1 - refreshing + //depot/test-mercurial-import/file_ktext#1 - refreshing + //depot/test-mercurial-import/file_kxtext#1 - refreshing + //depot/test-mercurial-import/file_symlink+k#1 - refreshing + //depot/test-mercurial-import/file_text+k#1 - refreshing + //depot/test-mercurial-import/file_text+ko#1 - refreshing + //depot/test-mercurial-import/file_text+kx#1 - refreshing -echo % start the p4 server -[ ! -d $P4ROOT ] && mkdir $P4ROOT -p4d -f -J off -xi >$P4ROOT/stdout 2>$P4ROOT/stderr -p4d -f -J off >$P4ROOT/stdout 2>$P4ROOT/stderr & -trap "echo % stop the p4 server ; p4 admin stop" EXIT +test keyword expansion + $ p4 edit file_* target_* + //depot/test-mercurial-import/file_binary#1 - opened for edit + //depot/test-mercurial-import/file_binary+k#1 - opened for edit + //depot/test-mercurial-import/file_binary+kx#1 - opened for edit + //depot/test-mercurial-import/file_binary+x#1 - opened for edit + //depot/test-mercurial-import/file_ctext#1 - opened for edit + //depot/test-mercurial-import/file_cxtext#1 - opened for edit + //depot/test-mercurial-import/file_ktext#1 - opened for edit + //depot/test-mercurial-import/file_kxtext#1 - opened for edit + //depot/test-mercurial-import/file_ltext#1 - opened for edit + //depot/test-mercurial-import/file_symlink#1 - opened for edit + //depot/test-mercurial-import/file_symlink+k#1 - opened for edit + //depot/test-mercurial-import/file_tempobj#1 - opened for edit + //depot/test-mercurial-import/file_text#1 - opened for edit + //depot/test-mercurial-import/file_text+c#1 - opened for edit + //depot/test-mercurial-import/file_text+d#1 - opened for edit + //depot/test-mercurial-import/file_text+f#1 - opened for edit + //depot/test-mercurial-import/file_text+k#1 - opened for edit + //depot/test-mercurial-import/file_text+ko#1 - opened for edit + //depot/test-mercurial-import/file_text+kx#1 - opened for edit + //depot/test-mercurial-import/file_text+l#1 - opened for edit + //depot/test-mercurial-import/file_text+m#1 - opened for edit + //depot/test-mercurial-import/file_text+s#1 - opened for edit + //depot/test-mercurial-import/file_text+s2#1 - opened for edit + //depot/test-mercurial-import/file_text+w#1 - opened for edit + //depot/test-mercurial-import/file_text+x#1 - opened for edit + //depot/test-mercurial-import/file_ubinary#1 - opened for edit + //depot/test-mercurial-import/file_uxbinary#1 - opened for edit + //depot/test-mercurial-import/file_xbinary#1 - opened for edit + //depot/test-mercurial-import/file_xltext#1 - opened for edit + //depot/test-mercurial-import/file_xtempobj#1 - opened for edit + //depot/test-mercurial-import/file_xtext#1 - opened for edit + //depot/test-mercurial-import/target_symlink#1 - opened for edit + //depot/test-mercurial-import/target_symlink+k#1 - opened for edit + $ for T in $TYPES ; do + > T2=`echo $T | tr [:upper:] [:lower:]` + > echo '$Id$' >>file_$T2 + > echo '$Header$' >>file_$T2 + > echo '$Date$' >>file_$T2 + > echo '$DateTime$' >>file_$T2 + > echo '$Change$' >>file_$T2 + > echo '$File$' >>file_$T2 + > echo '$Revision$' >>file_$T2 + > echo '$Header$$Header$Header$' >>file_$T2 + > done + + $ ln -s 'target_$Header$' crazy_symlink+k + $ p4 add -t symlink+k crazy_symlink+k + //depot/test-mercurial-import/crazy_symlink+k#1 - opened for add -# wait for the server to initialize -while ! p4 ; do - sleep 1 -done >/dev/null 2>/dev/null + $ p4 submit -d keywords + Submitting change 2. + Locking 34 files ... + add //depot/test-mercurial-import/crazy_symlink+k#1 + edit //depot/test-mercurial-import/file_binary#2 + edit //depot/test-mercurial-import/file_binary+k#2 + edit //depot/test-mercurial-import/file_binary+kx#2 + edit //depot/test-mercurial-import/file_binary+x#2 + edit //depot/test-mercurial-import/file_ctext#2 + edit //depot/test-mercurial-import/file_cxtext#2 + edit //depot/test-mercurial-import/file_ktext#2 + edit //depot/test-mercurial-import/file_kxtext#2 + edit //depot/test-mercurial-import/file_ltext#2 + edit //depot/test-mercurial-import/file_symlink#2 + edit //depot/test-mercurial-import/file_symlink+k#2 + edit //depot/test-mercurial-import/file_tempobj#2 + edit //depot/test-mercurial-import/file_text#2 + edit //depot/test-mercurial-import/file_text+c#2 + edit //depot/test-mercurial-import/file_text+d#2 + edit //depot/test-mercurial-import/file_text+f#2 + edit //depot/test-mercurial-import/file_text+k#2 + edit //depot/test-mercurial-import/file_text+ko#2 + edit //depot/test-mercurial-import/file_text+kx#2 + edit //depot/test-mercurial-import/file_text+l#2 + edit //depot/test-mercurial-import/file_text+m#2 + edit //depot/test-mercurial-import/file_text+s#2 + edit //depot/test-mercurial-import/file_text+s2#2 + edit //depot/test-mercurial-import/file_text+w#2 + edit //depot/test-mercurial-import/file_text+x#2 + edit //depot/test-mercurial-import/file_ubinary#2 + edit //depot/test-mercurial-import/file_uxbinary#2 + edit //depot/test-mercurial-import/file_xbinary#2 + edit //depot/test-mercurial-import/file_xltext#2 + edit //depot/test-mercurial-import/file_xtempobj#2 + edit //depot/test-mercurial-import/file_xtext#2 + edit //depot/test-mercurial-import/target_symlink#2 + edit //depot/test-mercurial-import/target_symlink+k#2 + Change 2 submitted. + //depot/test-mercurial-import/crazy_symlink+k#1 - refreshing + //depot/test-mercurial-import/file_binary+k#2 - refreshing + //depot/test-mercurial-import/file_binary+kx#2 - refreshing + //depot/test-mercurial-import/file_ktext#2 - refreshing + //depot/test-mercurial-import/file_kxtext#2 - refreshing + //depot/test-mercurial-import/file_symlink+k#2 - refreshing + //depot/test-mercurial-import/file_text+k#2 - refreshing + //depot/test-mercurial-import/file_text+ko#2 - refreshing + //depot/test-mercurial-import/file_text+kx#2 - refreshing -echo % create a client spec -P4CLIENT=hg-p4-import; export P4CLIENT -DEPOTPATH=//depot/test-mercurial-import/... -p4 client -o | sed '/^View:/,$ d' >p4client -echo View: >>p4client -echo " $DEPOTPATH //$P4CLIENT/..." >>p4client -p4 client -i target_$T2 - ln -s target_$T file_$T2 - p4 add target_$T2 - p4 add -t $T file_$T2 - ;; - binary*) - python -c "file('file_$T2', 'wb').write('this is $T')" - p4 add -t $T file_$T2 - ;; - *) - echo "this is $T" >file_$T2 - p4 add -t $T file_$T2 - ;; - esac -done -p4 submit -d initial +revision 0 + $ hg -R dst update 0 + 30 files updated, 0 files merged, 0 files removed, 0 files unresolved + $ head dst/file_* | cat -v + ==> dst/file_binary <== + this is binary + ==> dst/file_binary+k <== + this is binary+k + ==> dst/file_binary+kx <== + this is binary+kx + ==> dst/file_binary+x <== + this is binary+x + ==> dst/file_ctext <== + this is ctext + + ==> dst/file_cxtext <== + this is cxtext + + ==> dst/file_ktext <== + this is ktext + + ==> dst/file_kxtext <== + this is kxtext + + ==> dst/file_ltext <== + this is ltext + + ==> dst/file_symlink <== + this is target symlink + + ==> dst/file_symlink+k <== + this is target symlink+k + + ==> dst/file_text <== + this is text + + ==> dst/file_text+c <== + this is text+C + + ==> dst/file_text+d <== + this is text+D + + ==> dst/file_text+f <== + this is text+F + + ==> dst/file_text+k <== + this is text+k + + ==> dst/file_text+ko <== + this is text+ko + + ==> dst/file_text+kx <== + this is text+kx + + ==> dst/file_text+l <== + this is text+l + + ==> dst/file_text+m <== + this is text+m + + ==> dst/file_text+s2 <== + this is text+S2 + + ==> dst/file_text+w <== + this is text+w + + ==> dst/file_text+x <== + this is text+x + + ==> dst/file_ubinary <== + this is ubinary + + ==> dst/file_uxbinary <== + this is uxbinary + + ==> dst/file_xbinary <== + this is xbinary + + ==> dst/file_xltext <== + this is xltext + + ==> dst/file_xtext <== + this is xtext -echo % test keyword expansion -p4 edit file_* target_* -for T in $TYPES ; do - T2=`echo $T | tr [:upper:] [:lower:]` - echo '$Id$' >>file_$T2 - echo '$Header$' >>file_$T2 - echo '$Date$' >>file_$T2 - echo '$DateTime$' >>file_$T2 - echo '$Change$' >>file_$T2 - echo '$File$' >>file_$T2 - echo '$Revision$' >>file_$T2 - echo '$Header$$Header$Header$' >>file_$T2 -done - -ln -s 'target_$Header$' crazy_symlink+k -p4 add -t symlink+k crazy_symlink+k - -p4 submit -d keywords +revision 1 + $ hg -R dst update 1 + 30 files updated, 0 files merged, 0 files removed, 0 files unresolved + $ head dst/file_* | cat -v + ==> dst/file_binary <== + this is binary$Id$ + $Header$ + $Date$ + $DateTime$ + $Change$ + $File$ + $Revision$ + $Header$$Header$Header$ + + ==> dst/file_binary+k <== + this is binary+k$Id$ + $Header$ + $Date$ + $DateTime$ + $Change$ + $File$ + $Revision$ + $Header$$Header$Header$ + + ==> dst/file_binary+kx <== + this is binary+kx$Id$ + $Header$ + $Date$ + $DateTime$ + $Change$ + $File$ + $Revision$ + $Header$$Header$Header$ + + ==> dst/file_binary+x <== + this is binary+x$Id$ + $Header$ + $Date$ + $DateTime$ + $Change$ + $File$ + $Revision$ + $Header$$Header$Header$ + + ==> dst/file_ctext <== + this is ctext + $Id$ + $Header$ + $Date$ + $DateTime$ + $Change$ + $File$ + $Revision$ + $Header$$Header$Header$ + + ==> dst/file_cxtext <== + this is cxtext + $Id$ + $Header$ + $Date$ + $DateTime$ + $Change$ + $File$ + $Revision$ + $Header$$Header$Header$ + + ==> dst/file_ktext <== + this is ktext + $Id$ + $Header$ + $Date$ + $DateTime$ + $Change$ + $File$ + $Revision$ + $Header$$Header$Header$ + + ==> dst/file_kxtext <== + this is kxtext + $Id$ + $Header$ + $Date$ + $DateTime$ + $Change$ + $File$ + $Revision$ + $Header$$Header$Header$ + + ==> dst/file_ltext <== + this is ltext + $Id$ + $Header$ + $Date$ + $DateTime$ + $Change$ + $File$ + $Revision$ + $Header$$Header$Header$ + + ==> dst/file_symlink <== + this is target symlink + $Id$ + $Header$ + $Date$ + $DateTime$ + $Change$ + $File$ + $Revision$ + $Header$$Header$Header$ + + ==> dst/file_symlink+k <== + this is target symlink+k + $Id$ + $Header$ + $Date$ + $DateTime$ + $Change$ + $File$ + $Revision$ + $Header$$Header$Header$ + + ==> dst/file_text <== + this is text + $Id$ + $Header$ + $Date$ + $DateTime$ + $Change$ + $File$ + $Revision$ + $Header$$Header$Header$ + + ==> dst/file_text+c <== + this is text+C + $Id$ + $Header$ + $Date$ + $DateTime$ + $Change$ + $File$ + $Revision$ + $Header$$Header$Header$ + + ==> dst/file_text+d <== + this is text+D + $Id$ + $Header$ + $Date$ + $DateTime$ + $Change$ + $File$ + $Revision$ + $Header$$Header$Header$ + + ==> dst/file_text+f <== + this is text+F + $Id$ + $Header$ + $Date$ + $DateTime$ + $Change$ + $File$ + $Revision$ + $Header$$Header$Header$ + + ==> dst/file_text+k <== + this is text+k + $Id$ + $Header$ + $Date$ + $DateTime$ + $Change$ + $File$ + $Revision$ + $Header$$Header$Header$ + + ==> dst/file_text+ko <== + this is text+ko + $Id$ + $Header$ + $Date$ + $DateTime$ + $Change$ + $File$ + $Revision$ + $Header$$Header$Header$ + + ==> dst/file_text+kx <== + this is text+kx + $Id$ + $Header$ + $Date$ + $DateTime$ + $Change$ + $File$ + $Revision$ + $Header$$Header$Header$ + + ==> dst/file_text+l <== + this is text+l + $Id$ + $Header$ + $Date$ + $DateTime$ + $Change$ + $File$ + $Revision$ + $Header$$Header$Header$ + + ==> dst/file_text+m <== + this is text+m + $Id$ + $Header$ + $Date$ + $DateTime$ + $Change$ + $File$ + $Revision$ + $Header$$Header$Header$ + + ==> dst/file_text+s <== + this is text+S + $Id$ + $Header$ + $Date$ + $DateTime$ + $Change$ + $File$ + $Revision$ + $Header$$Header$Header$ + + ==> dst/file_text+s2 <== + this is text+S2 + $Id$ + $Header$ + $Date$ + $DateTime$ + $Change$ + $File$ + $Revision$ + $Header$$Header$Header$ + + ==> dst/file_text+w <== + this is text+w + $Id$ + $Header$ + $Date$ + $DateTime$ + $Change$ + $File$ + $Revision$ + $Header$$Header$Header$ + + ==> dst/file_text+x <== + this is text+x + $Id$ + $Header$ + $Date$ + $DateTime$ + $Change$ + $File$ + $Revision$ + $Header$$Header$Header$ + + ==> dst/file_ubinary <== + this is ubinary + $Id$ + $Header$ + $Date$ + $DateTime$ + $Change$ + $File$ + $Revision$ + $Header$$Header$Header$ + + ==> dst/file_uxbinary <== + this is uxbinary + $Id$ + $Header$ + $Date$ + $DateTime$ + $Change$ + $File$ + $Revision$ + $Header$$Header$Header$ + + ==> dst/file_xbinary <== + this is xbinary + $Id$ + $Header$ + $Date$ + $DateTime$ + $Change$ + $File$ + $Revision$ + $Header$$Header$Header$ + + ==> dst/file_xltext <== + this is xltext + $Id$ + $Header$ + $Date$ + $DateTime$ + $Change$ + $File$ + $Revision$ + $Header$$Header$Header$ + + ==> dst/file_xtext <== + this is xtext + $Id$ + $Header$ + $Date$ + $DateTime$ + $Change$ + $File$ + $Revision$ + $Header$$Header$Header$ -echo % check keywords in p4 -grep -H Header file_* - -echo % convert -hg convert -s p4 $DEPOTPATH dst -hg -R dst log --template 'rev={rev} desc="{desc}" tags="{tags}" files="{files}"\n'g +crazy_symlink + $ readlink crazy_symlink+k + target_$Header: //depot/test-mercurial-import/crazy_symlink+k#1 $ + $ readlink dst/crazy_symlink+k + target_$Header$ -echo % revision 0 -hg -R dst update 0 -head dst/file_* | cat -v - -echo -echo % revision 1 -hg -R dst update 1 -head dst/file_* | cat -v -echo -echo % crazy_symlink -readlink crazy_symlink+k -readlink dst/crazy_symlink+k - +exit trap: + stopping the p4 server diff --git a/tests/test-convert-p4.out b/tests/test-convert-p4.out deleted file mode 100644 --- a/tests/test-convert-p4.out +++ /dev/null @@ -1,88 +0,0 @@ -% create p4 depot -% start the p4 server -% create a client spec -Client hg-p4-import saved. -% populate the depot -//depot/test-mercurial-import/a#1 - opened for add -//depot/test-mercurial-import/b/c#1 - opened for add -Submitting change 1. -Locking 2 files ... -add //depot/test-mercurial-import/a#1 -add //depot/test-mercurial-import/b/c#1 -Change 1 submitted. -% change some files -//depot/test-mercurial-import/a#1 - opened for edit -Submitting change 2. -Locking 1 files ... -edit //depot/test-mercurial-import/a#2 -Change 2 submitted. -//depot/test-mercurial-import/b/c#1 - opened for edit -Submitting change 3. -Locking 1 files ... -edit //depot/test-mercurial-import/b/c#2 -Change 3 submitted. -% convert -initializing destination dst repository -reading p4 views -collecting p4 changelists -1 initial -2 change a -3 change b/c -scanning source... -sorting... -converting... -2 initial -1 change a -0 change b/c -rev=2 desc="change b/c" tags="tip" files="b/c" -rev=1 desc="change a" tags="" files="a" -rev=0 desc="initial" tags="" files="a b/c" -% change some files -//depot/test-mercurial-import/a#2 - opened for edit -//depot/test-mercurial-import/b/c#2 - opened for edit -Submitting change 4. -Locking 2 files ... -edit //depot/test-mercurial-import/a#3 -edit //depot/test-mercurial-import/b/c#3 -Change 4 submitted. -% convert again -reading p4 views -collecting p4 changelists -1 initial -2 change a -3 change b/c -4 change a b/c -scanning source... -sorting... -converting... -0 change a b/c -rev=3 desc="change a b/c" tags="tip" files="a b/c" -rev=2 desc="change b/c" tags="" files="b/c" -rev=1 desc="change a" tags="" files="a" -rev=0 desc="initial" tags="" files="a b/c" -% interesting names -//depot/test-mercurial-import/d d#1 - opened for add -//depot/test-mercurial-import/ e/ f#1 - opened for add -Submitting change 5. -Locking 2 files ... -add //depot/test-mercurial-import/ e/ f#1 -add //depot/test-mercurial-import/d d#1 -Change 5 submitted. -% convert again -reading p4 views -collecting p4 changelists -1 initial -2 change a -3 change b/c -4 change a b/c -5 add d e f -scanning source... -sorting... -converting... -0 add d e f -rev=4 desc="add d e f" tags="tip" files=" e/ f d d" -rev=3 desc="change a b/c" tags="" files="a b/c" -rev=2 desc="change b/c" tags="" files="b/c" -rev=1 desc="change a" tags="" files="a" -rev=0 desc="initial" tags="" files="a b/c" -% stop the p4 server diff --git a/tests/test-convert-p4 b/tests/test-convert-p4.t old mode 100755 new mode 100644 rename from tests/test-convert-p4 rename to tests/test-convert-p4.t --- a/tests/test-convert-p4 +++ b/tests/test-convert-p4.t @@ -1,75 +1,152 @@ -#!/bin/sh + $ "$TESTDIR/hghave" p4 || exit 80 + + $ echo "[extensions]" >> $HGRCPATH + $ echo "convert = " >> $HGRCPATH -"$TESTDIR/hghave" p4 || exit 80 - -echo "[extensions]" >> $HGRCPATH -echo "convert = " >> $HGRCPATH +create p4 depot + $ P4ROOT=`pwd`/depot; export P4ROOT + $ P4AUDIT=$P4ROOT/audit; export P4AUDIT + $ P4JOURNAL=$P4ROOT/journal; export P4JOURNAL + $ P4LOG=$P4ROOT/log; export P4LOG + $ P4PORT=localhost:16661; export P4PORT + $ P4DEBUG=1; export P4DEBUG -echo % create p4 depot -P4ROOT=`pwd`/depot; export P4ROOT -P4AUDIT=$P4ROOT/audit; export P4AUDIT -P4JOURNAL=$P4ROOT/journal; export P4JOURNAL -P4LOG=$P4ROOT/log; export P4LOG -P4PORT=localhost:16661; export P4PORT -P4DEBUG=1; export P4DEBUG +start the p4 server + $ [ ! -d $P4ROOT ] && mkdir $P4ROOT + $ p4d -f -J off >$P4ROOT/stdout 2>$P4ROOT/stderr & + $ echo $! >> $DAEMON_PIDS + $ trap "echo stopping the p4 server ; p4 admin stop" EXIT + + $ # wait for the server to initialize + $ while ! p4 ; do + > sleep 1 + > done >/dev/null 2>/dev/null + +create a client spec + $ P4CLIENT=hg-p4-import; export P4CLIENT + $ DEPOTPATH=//depot/test-mercurial-import/... + $ p4 client -o | sed '/^View:/,$ d' >p4client + $ echo View: >>p4client + $ echo " $DEPOTPATH //$P4CLIENT/..." >>p4client + $ p4 client -i $P4ROOT/stdout 2>$P4ROOT/stderr & -trap "echo % stop the p4 server ; p4 admin stop" EXIT +populate the depot + $ echo a > a + $ mkdir b + $ echo c > b/c + $ p4 add a b/c + //depot/test-mercurial-import/a#1 - opened for add + //depot/test-mercurial-import/b/c#1 - opened for add + $ p4 submit -d initial + Submitting change 1. + Locking 2 files ... + add //depot/test-mercurial-import/a#1 + add //depot/test-mercurial-import/b/c#1 + Change 1 submitted. -# wait for the server to initialize -while ! p4 ; do - sleep 1 -done >/dev/null 2>/dev/null +change some files + $ p4 edit a + //depot/test-mercurial-import/a#1 - opened for edit + $ echo aa >> a + $ p4 submit -d "change a" + Submitting change 2. + Locking 1 files ... + edit //depot/test-mercurial-import/a#2 + Change 2 submitted. -echo % create a client spec -P4CLIENT=hg-p4-import; export P4CLIENT -DEPOTPATH=//depot/test-mercurial-import/... -p4 client -o | sed '/^View:/,$ d' >p4client -echo View: >>p4client -echo " $DEPOTPATH //$P4CLIENT/..." >>p4client -p4 client -i > b/c + $ p4 submit -d "change b/c" + Submitting change 3. + Locking 1 files ... + edit //depot/test-mercurial-import/b/c#2 + Change 3 submitted. -echo % populate the depot -echo a > a -mkdir b -echo c > b/c -p4 add a b/c -p4 submit -d initial +convert + $ hg convert -s p4 $DEPOTPATH dst + initializing destination dst repository + reading p4 views + collecting p4 changelists + 1 initial + 2 change a + 3 change b/c + scanning source... + sorting... + converting... + 2 initial + 1 change a + 0 change b/c + $ hg -R dst log --template 'rev={rev} desc="{desc}" tags="{tags}" files="{files}"\n' + rev=2 desc="change b/c" tags="tip" files="b/c" + rev=1 desc="change a" tags="" files="a" + rev=0 desc="initial" tags="" files="a b/c" -echo % change some files -p4 edit a -echo aa >> a -p4 submit -d "change a" - -p4 edit b/c -echo cc >> b/c -p4 submit -d "change b/c" - -echo % convert -hg convert -s p4 $DEPOTPATH dst -hg -R dst log --template 'rev={rev} desc="{desc}" tags="{tags}" files="{files}"\n' +change some files + $ p4 edit a b/c + //depot/test-mercurial-import/a#2 - opened for edit + //depot/test-mercurial-import/b/c#2 - opened for edit + $ echo aaa >> a + $ echo ccc >> b/c + $ p4 submit -d "change a b/c" + Submitting change 4. + Locking 2 files ... + edit //depot/test-mercurial-import/a#3 + edit //depot/test-mercurial-import/b/c#3 + Change 4 submitted. -echo % change some files -p4 edit a b/c -echo aaa >> a -echo ccc >> b/c -p4 submit -d "change a b/c" - -echo % convert again -hg convert -s p4 $DEPOTPATH dst -hg -R dst log --template 'rev={rev} desc="{desc}" tags="{tags}" files="{files}"\n' +convert again + $ hg convert -s p4 $DEPOTPATH dst + reading p4 views + collecting p4 changelists + 1 initial + 2 change a + 3 change b/c + 4 change a b/c + scanning source... + sorting... + converting... + 0 change a b/c + $ hg -R dst log --template 'rev={rev} desc="{desc}" tags="{tags}" files="{files}"\n' + rev=3 desc="change a b/c" tags="tip" files="a b/c" + rev=2 desc="change b/c" tags="" files="b/c" + rev=1 desc="change a" tags="" files="a" + rev=0 desc="initial" tags="" files="a b/c" -echo % interesting names -echo dddd > "d d" -mkdir " e" -echo fff >" e/ f" -p4 add "d d" " e/ f" -p4 submit -d "add d e f" +interesting names + $ echo dddd > "d d" + $ mkdir " e" + $ echo fff >" e/ f" + $ p4 add "d d" " e/ f" + //depot/test-mercurial-import/d d#1 - opened for add + //depot/test-mercurial-import/ e/ f#1 - opened for add + $ p4 submit -d "add d e f" + Submitting change 5. + Locking 2 files ... + add //depot/test-mercurial-import/ e/ f#1 + add //depot/test-mercurial-import/d d#1 + Change 5 submitted. -echo % convert again -hg convert -s p4 $DEPOTPATH dst -hg -R dst log --template 'rev={rev} desc="{desc}" tags="{tags}" files="{files}"\n' +convert again + $ hg convert -s p4 $DEPOTPATH dst + reading p4 views + collecting p4 changelists + 1 initial + 2 change a + 3 change b/c + 4 change a b/c + 5 add d e f + scanning source... + sorting... + converting... + 0 add d e f + $ hg -R dst log --template 'rev={rev} desc="{desc}" tags="{tags}" files="{files}"\n' + rev=4 desc="add d e f" tags="tip" files=" e/ f d d" + rev=3 desc="change a b/c" tags="" files="a b/c" + rev=2 desc="change b/c" tags="" files="b/c" + rev=1 desc="change a" tags="" files="a" + rev=0 desc="initial" tags="" files="a b/c" - +exit trap: + stopping the p4 server