null.pm #19

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

=head1 NAME

VCP::Dest::null - null destination driver

=head1 SYNOPSIS

   vcp <source> null:
   vcp <source> null:

=head1 DESCRIPTION

Behaves like a normal destination but generates no output.

=cut

$VERSION = 1 ;

use strict ;

use Carp ;
use File::Basename ;
use File::Path ;
use VCP::Debug ':debug' ;
use VCP::Logger qw( lg pr_doing );
use VCP::Rev ;

use base qw( VCP::Dest );
use fields (
   'NULL_GET_REVS',  ## 0 => don't actually fetch the revs, otherwise do.
);

sub new {
   my $self = shift->SUPER::new;

   ## Parse the options
   my ( $spec, $options ) = @_ ;

   die "vcp: the null source takes no spec ('$1')\n"
      if defined $spec && $spec =~ m{\Anull:(.+)}i;

   $self->repo_id( "null" );
   $self->parse_repo_spec( $spec ) if defined $spec;
   $self->parse_options( $options );

   return $self;
}


sub options_spec {
   my VCP::Dest::null $self = shift;
   return (
      $self->SUPER::options_spec,
      "dont-get-revs"   => sub { $self->{NULL_GET_REVS} = 0 },
   );
}


sub handle_rev {
   my VCP::Dest::null $self = shift;
   my ( $r ) = @_;

   debug "got ", $r->as_string if debugging;

   $r->get_source_file
      if (
         ! defined $self->{NULL_GET_REVS}
         || $self->{NULL_GET_REVS}
      ) && (
            $r->is_base_rev
            || (
               ! $r->is_placeholder_rev
               && $r->action ne "delete"
            )
         );

   pr_doing;
}


=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
#20 4021 Barrie Slaymaker - Remove all phashes and all base & fields pragmas
- Work around SWASHGET error
#19 4012 Barrie Slaymaker - Remove dependance on pseudohashes (deprecated Perl feature)
#18 3979 Barrie Slaymaker - VCP::Source::cvs branch number regex fixed
- VCP::Dest::null --dont-get-revs option added
#17 3970 Barrie Slaymaker - VCP::Source handles rev queing, uses disk to reduce RAM
- Lots of other fixes
#16 3908 Barrie Slaymaker - Debugging cleanups
#15 3851 Barrie Slaymaker - VCP::Dest::null belated adaptation to VCP::Rev::get_source_file()
#14 3850 Barrie Slaymaker - No longer stores all revs in memory
#13 3813 Barrie Slaymaker - VCP::Rev::previous() is no more
#12 3811 Barrie Slaymaker - fetch_*() and get_rev() renamed get_source_file()
#11 3805 Barrie Slaymaker - VCP::Revs::fetch_files() removed
#10 3746 Barrie Slaymaker - VCP::Source::cvs parses vendor tags when no revisions are present
  on the vendor branch (as per Marc Tooley's patch)
    - add test for said parsing
#9 3706 Barrie Slaymaker - VCP gives some indication of output progress (need more)
#8 3701 Barrie Slaymaker - VCP::Dest::null now behaves more like a real destination,
  which helps with testing.
#7 3466 Barrie Slaymaker - --output-config-file now usable with vcp:- specification
- --output-config-file now tested
- VCP::{Source,Dest}::null now sets a repo_scheme so they
  may be emitted to config files.
- Dest: is now emitted right after Source: when there are filters
  to dump.
#6 3460 Barrie Slaymaker - Revamp Plugin/Source/Dest hierarchy to allow for
  reguritating options in to .vcp files
#5 3133 Barrie Slaymaker Make destinations call back to sources to check out files to
       simplify the architecture (is_metadata_only() no longer needed)
       and make it more optimizable (checkouts can be batched).
#4 3014 Barrie Slaymaker minor warnings cleanups
#3 2838 John Fetkovich Use parse_options rather than using Getopt::Long directly.
#2 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.
#1 2228 Barrie Slaymaker working checkin