#!/usr/local/bin/perl -w =head1 NAME 61changesets.t - test VCP::Filter::changesets =cut use strict ; use Carp ; use Test ; use VCP::Rev ; use VCP::Dest ; use VCP::Utils qw( empty ); use VCP::Filter::changesets; ## the sort specs for the test. my @specs = ( [ [], "(a#1)(a#2)(a#3)(a#4)(a#5)(a#6)" ], [ [ "name", "equal" ], "(a#1)(a#2)(a#3,a#4)(a#5)(a#6)" ], [ [ "comment", "equal" ], "(a#1)(a#2)(a#3)(a#4)(a#5)(a#6)" ], ) ; my @field_names= qw( name rev_id comment source_rev_id previous_id ); ## Notes: ## - columns are in order of @field_names ## - Each column is in reverse expected order here. ## - For name: '-' < '/' < 'a' in ASCII. ## - revs are in reverse order to see if they do get sorted my @rev_data = ( [qw( a 1.20 a 6 )], [qw( a 1.10 a 5 )], [qw( a 1.2 a 4 )], [qw( a 1.1.1 aa 3 ), "a#2" ], [qw( a 1.1 aa 2 )], [qw( a 1.0 a 1 )], ) ; my @revs = map { my @a ; for my $i ( 0..$#field_names ) { push @a, $field_names[$i], $_->[$i] ; } VCP::Rev->new( @a ) ; } @rev_data ; my $prev_id; for ( reverse @revs ) { if ( empty $_->previous_id ) { $_->previous_id( $prev_id ); $prev_id = $_->id; } } my $d = __PACKAGE__->new; my @out_revs; sub new { return bless {}, __PACKAGE__ } sub handle_header { @out_revs = () } sub handle_rev { push @out_revs, $_[1] } sub rev_count {} sub handle_footer {} sub _get_field { my $field_name = shift ; my $sub = VCP::Rev->can( $field_name ) ; die "Can't call VCP::Rev->$field_name()" unless defined $sub ; map defined $_ ? length $_ ? $_ : '""' : "<undef>", map $sub->( $_ ), @_ ; } my @tests = ( ( map { my ( $conditions, $exp ) = @$_; sub { $_->change_id( undef ) for @revs; my $f = VCP::Filter::changesets->new( "", $conditions ); $f->dest( $d ); $f->handle_header( {} ); $f->handle_rev( $_ ) for @revs; $f->handle_footer( {} ); my @changes; push @{$changes[$_->change_id]}, $_->id for reverse @out_revs; my $got = join "", map "(" . join( ",", @$_ ) . ")", grep defined, @changes; ok $got, $exp, "changesets: " . join " ", @$conditions; }, } @specs ), sub { ## Force the revs in to reverse order using change_id, but with one ## minor exception just to make sure the sort is really happening. my $i = 0; $_->change_id( ++$i ) for @revs; $revs[2]->change_id(99); $revs[0]->change_id($revs[-1]->change_id); my $f = VCP::Filter::changesets->new( "" ); $f->dest( $d ); $f->handle_header( {} ); $f->handle_rev( $_ ) for @revs; $f->handle_footer( {} ); my @changes; push @{$changes[$_->change_id]}, $_->id for reverse @out_revs; my $got = join "", map "(" . join( ",", @$_ ) . ")", grep defined, @changes; ok $got, "(a#5)(a#3)(a#2)(a#1,a#6)(a#4)"; }, ) ; plan tests => scalar( @tests ) ; $_->() for @tests ;
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#9 | 4516 | Barrie Slaymaker | - VCP::Filter::changesets supports VCP::Rev::release_ids | ||
#8 | 4507 | Barrie Slaymaker |
- RevML: - added <action>, removed <delete>, <placeholder> and <move> - added <from_id> for clones (and eventually merge actions) - Simplified DTD (can't branch DTD based on which action any more) - VCP::Source::cvs, VCP::Filter::changesets and VCP::Dest::p4 support from_id in <action>clone</action> records - VCP::Dest::perl_data added - VCP::Rev::action() "branch" added, no more undefined action strings - "placeholder" action removed |
||
#7 | 3970 | Barrie Slaymaker |
- VCP::Source handles rev queing, uses disk to reduce RAM - Lots of other fixes |
||
#6 | 3942 | Barrie Slaymaker | - ChangeSets now passes tests | ||
#5 | 3850 | Barrie Slaymaker | - No longer stores all revs in memory | ||
#4 | 3813 | Barrie Slaymaker | - VCP::Rev::previous() is no more | ||
#3 | 3762 | Barrie Slaymaker | - Changeset aggregation now works even when not debugging | ||
#2 | 3707 | Barrie Slaymaker |
- 61*t. now pass |
||
#1 | 3385 | Barrie Slaymaker | Add missing test script t/61changesets.t to p4d |