RevMapDB.pm #10

  • //
  • guest/
  • perforce_software/
  • revml/
  • lib/
  • VCP/
  • RevMapDB.pm
  • View
  • Commits
  • Open Download .zip Download (2 KB)
package VCP::RevMapDB;

=head1 NAME

VCP::RevMapDB - Persistant storage for id -> (name, rev_id) maps

=head1 SYNOPSIS

    use base qw( VCP::RevMapDB );

=head1 DESCRIPTION

By default, most VCP::Dest::* drivers keep track of the relationship
between the id field assigned by the (original) VCP::Source::* driver
and the final name and rev_id (or whatever fields are important to it)
in the destination repository so that the previous_id fields, which
refer to the original id, may be resolved when backfilling or branching.

The VCP::*::revml drivers do not do this; they do not need to resolve id
fields.

The intent for this file is to serve as a base class so that individual
sites may write their own RevMapDB plugins to, for instance, store this
state in a RDBMS table.  This is not quite offered at this time; we need
to add an option to the appropriate VCP::Dest::* modules to allow the
appropriate RevMapDB file to be loaded.

To write your own RevMapDB file, see VCP::RevMapDB::sdbm.

=for test_script t/02revmapdb.t

=cut

$VERSION = 1 ;

use strict ;
require Carp;

## TODO: Make the base class pluggable
use base "VCP::DB";

sub new {
    shift->SUPER::new( TableName => "rev_map", @_ );
}


sub get {
    my VCP::RevMapDB $self = shift;
    my ( $key ) = @_;

    my @v = $self->SUPER::get( $key );

    Carp::confess "vcp: no DB_File entry for ",
        join( ";", @$key ),
        "\n"
        unless @v;

    return @v;
}


sub set {
    my VCP::RevMapDB $self = shift;
    my ( $key ) = @_;

    warn "vcp: overwriting DB_File entry for ",
       join( ";", @$key ),
       ".  Stale vcp_state in ",
       $self->store_loc, "?\n"
      if $self->exists( $key );

    $self->SUPER::set( @_ );
}

=head1 AUTHOR

Barrie Slaymaker <barries@slaysys.com>

=head1 COPYRIGHT

Copyright (c) 2000, 2001, 2002 Perforce Software, Inc.
All rights reserved.

See L<VCP::License|VCP::License> (C<vcp help license>) for the terms of use.

=cut

1
# Change User Description Committed
#12 4021 Barrie Slaymaker - Remove all phashes and all base & fields pragmas
- Work around SWASHGET error
#11 3155 Barrie Slaymaker Convert to logging using VCP::Logger to reduce stdout/err spew.
       Simplify & speed up debugging quite a bit.
       Provide more verbose information in logs.
       Print to STDERR progress reports to keep users from wondering
       what's going on.
       Breaks test; halfway through upgrading run3() to an inline
       function for speed and for VCP specific features.
#10 2807 Barrie Slaymaker Clean up debugging messages
#9 2802 John Fetkovich Added a source_repo_id to each revision, and repo_id to each
Source and Dest.  The repo_ids include repository type
(cvs,p4,revml,vss,...) and the repo_server fields.  Changed the
$self->...->set() and $self->...->get() lines in VCP::Dest::* to
pass in a conglomerated key value, by passing in the key as an
ARRAY ref.  Also various restructuring in VCP::DB.pm,
VCP::DB_file.pm and VCP::DB_file::sdbm.pm related to this
change.
#8 2787 Barrie Slaymaker fix buglet
#7 2786 Barrie Slaymaker Differentiate RevMapDB (which confesses when an undefined
       value is returned) from HeadRevsDB (which doesn't).
#6 2769 Barrie Slaymaker Suppress extraneous stale db warning, demote the stale
       state db detection to RevMapDB, allow the head revs db
       to be dumped.
#5 2723 Barrie Slaymaker Finish generalizing DB_File, implement HeadRevsDB
#4 2722 Barrie Slaymaker Generalize DB_File for reuse.
#3 2706 Barrie Slaymaker Interim checkin
#2 2703 Barrie Slaymaker use the new RevMapDB in VCP::Dest::cvs
#1 2702 Barrie Slaymaker Create the RevMapDB classes & tests