#!/usr/local/bin/perl -w =head1 NAME cvs.t - testing of vcp cvs i/o =cut use strict ; use Carp ; use Test ; use VCP::TestUtils ; my @vcp = vcp_cmd ; my $t = -d 't' ? 't/' : '' ; my $module = 'foo' ; ## Must match the rev_root in the testrevml files my @revml_out_spec = ( "sort:", "--", "revml:", ) ; my $max_change_id ; sub check { goto &die if $ENV{FATALTEST} && ! $_[0]; } my $infile_0 = $t . "test-cvs-in-0.revml"; my $cvsroot_0 = $t . "cvsroot_0"; my $infile_1 = $t . "test-cvs-in-1.revml"; my $cvsroot_1 = $t . "cvsroot_1"; my $cvsroot_2 = $t . "cvsroot_2"; my $cvs_spec_0 = "cvs:$cvsroot_0:$module/" ; my $cvs_spec_1 = "cvs:$cvsroot_1:$module/" ; my $cvs_spec_2 = "cvs:$cvsroot_2:$module/newdir/" ; my @options; my @tests = ( ## ## cvs->revml (using cvs command) idempotency ## sub { my $infile = $infile_0; my $cvs_spec = $cvs_spec_0; my $state = "${t}91cvs2revml_state_A"; rm_dir_tree $state; my @revml_out_spec = ( @revml_out_spec, "--db-dir=$state", "--repo-id=cvs:test_repository", ); run [ @vcp, $cvs_spec, @options, @revml_out_spec ], \undef, \my $out; my $in = slurp $infile ; s_content qw( rep_desc time user_id ), \$in, \$out ; s_content qw( rev_root ), \$in, $module ; s_content qw( source_repo_id ), \$in, "cvs"; rm_elts qw( mod_time cvs_info ), \$in ; $in =~ s{(id="|id>)/ignored}{$1/foo}g; $in =~ s{(id="|id>)ignored}{$1/foo}g; ok_or_diff $out, $in; }, ## ## cvs->revml, re-rooting a dir tree ## sub { ## Hide global $cvs_spec for the nonce my $cvs_spec = "$cvs_spec_0/a/deeply/..." ; my $state = "${t}91cvs2revml_state_B"; rm_dir_tree $state; my @revml_out_spec = ( @revml_out_spec, "--db-dir=$state", "--repo-id=cvs:test_repository", ); run [ @vcp, $cvs_spec, @options, @revml_out_spec ], \undef, \my $out; my $infile = $t . "test-cvs-in-0.revml" ; my $in = slurp $infile ; s_content qw( rep_desc time user_id ), \$in, \$out ; s_content qw( source_repo_id ), \$in, "cvs"; rm_elts qw( mod_time cvs_info ), \$in, \$out ; ## Strip out all files from $in that shouldn't be there rm_elts qw( rev ), qr{(?:(?!a/deeply).)*?}s, \$in ; ## Adjust the $in paths to look like the result paths. $in is ## now the "expected" output. s_content qw( rev_root ), \$in, "foo/a/deeply" ; $in =~ s{(<name>)a/deeply/}{$1}g ; $in =~ s{(<source_name>)a/deeply/}{$1}g ; $in =~ s{(id="|id>)/ignored}{$1/foo}g; $in =~ s{(id="|id>)ignored}{$1/foo}g; ok_or_diff $out, $in; }, ## ## incremental cvs->revml ## sub { my $infile = $infile_1; my $cvs_spec = $cvs_spec_1; my $state = "${t}91cvs2revml_state_C"; rm_dir_tree $state; copy_dir_tree "${t}91cvs2revml_state_A" => $state; my @options = ( @options, "--continue" ); my @revml_out_spec = ( @revml_out_spec, "--db-dir=$state", "--repo-id=cvs:test_repository", ); run [ @vcp, $cvs_spec, @options, @revml_out_spec ], \undef, \my $out; my $in = slurp $infile ; s_content qw( rep_desc time user_id ), \$in, \$out ; s_content qw( rev_root ), \$in, $module ; s_content qw( source_repo_id ), \$in, "cvs"; rm_elts qw( mod_time cvs_info ), \$in ; $in =~ s{(id="|id>)/ignored}{$1/foo}g; $in =~ s{(id="|id>)ignored}{$1/foo}g; ok_or_diff $out, $in; }, ## ## cvs->revml Idempotency test, bootstrapping the second set of changes ## sub { my $infile = $t . "test-cvs-in-1-bootstrap.revml" ; my $cvs_spec = $cvs_spec_1; my $state = "${t}91cvs2revml_state_D"; rm_dir_tree $state; copy_dir_tree "${t}91cvs2revml_state_A" => $state; my @options = ( @options, "--continue", "--bootstrap=..." ); my @revml_out_spec = ( @revml_out_spec, "--db-dir=$state", "--repo-id=cvs:test_repository", ); run [ @vcp, $cvs_spec, @options, @revml_out_spec ], \undef, \my $out; my $in = slurp $infile ; s_content qw( rep_desc time user_id ), \$in, \$out ; s_content qw( rev_root ), \$in, $module ; s_content qw( source_repo_id ), \$in, "cvs"; rm_elts qw( mod_time cvs_info ), \$in ; $in =~ s{(id="|id>)/ignored}{$1/foo}g; $in =~ s{(id="|id>)ignored}{$1/foo}g; ok_or_diff $out, $in; }, ## Check contents of t/cvsroot_2 ## extract cvs to revml ## build expected from revml ## ## cvs->revml, re-rooting a dir tree ## sub { ## Hide global $cvs_spec for the nonce my $cvs_spec_2 = "cvs:$cvsroot_2:$module/newdir/" ; run [ @vcp, $cvs_spec_2, @options, @revml_out_spec ], \undef, \my $out; my $infile = $t . "test-cvs-in-0.revml" ; my $in = slurp $infile ; s_content qw( rep_desc time user_id ), \$in, \$out ; s_content qw( source_repo_id ), \$in, "cvs"; rm_elts qw( mod_time cvs_info ), \$in, \$out ; ## Adjust the $in paths to look like the result paths. $in is ## now the "expected" output. s_content qw( rev_root ), \$in, "foo/newdir" ; $in =~ s{(id="|id>)/ignored}{$1/foo/newdir}g; $in =~ s{(id="|id>)ignored}{$1/foo/newdir}g; ok_or_diff $out, $in; }, ) ; plan tests => 2 * @tests; use vars qw( $why_skip ); # use vars because we local()ize. $why_skip .= cvs_borken ; my $test_num = 0; for my $t ( @tests ) { @options = qw( --repo-id=cvs --use-cvs ); { ## gentrevml does not beleive in \r yet, so force CVS in to ## binary extraction mode so that its output agrees with ## gentrevml's. push @options, "-kb" if $^O =~ /Win32/; ++$test_num; local $why_skip ||= "test not selected" if $ENV{TESTNUM} && $ENV{TESTNUM} != $test_num; $why_skip ? skip( $why_skip, 0 ) : $t->(); } @options = qw( --repo-id=cvs ); { ## gentrevml does not beleive in \r yet, so force CVS in to ## binary extraction mode so that its output agrees with ## gentrevml's. push @options, "-kb" if $^O =~ /Win32/; ++$test_num; local $why_skip ||= "test not selected" if $ENV{TESTNUM} && $ENV{TESTNUM} != $test_num; $why_skip ? skip( $why_skip, 0 ) : $t->(); } }
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#17 | 5404 | Barrie Slaymaker |
- SVN support added - Makefile gives clearer notices about missing optional prereqs. - VCP::Filter::labelmap and VCP::Filter::map: <<skip>> replaces deprecated <<delete>> to be clearer that no revisions are deleted from either repository but some just are skipped and not inserted. - VCP::Filter::map: support added for SVN-like branch labels - VCP::Source: support added for ISO8601 timestamps emitted by SVN. |
||
#16 | 4417 | Barrie Slaymaker |
- Adapt to "estimated values" messages - Adapt to more accurate test suite |
||
#15 | 3800 | Barrie Slaymaker | - <branches> removed from all code | ||
#14 | 3428 | Barrie Slaymaker | - Test suite cleanup | ||
#13 | 3115 | Barrie Slaymaker |
Move sorting function to the new VCP::Filter::sort; it's for testing and reporting only and the code was bloating VCP::Dest and limiting VCP::Rev and VCP::Dest optimizations. Breaks test suite in minor way. |
||
#12 | 2926 | John Fetkovich |
remove --state-location switch add --db-dir and --repo-id switches build state location from concatenation of those two. |
||
#11 | 2855 | John Fetkovich | fixed hard coded "t/" to be "${t}" in state file locations. | ||
#10 | 2839 | John Fetkovich |
Changed names of 91cvs2revml_state_[1234] to 91cvs2revml_state_[ABCD] to be consistent with 91p42revml.t |
||
#9 | 2809 | Barrie Slaymaker |
Implement --repo-id in Plugin.pm, refactor source & dest options parsing starting in VCP::Source::cvs (need to roll out to other sources and dests), get t/91cvs2revml.t passing again (first time in months! branching and --continue support works in cvs->foo!). |
||
#8 | 2800 | Barrie Slaymaker | Get --continue working in cvs->foo transfers. | ||
#7 | 2758 | John Fetkovich | Check contents of t/cvsroot_2 in t/91revml2cvs.t | ||
#6 | 2743 | John Fetkovich |
Add fields to vcp: source_name, source_filebranch_id, source_branch_id, source_rev_id, source_change_id 1. Alter revml.dtd to include the fields 2. Alter bin/gentrevml to emit legal RevML 3. Extend VCP::Rev to have the fields 4. Extend VCP::{Source,Dest}::revml to read/write the fields (VCP::Dest::revml should die() if VCP tries to emit illegal RevML) 5. Extend VCP::{Source,Dest}::{cvs,p4} to read the fields 7. Get all tests through t/91*.t to pass except those that rely on ch_4 labels |
||
#5 | 2714 | Barrie Slaymaker |
Simplify t/90*cvs.t tests, remove make_cvsroots for speed and simplicity. |
||
#4 | 2327 | Barrie Slaymaker | Undo debugging shortcut | ||
#3 | 2325 | Barrie Slaymaker | Get most tests working | ||
#2 | 2297 | Barrie Slaymaker | Adapt cvs, revml to a more realistic branching structure | ||
#1 | 2294 | Barrie Slaymaker | reorder things |