#!/usr/local/bin/perl -w =head1 NAME 00rev.t - testing of VCP::Rev services =cut use strict ; use Carp ; use Test ; use VCP::Rev ; use VCP::Utils qw( empty ); ## TODO: Add lots of tests to 00rev.t my $r ; my @tests = ( ## Test some utility functions first sub { ok join( ",", VCP::Rev->split_id( "1" ) ), "1" }, sub { ok join( ",", VCP::Rev->split_id( "1a" ) ), "1,a" }, sub { ok join( ",", VCP::Rev->split_id( "1.2" ) ), "1,,2" }, sub { ok join( ",", VCP::Rev->split_id( "1a.2" ) ), "1,a,2" }, sub { ok join( ",", VCP::Rev->split_id( "1a.2b" ) ), "1,a,2,b" }, sub { ok( VCP::Rev->cmp_id( [qw( 1 a 2 )], [qw( 1 b 1 )] ) < 0 ) }, sub { ok( VCP::Rev->cmp_id( "1a2", "1b1" ) < 0 ) }, sub { ok( VCP::Rev->cmp_id( [qw( 1 a 2 )], [qw( 1 a 1 )] ) > 0 ) }, sub { ok( VCP::Rev->cmp_id( [qw( 1 b 2 )], [qw( 1 a 1 )] ) > 0 ) }, sub { ok( VCP::Rev->cmp_id( [qw( 10 )], [qw( 1 )] ) > 0 ) }, ## now test methods sub { $r = VCP::Rev->new() ; ok( ref $r, "VCP::Rev" ) }, ( map { my $field = lc $_; ( sub { ok ! defined $r->$field, 1, "! defined $field"; }, sub { $r->$field( 10 ); ok $r->$field, 10, "$field"; }, sub { $r->$field( undef ); ok ! defined $r->$field, 1, "! defined $field #2"; }, ); } ( ## 'ID', ## this has a default value, tested below 'NAME', 'SOURCE_NAME', 'SOURCE_FILEBRANCH_ID', 'SOURCE_REPO_ID', 'TYPE', 'BRANCH_ID', 'SOURCE_BRANCH_ID', 'REV_ID', 'SOURCE_REV_ID', 'CHANGE_ID', 'SOURCE_CHANGE_ID', 'P4_INFO', 'CVS_INFO', 'TIME', 'MOD_TIME', 'USER_ID', #'LABELS', ## different beast, tested below 'COMMENT', 'ACTION', 'PREVIOUS_ID', 'WORK_PATH', 'DEST_WORK_PATH', 'VCP_SOURCE_SCM_FN', # 'PREVIOUS', ## Different 'AVG_COMMENT_TIME', 'IS_FOUNDING_REV', ) ), sub { ok ! $r->labels }, sub { $r->add_label( "l1" ) ; ok( join( ",", $r->labels ), "l1" ) ; }, sub { $r->add_label( "l2", "l3" ) ; ok( join( ",", $r->labels ), "l1,l2,l3" ) ; }, sub { $r->add_label( "l2", "l3" ) ; ok( join( ",", $r->labels ), "l1,l2,l3" ) ; }, sub { $r->set_labels( [ "l4", "l5" ] ) ; ok( join( ",", $r->labels ), "l4,l5" ) ; }, sub { $r->name( "foo" ); $r->source_rev_id( "1" ); ok $r->id, "foo#1"; }, sub { ok ! defined $r->previous; }, sub { $r->previous( VCP::Rev->new ); ok ref $r->previous; }, sub { $r->previous( VCP::Rev->new ); ok UNIVERSAL::isa( $r->previous, "VCP::Rev" ); }, sub { $r->previous( undef ); ok ! defined $r->previous; }, ## now test setting a few things in the ctor sub { $r = VCP::Rev->new( name => "Name", labels => [ "l1", "l2" ], type => "Type", ); ok ref $r, "VCP::Rev"; }, sub { ok $r->name, "Name" }, sub { ok join( ",", $r->labels ), "l1,l2" }, sub { ok $r->type, "Type" }, sub { ok ! defined $r->user_id, 1, "! defined user_id" }, sub { ok ! defined $r->comment, 1, "! defined comment" }, sub { ok ! defined $r->vcp_source_scm_fn, 1, "! defined vcp_source_scm_fn" }, ) ; plan tests => scalar( @tests ) ; $_->() for @tests ;
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#19 | 4514 | Barrie Slaymaker | - VCP::Rev::earlier_ids and <release_id> added | ||
#18 | 3970 | Barrie Slaymaker |
- VCP::Source handles rev queing, uses disk to reduce RAM - Lots of other fixes |
||
#17 | 3850 | Barrie Slaymaker | - No longer stores all revs in memory | ||
#16 | 3813 | Barrie Slaymaker | - VCP::Rev::previous() is no more | ||
#15 | 3776 | Barrie Slaymaker | - test suite for serialization/deserialization | ||
#14 | 3769 | Barrie Slaymaker | - avg_comment_time sort key removed | ||
#13 | 3761 | Barrie Slaymaker | - sort_time() is no more | ||
#12 | 3117 | Barrie Slaymaker |
Cut over to faster VCP::Rev::new, remove symbolic method calls. |
||
#11 | 3116 | Barrie Slaymaker | Cleanup, test tweaks | ||
#10 | 3112 | Barrie Slaymaker |
Reduce memory footprint when handling large numbers of revisions. |
||
#9 | 3063 | Barrie Slaymaker | Fix test. | ||
#8 | 3060 | Barrie Slaymaker | Note arglist too long error in p4->p4 conversion | ||
#7 | 3027 | Barrie Slaymaker | VCP::Filter::labelmap | ||
#6 | 2372 | John Fetkovich | Remove time, sort_time methods, allow them to be autogenerated. | ||
#5 | 2240 | Barrie Slaymaker | Start on cvs -r option support. | ||
#4 | 2232 | Barrie Slaymaker | Major memory and sort speed enhancements. | ||
#3 | 2017 | Barrie Slaymaker |
Interim checkin of id=/base_version_id for revml: and branch_diagram: |
||
#2 | 2015 | Barrie Slaymaker | submit changes | ||
#1 | 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. |