App-SVN-Bisect
view release on metacpan or search on metacpan
lib/App/SVN/Bisect.pm view on Meta::CPAN
}
=head2 stdout
$self->stdout("Hello, world!\n");
Output a message to stdout. This is basically just the "print" function, but
we use a method so the testsuite can override it through subclassing.
=cut
sub stdout {
my $self = shift;
print(@_);
}
=head2 verbose
$self->verbose("Hello, world!\n");
Output a message to stdout, if the user specified the --verbose option. This
is basically just a conditional wrapper around the "print" function.
=cut
sub verbose {
my $self = shift;
return unless $$self{args}{Verbose};
print(@_);
}
=head2 exit
$self->exit(0);
Exits. This allows the test suite to override exiting; it does not
provide any other features above and beyond what the normal exit
system call provides.
=cut
sub exit {
my ($self, $rv) = @_;
exit($rv);
}
=head1 SUBVERSION ACCESSOR METHODS
=head2 update_to
$self->update_to(25000);
Calls 'svn update' to move to the specified revision.
=cut
sub update_to {
my ($self, $rev) = @_;
my $cmd = "svn update -r$rev";
$self->cmd($cmd);
}
=head2 fetch_log_revs
my $hashref = $self->fetch_log_revs();
Calls "svn log" and parses the output. Returns a hash reference whose keys
are valid revision numbers; so you can use exists() to find out whether a
number is in the list. This hash reference is used by list_revs(), above.
=cut
sub fetch_log_revs {
my $self = shift;
my $min = $$self{config}{min};
my $max = $$self{config}{max};
$self->stdout("Fetching history from r$min to r$max; it may take a while.\n")
if(($max - $min) > 100);
my %rv;
my $log = $self->cmd("svn log -q -r$min:$max");
$log =~ s/\r//;
foreach my $line (split(/\n+/, $log)) {
if($line =~ /^r(\d+) /) {
$rv{$1} = 1;
}
}
return \%rv;
}
=head2 find_max
my $rev = $self->find_max();
Plays some tricks with "svn log" to figure out the latest revision contained
within the repository.
=cut
sub find_max {
my $self = shift;
my $log = $self->cmd("svn log -q -rHEAD:PREV");
$log =~ s/\r//;
foreach my $line (split(/\n+/, $log)) {
if($line =~ /^r(\d+) /) {
return $1;
}
}
die("Cannot find highest revision in repository.");
}
=head2 find_cur
my $rev = $self->find_cur();
( run in 1.930 second using v1.01-cache-2.11-cpan-9581c071862 )