NAME

VCS::Lite::Repository - Minimal version Control system - Repository object

SYNOPSIS

  use VCS::Lite::Repository;
  my $rep = VCS::Lite::Repository->new($ENV{VCSROOT});
  my $dev = $rep->clone('/home/me/dev');
  $dev->add_element('testfile.c');
  $dev->add_repository('sub');
  $dev->traverse(\&do_something);
  $dev->check_in( description => 'Apply change');
  $dev->update;
  $dev->commit;
  

DESCRIPTION

VCS::Lite::Repository is a freestanding version control system that is platform independent. The module is pure perl, and only makes use of other code that is available for all platforms.

new

  my $rep = VCS::Lite::Repository->new('/local/fileSystem/path');

A new repository object is created and associated with a directory on the local file system. If the directory does not exist, it is created. If the directory does not contain a repository, an empty repository is created.

The control files associated with the repository live under a directory .VCSLite inside the associated directory, and these are in YAML format. The repository directory can contain VCS::Lite elements (which are version controlled), other repository diretories, and also files and directories which are not version controlled.

add_element

Returns a VCS::Lite::Element object corresponding to the file inside the repository. The element is added to the list of elements inside the repository. If the file does not exist, it is created as zero length.

If the repository already contains an element of this name, the method returns a VCS::Lite::Element object for the existing element.

When creating a new element, the existing file contents (or the empty file) are used as the generation 0 start point for the file.

add_repository

Similar to add_element is add_repository, which returns a VCS::Lite::Repository object corresponding to a subdirectory.

traverse

  $rep->traverse(\&mysub,...);
  $rep->traverse('foo_method',...);

Apply a callback to each element and repository inside the repository. Either call a sub directly, or supply a method name. This is used to implement the check_in, commit and update methods for a repository.

check_in, commit, update

These methods use traverse to iterate all elements in the repository, and all subrepositories. See the documentation in VCS::Lite::Element for how these are applied to each element.

ENVIRONMENT VARIABLES

USER

The environment variable USER is used to determine the author of changes. In a Unix environment, this should be adequate for out-of-the-box use. An additional environment variable, VCSLITE_USER is also checked, and this takes precedence.

Windows users will need to set one of these environment variables, or the application will croak with "Author not specified".

For more dynamic applications (such as CGI scripts that run as WWW, but receive the username from a cookie), you can set the package variable: $VCS::Lite::Repository::username. Note: there could be some problems with Modperl here - patches welcome.

TO DO

Support for binary files. (Subclass VCS::Lite::Element)

Integration with VCS suite.

COPYRIGHT

   Copyright (C) 2003-2004 Ivor Williams (IVORW (at) CPAN {dot} org)
   All rights reserved.

This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

SEE ALSO

VCS::Lite::Element, VCS::Lite, YAML.