man VCP::Rev () - VCP's concept of a revision

NAME

VCP::Rev - VCP's concept of a revision

SYNOPSIS

   use VCP::Rev;

   use VCP::Rev qw( iso8601format );

   my $r = VCP::Rev->new;

DESCRIPTION

A data structure that represents a revision to a file (but, technically, not a version of a file, though the two are often synonymous).

METHODS

new
Creates an instance, see subclasses for options.
   my $rev = VCP::Rev->new(
      name => 'foo',
      time => $commit_time,
      ...
   ) ;
fields
Returns a list of field names, with @ prepended to any array fields.
serialize
Converts the revision metadata to a set of name=value strings suitable for emitting to a flat file for later recovery. Names are included so that new revisions of VCP can rescuscitate revisions.
split_id
   VCP::Rev->split_id( $id );
Splits an id in to chunks on punctuation and number/letter boundaries.
   Id           Result
   ==           ======
   1            ( 1 )
   1a           ( 1, "a" )
   1.2          ( 1, "", 2 )
   1a.2         ( 1, "a", 2 )
This oddness is to facilitate manually named revisions that use a lettering scheme. Note that the sort algorithms make an assumption that 1.0a is after 1.0. This prevents kind of naming like 1.2pre1.
cmp_id
   VCP::Rev->cmp_id( $id1, $id2 );
   VCP::Rev->cmp_id( \@id1, \@id2 );  # for presplit ids
splits CW$id1 and CW$id2 if necessary and compares them using CW<=> on even numbered elements and CWcmp on odd numbered elements.
is_base_rev
Returns TRUE if this is a base revision. This is the case if no action is defined. A base revision is a revision that is being transferred merely to check it's contents against the destination repository's contents. Base revisions contain no action and contain a <digest> but no <delta> or <content>. When a VCP::Dest::* receives a base revision, the actual body of the revision is 'backfilled' from the destination repository and checked against the digest. This cuts down on transfer size, since the full body of the file never need be sent with incremental updates. See backfill in VCP::Dest as well.
is_real_rev
Returns true for base revisions and for add or edit revisions, all of which must be able to be checked out from the source repository.
is_placeholder_rev
Returns TRUE if this is a branch or clone revision. Placeholder revisions are used to record branch points without causing edits and to perform cloning operations. Note that placeholders may have rev_id and change_id fields, but they are likely to be fabricated as they often don't actually exist in the source repository. For instance, CVS does not record a revision number for a branch operation unless the file has been alterde on the branch.
is_branch_rev
Returns TRUE if this is a branch founding placeholder revision. These revisions are used to record branch points for files without modifying the files. A branch revision has an action of branch. Note that branch placeholders may have rev_id and change_id fields, but they may be malformed; they are present for sorting purposes only and should be ignored by the destination repository. Branch revisions may not be present for branches which have files on them but should be in order to cause the destination to create the branch before altering any files on it.
is_clone_rev
Returns TRUE if this is a cloning placeholder revision. These revisions are used to mirror files from one branch to another when a physical filebranch maps to more than one logical branch. This is not possible in p4, but is possible in both CVS and VSS. CVS generates these as of this writing, VSS may by the time you read this.
base_revify
Converts a normal rev in to a base rev.
id
Sets/gets the id. Returns $name#$rev_id by default, which should work for most systems.
get_source_file
Fetches the file from the source repository and returns a path to that file.
set_labels
   $r->set_labels( \@labels ) ;  ## pass an array ref for speed
   @labels = $r->labels ;
Sets/gets labels associated with a revision. If a label is applied multiple times, it will only be returned once. This feature means that the automatic label generation code for r_... revision and ch_... change labels won't add additional copies of labels that were already applied to this revision in the source repository. Returns labels in an unpredictible order, which happens to be sorted for now. This sorting is purely for logging purposes and may disappear at any moment.
add_label
  $r->add_label( $label ) ;
Marks one or more labels as being associated with this revision of a file.
set_earlier_ids
   $r->set_earlier_ids( \@earlier_ids );  ## pass an array ref for speed
   $r->set_earlier_ids( @earlier_ids );   ## or now
   @earlier_ids = $r->earlier_ids ;
Sets/gets earlier_ids associated with a revision. If a earlier_id is applied multiple times, it will only be returned once. This feature means that the automatic earlier_id generation code for r_... revision and ch_... change earlier_ids won't add additional copies of earlier_ids that were already applied to this revision in the source repository. Returns earlier_ids in an unpredictible order, which happens to be sorted for now. This sorting is purely for logging purposes and may disappear at any moment.
add_earlier_id
  $r->add_earlier_id( $earlier_id ) ;
Marks one or more earlier_ids as being associated with this revision of a file.
iso8601format
   VCP::Rev::iso8601format( $time );
Takes a seconds-since-the-epoch time value and converts it to an ISO8601 formatted date. Exportable:
   use VCP::Rev qw( iso8601format );
as_string
Prints out a string representation of the name, rev_id, change_id, type, time, and a bit of the comment. base revisions are flagged as such (and don't have fields like time and comment).

SUBCLASSING

This class uses the fields pragma, so you'll need to use base and possibly fields in any subclasses.

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>