The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Test::AutoBuild::Repository - Source control repository access

SYNOPSIS

  use Test::AutoBuild::Repository

  my $rep = Test::AutoBuild::Repository->new(
               name => $name,
               options => \%options,
               env => \%env,
               label => $label);

  # Checkout / update the location '$src_path'
  # into local directory '$dst_path'
  my ($changed, $changes) = $rep->export($runtime, $src_path, $dst_path);

  # If the repository impl supports it, get the more
  # recent repository global changelist number
  my $changelist = $rep->changelist($runtime);

DESCRIPTION

This module provides the API for interacting with the source control repositories. A repository implementation has to be able to do two main things

 * Get a checkout of a new module
 * Update an existing checkout, determining if any
   changes where made

Optionally, it can also extract & return the details of all changelists committed since the previous checkout operation.

CONFIGURATION

The valid configuration options for the repositories block are

METHODS

my $rep = Test::AutoBuild::Repository->new(name => $name, label => $label, options => \%options, env => \%env);

This method creates a new repository. The name argument is an alphanumeric token representing the name of the repository. The label argument is a human friendly name of the repository. The optional options argument is a hashref of implementation specific options. The optional env argument is a hashref of environment variables to set when running the commands to access the repository.

my $value = $rep->changelist($runtime);

Returns the changelist to which the repository is synchronized. This is defined to be the most recent changelist, not newer than the timestamp to which the build runtime is set. This method should be implemented by any repository types which support changelists. For those that don't the default implementation will throw an error.

my $name = $rep->name([$name]);

When run without any arguments, returns the alphanumeric token representing the name of the repository. If a single argument is supplied, this is use to update the name.

my $label = $rep->label([$label]);

When run without any arguments, returns the human friendly string representing the label of the repository. If a single argument is supplied, this is use to update the label.

my $value = $rep->option($name[, $value]);

When run with a single argument, retuns the option value corresponding to the name specified in the first argument. If a second argument is supplied, then the option value is updated.

my $value = $rep->env($name[, $value]);

When run with a single argument, retuns the environment variable corresponding to the name specified in the first argument. If a second argument is supplied, then the environment variable is updated.

my ($changed, $changes) = $rep->export($runtime, $src, $dst);

Exports the location $src into the directory $dst. Returns zero if there were no changes to export; non-zero if the module was new or changed. The second return parameter is a hash reference whose keys are change numbers, and values are the corresponding Test::AutoBuild::Change objects. This second parameter is optional, since not all repositories maintain changelists. This is a virtual method which must be implemented by all subclasses.

my ($output, $errors) = $rep->_run($cmd);

Runs the command specified in the first argument, having first setup the environment variables specified when the repository was created. It returns any text written to standard out by the command

AUTHORS

Daniel Berrange <dan@berrange.com>

COPYRIGHT

Copyright (C) 2002 Daniel Berrange <dan@berrange.com>

SEE ALSO

perl(1), Test::AutoBuild, Test::AutoBuild::Module, Test::AutoBuild::Repository::CVS, Test::AutoBuild::Repository::GNUArch, Test::AutoBuild::Repository::Perforce, Test::AutoBuild::Repository::Mercurial, Test::AutoBuild::Repository::Subversion, Test::AutoBuild::Repository::Disk, Test::AutoBuild::Repository::SVK