<html><head><title>VCP::Source - A base class for repository sources</title></head><body><h1><a name="NAME">NAME </a></h1><p>VCP::Source - A base class for repository sources <p><hr><h1><a name="SYNOPSIS">SYNOPSIS </a></h1><p><hr><h1><a name="DESCRIPTION">DESCRIPTION </a></h1><p><hr><h1><a name="OPTIONS">OPTIONS </a></h1><dl><dt><a name="_bootstrap_"><strong><p>--bootstrap </strong></a><pre> --bootstrap=pattern </pre><dd>Forces all files matching the given shell regular expression (may use wildcards like "*", "?", and "...") to have their first revisions transferred as complete copies instead of deltas. This is useful when you want to transfer a revision other than the first revision as the first revision in the target repository. It is also useful when you want to skip some revisions in the target repository (although the <a href="VCP/Filter/map.html">Map filter</a> has superceded this use). <dt><a name="_continue_"><strong><p>--continue </strong></a><dd>Tells VCP to continue where it left off from last time. This will not detect new branches of already transferred revisions (this limitation should be lifted, but results in an expensive rescan of metadata), but will detect updates to already transferred revisions. </dl><p><hr><h1><a name="SUBCLASSING">SUBCLASSING </a></h1><p>This class uses the fields pragma, so you'll need to use base and possibly fields in any subclasses. See <a>VCP::Plugin</a> for methods often needed in subclasses. <h2><a name="Subclass_utility_API">Subclass utility API </a></h2><dl><dt><a name="options_spec_"><strong><p>options_spec </strong></a><dd>Adds common VCP::Source options to whatever options VCP::Plugin parses: <dt><a name="dest_"><strong><p>dest </strong></a><dd>Sets/Gets a reference to the VCP::Dest object. The source uses this to call handle_header(), handle_rev(), and handle_end() methods. <dt><a name="continue_"><strong><p>continue </strong></a><dd>Sets/Gets the CONTINUE field (which the user sets via the --continue flag) <dt><a name="real_source_"><strong><p>real_source </strong></a><dd>Returns the reference to be used when sending revisions to the destination. <p>Each revision has a pointer to the source that sends it so that filters and destinations can call get_source_file(). <p>Most sources return $self; Sources that spool data, such as VCP::Source::metadb, need to specify a real source. They do so by overloading this method. VCP::Source::revml does not do this, as it supplies a get_source_file(). <dt><a name="rev_mode_"><strong><p>rev_mode </strong></a><pre> my $mode = $self->rev_mode( $filebranch_id, $rev_id ); </pre><dd>Returns FALSE, "base", or "normal" as a function of the filebranch and rev_id. Do not queue the revision if this returns FALSE (you may also skip any preceding revisions). Queue it only as a base revision if it returns "base", and queue it as a full revision otherwise. <p>Not all base revs will be sent; base revs that have no child revs will not be sent. <p>Always returns "normal" when not in continue mode. <dt><a name="queue_rev_"><strong><p>queue_rev </strong></a><dd>Some revs can't be sent immediately. They get queued. Once queued, the revision may not be altered. All revisions must be queued before being sent. All revs from the source repository should be queued, --continue processing is automatic. Placeholders should be inserted for all branches, even empty ones. <p>This updates last_rev and last_rev_for_filebranch. <p>Returns FALSE if the rev cannot be queued, for instance if it's already been queued once. <p>rev_mode() should be called before creating a rev, or at least before queue_rev()ing it in order to see if and in what form the rev should be sent. <dt><a name="queued_rev_"><strong><p>queued_rev </strong></a><pre> $self->queued_rev( $id ); </pre><dd>Returns a queued rev by id. <p>Sources where revs can arrive willy-nilly, like VCP::Source::revml, queue up all revs and need to randomly access them. <dt><a name="last_rev_"><strong><p>last_rev </strong></a><dd>Returns the last revision queued. <dt><a name="last_rev_for_filebranch_"><strong><p>last_rev_for_filebranch </strong></a><pre> $self->last_rev_for_filebranch( $filebranch_id ); </pre><dd>Returns the last revision queued on the indicated filebranch. <dt><a name="set_last_rev_in_filebranch_previous_id_"><strong><p>set_last_rev_in_filebranch_previous_id </strong></a><pre> $self->set_last_rev_in_filebranch_previous_id( $r ); </pre><dd>If there is a last_rev_for_filebranch for $r->filebranch_id, sets its previous_id to point to $r. This is useful for sources which scan in most-recent-first order. <dt><a name="already_queued_"><strong><p>already_queued </strong></a><pre> $self->already_queued( $id ); </pre><dd>Returns true if the indicated id was queued. <dt><a name="queued_rev_count_"><strong><p>queued_rev_count </strong></a><dd>Returns (does not set) the number of revs queued so far. <p>Replaces the deprecated function sent_rev_count(). <dt><a name="store_cached_revs_"><strong><p>store_cached_revs </strong></a><pre> $self->store_cached_revs; </pre><dd>For parsers which read history one file at a time and branch in rev_id space, like VCP::Source::cvs, it's possible to flush all revs to disk after each file is parsed. This method takes the last VCP::Rev in each filebranch and stores it to disk, freeing memory. <dt><a name="send_revs_"><strong><p>send_revs </strong></a><pre> $self->send_revs; </pre><dd>Removes and sends all revs accumulated so far. Called automatically after scan_metadata(). </dl><p><hr><h1><a name="SUBCLASS_OVERLOADS">SUBCLASS OVERLOADS </a></h1><p>These methods should be overridded in any subclasses. <dl><dt><a name="scan_metadata_"><strong><p>scan_metadata </strong></a><dd>This is called to scan the metadata for the source repository. It should call rev_mode() for each revision found (including any that need to be concocted to make up for collapsed metadata in the source, like VSS or CVS deletes or CVS branch creation) and if that returns TRUE, then queue_rev() should be called. <p>If rev_mode() returns "base", then the transfer is in --continue mode and this rev should be built as or converted to a base revision. The easiest way to do this is to build it normally and then call $r->base_revify(). <p>If the metadata source returns metadata from most recent to oldest, as do most file history reports, the previous_id() need not be set until the next revision in a filebranch is scanned. The most recent rev passed to queue_rev() is available by calling last_rev(), if the metadata is one branch at a time, and the last rev in each filebranch is available by calling last_rev_for_filebranch(). <p>If the metadata is scanned one file or filebranch at a time and branched are all created by the time the end of a file's metadata arrives, calling store_cached_revs() will flush all queued revs from the last_rev() and last_rev_for_filebranch() in-memory caches to the disk cache (all other revs are flushed as their successors arrive). <p>There is no easy way to handle randomly ordered metadata at this time, typically a source will accumulate as little as it can in memory and queue the rest. See VCP::Source::cvs for an example of this. <p>Once scan_metadata() is complete, send_revs() will be called automatically. <dt><a name="get_source_file_"><strong><p>get_source_file </strong></a><dd>All sources must provide a way for the destination to fetch a revision. <dt><a name="handle_header_"><strong><p>handle_header </strong></a><dd>REQUIRED OVERLOAD. <p>Subclasses must add all repository-specific info to the $header, at least including rep_type and rep_desc. <pre> $header->{rep_type} => 'p4', $self->p4( ['info'], \$header->{rep_desc} ) ; </pre><p>The subclass must pass the $header on to the dest: <pre> $self->dest->handle_header( $header ) if $self->dest; </pre><p>This may be called when dest is null to allow the source to initialize itself when it won't be scanning the real source. So the if $self->dest is important. <p>That's not the case for copy_revs(). <dt><a name="handle_footer_"><strong><p>handle_footer </strong></a><dd>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: <pre> $self->SUPER::handle_footer( $footer ) ; </pre><dt><a name="parse_time_"><strong><p>parse_time </strong></a><pre> $time = $self->parse_time( $timestr ) ; </pre><dd>Parses "[cc]YY/MM/DD[ HH[:MM[:SS]]]". <p>Will add ability to use format strings in future. HH, MM, and SS are assumed to be 0 if not present. <p>Returns a time suitable for feeding to localtime or gmtime. <p>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. <dt><a name="bootstrap_"><strong><p>bootstrap </strong></a><dd>Sets (and parses) or gets the bootstrap spec. <p>Can be called plain: <pre> $self->bootstrap( $bootstrap_spec ) ; </pre><p>See the command line documentation for the format of $bootstrap_spec. <dt><a name="is_bootstrap_mode_"><strong><p>is_bootstrap_mode </strong></a><pre> ... if $self->is_bootstrap_mode( $file ) ; </pre><dd>Compares the filename passed in against the list of bootstrap regular expressions set by <a href="#bootstrap">/bootstrap</a>. <p>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. <p>This is typically called in the subbase class only after looking at the revision number to see if it is a first revision (in which case the subclass should automatically put it in bootstrap mode). </dl><p><hr><h1><a name="COPYRIGHT">COPYRIGHT </a></h1><p>Copyright 2000, Perforce Software, Inc. All Rights Reserved. <p>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 <a href="vcp.html">vcp</a>. <p><hr><h1><a name="AUTHOR">AUTHOR </a></h1><p>Barrie Slaymaker <barries@slaysys.com> <p><hr><i><font size="-1">Last updated: Fri Jun 4 14:21:32 2004</font></i></body></html>
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#1 | 6118 | Dimitry Andric | Integ from //public/revml to //guest/dimitry_andric/revml/main. | ||
//guest/perforce_software/revml/product/release/1.0.0/html/VCP/Source.html | |||||
#1 | 4311 | alan_teague |
Initial versions of productization files and scripts. All are draft quality submitted for review. |