| VCS-LibCVS documentation | Contained in the VCS-LibCVS distribution. |
VCS::LibCVS::Slice - A slice through a CVS Repository.
A set of revisions in the repository, with at most one revision per file. Common examples of slices are the revisions of all files in a directory at a specific time, or all file revisions with a specific tag.
A slice is used to manipulate sets of revisions for operations such as tagging and retrieving known configurations.
$file_rev = $slice->get_revision($file)
Returns the revision of the given file in this slice, or undef if there isn't one.
@file_revs = $slice->get_revisions()
Returns all the revisions in this slice, in a list.
$slice->add_revision($file_rev)
Adds the provided FileRevision to the slice. If the file already has a revision in this slice, it is overwritten.
$slice->tag($tag_name)
Tag the revisions in this slice with the given tag_name. If you want to create a branch at these revisions, use branch() instead.
VCS::LibCVS
| VCS-LibCVS documentation | Contained in the VCS-LibCVS distribution. |
# # Copyright (c) 2005 Alexander Taler (dissent@0--0.org) # # All rights reserved. This program is free software; you can redistribute it # and/or modify it under the same terms as Perl itself. # package VCS::LibCVS::Slice; use strict; use Carp;
############################################################################### # Class constants ############################################################################### use constant REVISION => '$Header: /cvsroot/libcvs-perl/libcvs-perl/VCS/LibCVS/Slice.pm,v 1.2 2005/09/10 02:20:31 dissent Exp $ '; ############################################################################### # Private variables ############################################################################### # $self->{Revisions} A hash ref containing the FileRevisions in this Slice # Keys are the names of the files # Values are FileRevision objects ############################################################################### # Class routines ############################################################################### sub new { my $class = shift; my $that = bless {}, $class; return $that; } ############################################################################### # Instance routines ###############################################################################
sub get_revision() { my $self = shift; my $file = shift; return $self->{Revisions}->{$file->get_name()}; }
sub get_revisions() { my $self = shift; my $file = shift; return values(%{$self->{Revisions}}); }
sub add_revision() { my $self = shift; my $file_rev = shift; $self->{Revisions}->{$file_rev->get_file()->get_name()} = $file_rev; }
sub tag() { my $self = shift; my $tag_name = shift; my @file_revs = values %{$self->{Revisions}}; my $command = VCS::LibCVS::Command->new({}, "tag", ["$tag_name"], \@file_revs); $command->issue($file_revs[0]->get_file()->get_repository()); # issue() will throw an exception if there is an error. } ############################################################################### # Private routines ###############################################################################
1;