#!/usr/local/bin/perl -w =head1 NAME revml.t - testing of vcp revml in and out =cut use strict ; use Carp ; use Test ; use IPC::Run qw( run ) ; use File::Spec ; my %seen ; my @perl = ( $^X, map { my $s = $_ ; $s = File::Spec->rel2abs( $_ ) ; "-I$s" ; } grep ! $seen{$_}++, @INC ) ; ## We always run vcp by doing a @perl, vcp, to make sure that vcp runs under ## the same version of perl that we are running under. my $vcp = 'vcp' ; $vcp = "bin/$vcp" if -x "bin/$vcp" ; $vcp = "../bin/$vcp" if -x "../bin/$vcp" ; $vcp = File::Spec->rel2abs( $vcp ) ; my @vcp = ( @perl, $vcp ) ; my $t = -d 't' ? 't/' : '' ; sub slurp { my ( $fn ) = @_ ; open F, "<$fn" or die "$!: $fn" ; local $/ ; return <F> ; } my @tests = ( ## ## Empty "import" ## sub { run [ @vcp, "revml:-", "revml:" ], \"<revml/>" ; ok $?, 0, "`vcp revml:- revml:` return value" ; }, ( map { my $type = $_ ; my $infile = $t . "test-$type-in-0.revml" ; my $outfile = $t . "test-$type-out-0.revml" ; ## ## Idempotency tests ## ## These depend on the "test-foo-in.revml" files built in the makefile. ## See MakeMaker.PL for how those are generated. ## sub { my $diff = '' ; eval { my $out ; ## $in and $out allow us to avoide execing diff most of the time. run( [ @vcp, "revml:$infile", "revml" ], \undef, \$out ) or die "`$vcp revml:$infile revml` returned $?" ; my $in = slurp( $infile ) ; if ( $in ne $out && run( [ 'diff', '-a', '-u', $infile, '-' ], \$out, '>', \$diff ) && $? != 256 ) { die "`diff -u $infile -` returned $?" ; } } ; $diff = $@ if $@ ; chomp $diff ; ok( $diff, '' ) ; if ( -e $outfile ) { unlink $outfile or warn "$!: $outfile" ; } }, } qw( revml cvs p4 ) ) ) ; plan tests => scalar( @tests ) ; unless ( -x $vcp ) { print STDERR "# '$vcp' not found\n" ; skip( 1, '' ) for @tests ; exit ; } $_->() for @tests ;
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#23 | 3698 | Barrie Slaymaker | - Passes all VSS, cvs, and revml tests | ||
#22 | 3437 | Barrie Slaymaker | Remove debugging from test suite. | ||
#21 | 3427 | Barrie Slaymaker |
- test suite cleanup - Win32 fix for test suite |
||
#20 | 3261 | John Fetkovich | test suite fixes | ||
#19 | 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. |
||
#18 | 3008 | John Fetkovich |
make state database files go under vcp_state in the program start directory (start_dir) instead of start_dir itself. Also escape periods (.) from the database directory as well as the characters already escaped. |
||
#17 | 2768 | John Fetkovich |
Allow revml to be output in non-indented form with --no-indent option on dest::revml |
||
#16 | 2764 | John Fetkovich |
add --compress switch to dest::revml add --uncompress switch to source::revml use gzip to compress/uncompress revml files |
||
#15 | 2640 | Barrie Slaymaker | VCP::Source::revml now supports revision name wildcard matching. | ||
#14 | 2369 | John Fetkovich | @vcp now built via VCP::TestUtils vcp_cmd | ||
#13 | 2319 | Barrie Slaymaker | make t/test-*.revml be consistent with cvs2p4 and p42cvs scenarios | ||
#12 | 2275 | Barrie Slaymaker | clean up a warning | ||
#11 | 2059 | Barrie Slaymaker | Support for branching in p4->p4 added | ||
#10 | 2051 | Barrie Slaymaker | Enable p4_branch_spec to be carried through revml->revml. | ||
#9 | 2049 | Barrie Slaymaker | Get branching working in Dest::p4, clean up some tests. | ||
#8 | 2013 | Barrie Slaymaker | Reenable vcp as a unixy command line filter processing revml | ||
#7 | 1358 | Barrie Slaymaker | Win32 changes | ||
#6 | 1055 | Barrie Slaymaker |
add sorting, revamp test suite, misc cleanup. Dest/revml is not portable off my system yet (need to release ...::Diff) |
||
#5 | 825 | Barrie Slaymaker |
test, handle case where no revs are transferred and VCP::Dest::*::handle_footer() blew up. |
||
#4 | 608 | Barrie Slaymaker |
Lots of changes to get vcp to install better, now up to 0.066. Many thanks to Matthew Attaway for testing & suggestions. |
||
#3 | 478 | Barrie Slaymaker |
0.05 Mon Dec 18 07:27:53 EST 2000 - Use `p4 labels //...@label` command as per Rober Cowham's suggestion, with the '-s' flag recommended by Christopher Siewald and Amaury.FORGEOTDARC@atsm.fr. Though it's actually something like vcp: running /usr/bin/p4 -u safari -c safari -p localhost:5666 -s files //.../NtLkly //...@compiler_a3 //.../NtLkly //...@compiler_may3 and so //on //for 50 parameters to get the speed up. I use the //.../NtLkly "file" as //a separator between the lists of files in various //revisions. Hope nobody has any files named that :-). What I should do is choose a random label that doesn't occur in the labels list, I guess. - VCP::Source::revml and VCP::Dest::revml are now binary, control code, and "hibit ASCII" (I know, that's an oxymoron) clean. The <comment>, <delta>, and <content> elements now escape anything other than tab, line feed, space, or printable chars (32 <= c <= ASCII 126) using a tag like '<char code="0x09">'. The test suite tests all this. Filenames should also be escaped this way, but I didn't get to that. - The decision whether to do deltas or encode the content in base64 is now based on how many characters would need to be escaped. - We now depend on the users' diff program to have a "-a" option to force it to diff even if the files look binary to it. I need to use Diff.pm and adapt it for use on binary data. - VCP::Dest::cvs now makes sure that no two consecutive revisions of the same file have the same mod_time. VCP::Source::p4 got so fast at pulling revisions from the repositories the test suite sets up that CVS was not noticing that files had changed. - VCP::Plugin now allows you to set a list of acceptable result codes, since we now use p4 in ways that make it return non-zero result codes. - VCP::Revs now croaks if you try to add two entries of the same VCP::Rev (ie matching filename and rev_id). - The <type> tag is now limited to "text" or "binary", and is meant to pass that level of info between foreign repositories. - The <p4_info> on each file now carries the one line p4 description of the file so that p4->p4 transferes can pick out the more detailed info. VCP::Source::p4, VCP::Dest::p4 do this. - VCP::{Source,Dest}::{p4,cvs} now set binaryness on added files properly, I think. For p4->p4, the native p4 type is preserved. For CVS sources, seeing the keyword substitution flag 'o' or 'b' implies binaryness, for p4, seeing a filetype like qr/u?x?binary/ or qr/x?tempobj/ or "resource" implies binaryness (to non-p4 destinations). NOTE: Seeing a 'o' or 'b' in a CVS source only ends up setting the 'b' option on the destination. That should be ok for most uses, but we can make it smarter for cvs->cvs transfers if need be. |
||
#2 | 468 | Barrie Slaymaker |
- VCP::Dest::p4 now does change number aggregation based on the comment field changing or whenever a new revision of a file with unsubmitted changes shows up on the input stream. Since revisions of files are normally sorted in time order, this should work in a number of cases. I'm sure we'll need to generalize it, perhaps with a time thresholding function. - t/90cvs.t now tests cvs->p4 replication. - VCP::Dest::p4 now doesn't try to `p4 submit` when no changes are pending. - VCP::Rev now prevents the same label from being applied twice to a revision. This was occuring because the "r_1"-style label that gets added to a target revision by VCP::Dest::p4 could duplicate a label "r_1" that happened to already be on a revision. - Added t/00rev.t, the beginnings of a test suite for VCP::Rev. - Tweaked bin/gentrevml to comment revisions with their change number instead of using a unique comment for every revision for non-p4 t/test-*-in-0.revml files. This was necessary to test cvs->p4 functionality. |
||
#1 | 467 | Barrie Slaymaker | Version 0.01, initial checkin in perforce public depot. |