#!/usr/local/bin/perl -w =head1 NAME p4.t - testing of vcp p4 i/o =cut use strict ; use Carp ; use File::Spec ; use Test ; use VCP::TestUtils ; my @vcp = ( vcp_cmd, "vcp:-" ); my $t = -d 't' ? 't/' : '' ; ## Repositories to read from my $p4root_0 = "${t}p4root_0"; my $p4root_1 = "${t}p4root_1"; ## where to put the destination repository my $cvsroot = tmpdir "cvsroot"; my $state_location = tmpdir "vcp_state"; ## where to write to in the destination repo my $cvs_module = "p4_t_module"; my $cvs_spec = "cvs:$cvsroot:$cvs_module/"; my $repo_id; ## -kb is used when extracting from CVS to get \n-only lineends ## because that's what bin/gentrevml generates and \rs would be ## encoded as <char.../> elements (so we can't just let perl ## or an XML parser hide linending issues). my @tests = ( ## ## p4->cvs->revml bootstrap ## ## read p4root_0 into cvs sub { my $vcp_spec = <<VCP_FILE; Source: p4:revml2p4\@$p4root_0://depot/foo/... --run-p4d --repo-id=p4:test_repository Destination: $cvs_spec --init-cvsroot --delete-cvsroot --db-dir=$state_location --repo-id=cvs:test_repository Map: ## ASSumes directories under //depot/foo/ are the main and branch ## dirs. */(...)<(...)> \$1<\$2> VCP_FILE eval { run \@vcp, \$vcp_spec }; ok $@ || '', ''; }, ## read cvs repository built in previous test, and compare it to the ## test-cvs-in-0.revml to see how it compares to a file that hasn't been ## through a revml->p4->cvs->revml pipeline. sub { return skip "previous test failed", 1 if $@; my $infile = $t . "test-cvs-in-0.revml" ; my $in = slurp $infile ; #my $out = get_vcp_output $cvs_spec, qw( -kb -r 1.1: ) ; my $out = get_vcp_output $cvs_spec, "-kb", { revml_out_spec => [ "--db-dir=$state_location", "--repo-id=revml:test_repository" ] } ; s_content qw( rep_desc time user_id ), \$in, \$out ; s_content qw( rev_root ), \$in, $cvs_module ; ## TODO can we get the real repo_id here? s_content qw( source_repo_id ), \$out, "cvs:test_repository"; rm_elts qw( cvs_info change_id source_change_id mod_time ), \$in ; rm_elts qw( label ), qr/vcp_.*/, \$out ; $in =~ s{(id="|_id>)/+ignored}{$1/$cvs_module}g; $in =~ s{<(.*branch_id)>main-branch-1</\1>}{<$1>tag_//depot/foo/main-branch-1/</$1>}g; $in =~ s{(create branch ')(.*?)(')}{${1}tag_//depot/foo/$2/$3}g; ok_or_diff $out, $in; }, ## --repo-id here should agree with the other one above that writes to ## the same destination. because we are faking by reading from two ## different repositories that are really for test purposes snapshots ## of the same repository at two different moments in time. ## ## because vcp would by default use the paths to these two ## repositories as the repo_ids, vcp would refuse to add an ## incremental export from the second repository on top of the ## revisions from the first repository. by specifying the same ## repo_id in both places, we make vcp think that the revisions came ## from the same repository. ## ## p4->cvs->revml incremental export ## ## read from p4root_1 repository into cvs. ## sub { eval { run \@vcp, \<<VCP_END; } or die $@; Source: p4:revml2p4\@$p4root_1://depot/foo/... --continue --run-p4d --repo-id=p4:test_repository Destination: $cvs_spec --db-dir=$state_location --repo-id=cvs:test_repository Map: ## ASSumes directories under //depot/foo/ are the main and branch ## dirs. */(...)<(...)> \$1<\$2> VCP_END ok 1; }, ## extract stuff inserted into cvs in the previous test and compare ## to the source revml to see that it got there ok. sub { my $infile = $t . "test-cvs-in-1.revml" ; my $in = slurp $infile ; my $out = get_vcp_output $cvs_spec, "-kb", "--continue", { revml_out_spec => [ "--db-dir=$state_location", "--repo-id=revml:test_repository" ] } ; s_content qw( rep_desc time user_id ), \$in, \$out ; s_content qw( rev_root ), \$in, $cvs_module ; s_content qw( source_repo_id ), \$out, "cvs:test_repository"; rm_elts qw( cvs_info change_id source_change_id mod_time ), \$in ; rm_elts qw( label ), qr/vcp_.*/, \$out ; # $out =~ s{<rev_id>1.}{<rev_id>}g ; # $out =~ s{<base_rev_id>1.}{<base_rev_id>}g ; # $out =~ s{((id="|_id>)?[^>]*#)1\.}{$1}g; # $in =~ s{(id="|_id>)/+ignored}{$1/$cvs_module}g; $in =~ s{<(.*branch_id)>main-branch-1</\1>}{<$1>tag_//depot/foo/main-branch-1/</$1>}g; ok_or_diff $out, $in; }, ); # end @tests. plan tests => scalar @tests; my $why_skip ; $why_skip .= p4_borken; $why_skip .= p4d_borken; $why_skip .= cvs_borken; $why_skip ? skip( $why_skip, '' ) : $_->() for @tests ;
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#15 | 5403 | Barrie Slaymaker | - Misc logging, maintainability & debugging improvements | ||
#14 | 3970 | Barrie Slaymaker |
- VCP::Source handles rev queing, uses disk to reduce RAM - Lots of other fixes |
||
#13 | 3428 | Barrie Slaymaker | - Test suite cleanup | ||
#12 | 2973 | Barrie Slaymaker | Fix handling of branched but unchanged files | ||
#11 | 2926 | John Fetkovich |
remove --state-location switch add --db-dir and --repo-id switches build state location from concatenation of those two. |
||
#10 | 2894 | Barrie Slaymaker | Get t/95p42cvs.t to pass | ||
#9 | 2856 | John Fetkovich | Add use of --repo-id, --continue, and --state-location switches. | ||
#8 | 2802 | John Fetkovich |
Added a source_repo_id to each revision, and repo_id to each Source and Dest. The repo_ids include repository type (cvs,p4,revml,vss,...) and the repo_server fields. Changed the $self->...->set() and $self->...->get() lines in VCP::Dest::* to pass in a conglomerated key value, by passing in the key as an ARRAY ref. Also various restructuring in VCP::DB.pm, VCP::DB_file.pm and VCP::DB_file::sdbm.pm related to this change. |
||
#7 | 2799 | Barrie Slaymaker | Remove old debug code | ||
#6 | 2756 | John Fetkovich | check skips if cvs not present | ||
#5 | 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 |
||
#4 | 2712 | Barrie Slaymaker |
RevMapDB works, branching seems to (pending further changes in statefulness so we can get incremental revml output without using labels in the source repo). |
||
#3 | 2706 | Barrie Slaymaker | Interim checkin | ||
#2 | 2699 | Barrie Slaymaker | remove unnecessary dependancies | ||
#1 | 2589 | John Fetkovich |
Split 90p4.t into 90revml2p4_0.t, 90revml2p4_1.t, 91p42revml.t, 95p42cvs.t. Added some utilities to the library files listed. |