NAME
VCP::Source - A base class for repository sources
SYNOPSIS
DESCRIPTION
EXTERNAL METHODS
- new
-
Creates an instance, see subclasses for options. The options passed are usually native command-line options for the underlying repository's client. These are usually parsed and, perhaps, checked for validity by calling the underlying command line.
SUBCLASSING
This class uses the fields pragma, so you'll need to use base and possibly fields in any subclasses. See VCP::Plugin for methods often needed in subclasses.
Subclass utility API
- dest
-
Sets/Gets a reference to the VCP::Dest object. The source uses this to call handle_header(), handle_rev(), and handle_end() methods.
SUBCLASS OVERLOADS
These methods should be overridded in any subclasses.
- dest_expected
-
Returns TRUE if a destination is expected given the parameters passed to new().
Some sources can have configuration options that cause side effects. The only one that does this so far is the revml source, which can output the RevML doctype as a .pm file.
- copy
-
REQUIRED OVERLOAD.
$source->copy_revs() ;
Called by "copy" in VCP to do the entire export process. This is passed a partially filled-in header structure.
The subclass should call
$self->dest->handle_rev( $rev_meta ) ;
The subclass needs to make sure the $rev_meta hash contains the metadata for the file and a work_path that points to the work location of the file:
$rev_meta = VCP::Rev->new( work_path => '/tmp/revex/4/depot/perl/perl.c', name => 'depot/perl/perl.c', rev_id => '4', change_id => '22', labels => [ 'v0_003', 'v0_004' ], ) ;
- handle_header
-
REQUIRED OVERLOAD.
Subclasses must add all repository-specific info to the $header, at least including rep_type and rep_desc.
$header->{rep_type} => 'p4', $self->p4( ['info'], \$header->{rep_desc} ) ;
The subclass must call the superclass method to pass the $header on to the dest:
$self->SUPER::handle_header( $header ) ;
-
Not a required overload, as the footer carries no useful information at this time. Overriding methods must call this method to pass the $footer on:
$self->SUPER::handle_footer( $footer ) ;
- parse_time
-
$time = $self->parse_time( $timestr ) ;
Parses "[cc]YY/MM/DD[ HH[:MM[:SS]]]".
Will add ability to use format strings in future. HH, MM, and SS are assumed to be 0 if not present.
Returns a time suitable for feeding to localtime or gmtime.
Assumes local system time, so no good for parsing times in revml, but that's not a common thing to need to do, so it's in VCP::Source::revml.pm.
- revs
-
$self->revs( VCP::Revs->new ) ; $self->revs->add( $r ) ; # Many times $self->dest->sort_revs( $self->revs ) ; my VCP::Rev $r ; while ( $r = $self->revs->pop ) { ## ...checkout the source reve & set $r->work_path() to refer to it's loc. $self->dest->handle_rev( $r ) ; }
Sets/gets the revisions member. This is used by most sources to accumulate the set of revisions to be copied.
This member should be set by the child in copy_revs(). It should then be passed to the destination
- bootstrap
-
Usually called from within call to GetOptions in subclass' new():
GetOptions( 'b|bootstrap:s' => sub { my ( $name, $val ) = @_ ; $self->bootstrap( $val ) ; }, 'r|rev-root' => \$rev_root, ) or $self->usage_and_exit ;
Can be called plain:
$self->bootstrap( $bootstrap_spec ) ;
See the command line documentation for the format of $bootstrap_spec.
Returns nothing useful, but "bootstrap_regexps" does.
- is_bootstrap_mode
-
... if $self->is_bootstrap_mode( $file ) ;
Compares the filename passed in against the list of bootstrap regular expressions set by "bootstrap".
The file should be in a format similar to the command line spec for whatever repository is passed in, and not relative to rev_root, so "//depot/foo/bar" for p4, or "module/foo/bar" for cvs.
This is typically called in the subbase class only after looking at the revision number to see if it's a first revision (in which case the subclass should automatically put it in bootstrap mode).
COPYRIGHT
Copyright 2000, Perforce Software, Inc. All Rights Reserved.
This module and the VCP package are licensed according to the terms given in the file LICENSE accompanying this distribution, a copy of which is included in vcp.
AUTHOR
Barrie Slaymaker <barries@slaysys.com>
1 POD Error
The following errors were encountered while parsing the POD:
- Around line 64:
You forgot a '=back' before '=head1'