#!/usr/local/bin/perl -w =head1 NAME cvs.t - testing of vcp cvs i/o =cut use strict ; use Carp ; use Cwd ; use File::Spec ; 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 = ( "revml:", "--sort-by=name,rev_id" ) ; my $max_change_id ; sub check { goto &die if $ENV{FATALTEST} && ! $_[0]; } ## TODO: Remove this once t/90revml2cvs.t works "right" use File::Path qw( rmtree ); #eval { rmtree [ "t/cvsroot_0" ] }; #eval { rmtree [ "t/cvsroot_1" ] }; my ( $infile_0, $cvsroot_0, $infile_1, $cvsroot_1 ) = make_cvsroots( $module, $t ); my $cvs_spec_0 = "cvs:$cvsroot_0:$module/" ; my $cvs_spec_1 = "cvs:$cvsroot_1:$module/" ; my @options; my @tests = ( ## ## cvs->revml (using cvs command) idempotency ## sub { eval { my $infile = $infile_0; my $cvs_spec = $cvs_spec_0; my $out ; run [ @vcp, $cvs_spec, @options, @revml_out_spec ], \undef, \$out; my $in = slurp $infile ; s_content qw( rep_desc time user_id ), \$in, \$out ; s_content qw( rev_root ), \$in, $module ; rm_elts qw( mod_time change_id cvs_info ), \$in ; rm_elts qw( label ), qr/r_\w+|ch_\w+/, \$out ; $in =~ s{(id="|id>)/ignored}{$1/foo}g; assert_eq $infile, $in, $out ; } ; check ok $@ || '', '', 'diff'; }, ## ## cvs->revml (using direct read) ## sub { eval { my $infile = $infile_0; my $cvs_spec = $cvs_spec_0; my $out ; run [ @vcp, $cvs_spec, @options, @revml_out_spec ], \undef, \$out; my $in = slurp $infile ; s_content qw( rep_desc time user_id ), \$in, \$out ; s_content qw( rev_root ), \$in, $module ; rm_elts qw( mod_time change_id cvs_info ), \$in ; rm_elts qw( label ), qr/r_\w+|ch_\w+/, \$out ; $in =~ s{(id="|id>)/ignored}{$1/foo}g; assert_eq $infile, $in, $out ; } ; check ok $@ || '', '', 'diff'; }, ## ## cvs->revml, re-rooting a dir tree ## sub { eval { ## Hide global $cvs_spec for the nonce my $cvs_spec = "$cvs_spec_0/a/deeply/..." ; my $out ; run [ @vcp, $cvs_spec, @options, @revml_out_spec ], \undef, \$out; my $infile = $t . "test-cvs-in-0.revml" ; my $in = slurp $infile ; s_content qw( rep_desc time user_id ), \$in, \$out ; rm_elts qw( mod_time change_id cvs_info ), \$in, \$out ; rm_elts qw( label ), qr/r_\w+|ch_\w+/, \$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{(id="|id>)/ignored}{$1/foo}g; ## No branches in the output file $in =~ s{^\s*<branches.*?</branches>\r?\n}{}ms; assert_eq $infile, $in, $out ; } ; check ok $@ || '', '', 'diff' ; }, ## ## incremental cvs->revml ## sub { eval { my $infile = $infile_1; my $cvs_spec = $cvs_spec_1; my $out ; run [ @vcp, $cvs_spec, @options, qw( -r ch_4: ), @revml_out_spec ], \undef, \$out; my $in = slurp $infile ; s_content qw( rep_desc time user_id ), \$in, \$out ; s_content qw( rev_root ), \$in, $module ; rm_elts qw( mod_time change_id cvs_info ), \$in ; rm_elts qw( label ), qr/r_\w+|ch_\w+/, \$out ; $in =~ s{(id="|id>)/ignored}{$1/foo}g; # ch_4 only exists on the main branch (it's ch_4_branch_1 on the # side branches). $in =~ s{^\s*?<rev id="/foo/branched#1\.1\.2\..*?<name>branched.*?<rev_id>1\.1\.2\.\d+.*?</rev>\r?\n}{}gsm; assert_eq $infile, $in, $out ; } ; check ok $@ || '', '', 'diff' ; }, ## ## cvs->revml Idempotency test, bootstrapping the second set of changes ## sub { eval { my $infile = $t . "test-cvs-in-1-bootstrap.revml" ; my $cvs_spec = $cvs_spec_1; my $out ; run [ @vcp, $cvs_spec, @options, qw( -r ch_4: --bootstrap=... ), @revml_out_spec ], \undef, \$out; my $in = slurp $infile ; s_content qw( rep_desc time user_id ), \$in, \$out ; s_content qw( rev_root ), \$in, $module ; rm_elts qw( mod_time change_id cvs_info ), \$in ; rm_elts qw( label ), qr/r_\w+|ch_\w+/, \$out ; $in =~ s{(id="|id>)/ignored}{$1/foo}g; # ch_4 only exists on the main branch (it's ch_4_branch_1 on the # side branches). $in =~ s{^\s*?<rev id="/foo/branched#1\.1\.2\..*?<name>branched.*?<rev_id>1\.1\.2\.\d+.*?</rev>\r?\n}{}gsm; assert_eq $infile, $in, $out ; } ; check ok $@ || '', '', 'diff' ; }, ) ; plan tests => 2 * @tests; use vars qw( $why_skip ); # use vars because we local()ize. $why_skip .= cvs_borken ; my $test_num = 0; for ( @tests ) { @options = qw( --use-cvs ); { ++$test_num; local $why_skip ||= "test not selected" if $ENV{TESTNUM} && $ENV{TESTNUM} != $test_num; $why_skip ? skip( $why_skip, 0 ) : $_->(); } @options = (); { ++$test_num; local $why_skip ||= "test not selected" if $ENV{TESTNUM} && $ENV{TESTNUM} != $test_num; $why_skip ? skip( $why_skip, 0 ) : $_->(); } }
# | 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 |