revmap #8

  • //
  • guest/
  • richard_geiger/
  • utils/
  • cvs2p4/
  • bin/
  • revmap
  • View
  • Commits
  • Open Download .zip Download (2 KB)
eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}'
  & eval 'exec perl -S $0 $argv:q'
  if 0;
#  THE PRECEEDING STUFF EXECS perl via $PATH
# -*-Fundamental-*-

#  $Id: //guest/richard_geiger/utils/cvs2p4/bin/revmap#8 $
#
#  Richard Geiger
#

require 5.000;

#use bytes;

use Carp; # ...or flounder. (This will fail unless 'perl' is a perl5!)
$| = 1;

($Myname = $0) =~ s%^.*/%%;

$Usage = <<LIT;
$Myname: usage: $Myname [-map <mapfile>] <convdir>
LIT


sub usage
{
  print STDERR $Usage;
  exit 1;
}


sub help
{
  print STDERR <<LIT;
$Usage
$Myname is...
LIT
  exit 1;
}


# option switch variables get defaults here...

$Boolopt = 0;
$Valopt = 0;

$Mapfile = "revmap";

while ($#ARGV >= 0)
  {
    if ($ARGV[0] eq "-boolopt")    { $Boolopt = 1; shift; next; }
    elsif ($ARGV[0] eq "-map")
      {
        shift; if ($ARGV[0] < 0) { &usage; }
        $Mapfile = $ARGV[0]; shift; next;
      }
    elsif ($ARGV[0] eq "-help")
      { &help; }
    elsif ($ARGV[0] =~ /^-/) { &usage; }
    if ($Args ne "") { $Args .= " "; }
    push(@Args, $ARGV[0]);
    shift;
  }

if ($#Args ne 0) { &usage; }

$Convdir = $Args[0];
chdir $Convdir || die "$Myname: can't chdir \"$Convdir\": $!";
$Convdir = `/bin/pwd`; chop $Convdir;
chdir $Here || die "$Myname: can't chdir \"$Here\": $!";

$Revmap   = "$Convdir/$Mapfile";

use DB_File;
$DBMCLASS="DB_File";

#$myhashinfo = new DB_File::HASHINFO;
#$myhashinfo->{bsize} = 4096;

$myhashinfo = new DB_File::BTREEINFO;

if (! tie(%REVMAP, $DBMCLASS, $Revmap, O_RDONLY, 0444, $myhashinfo))
  { print "$Myname: can't tie \"$Revmap\": $!\n"; exit 1; }

while (($key,$val) = each %REVMAP)
  {
    if ($Mapfile != "rrevmap") { $val =~ s/\001.*//; }
    print "$key $val\n";
  }

untie %REVMAP;

# Change User Description Committed
#8 5442 Richard Geiger A checkpoint commit on the way to a 2.6.0 release with the
new IronPort inspired improvements.
#7 5430 Richard Geiger This is another "checkpoint" commit.
 It significantly
rearranges how labels are done, so as to use a hueristic to
divine label<->branch identifications. Not intended for
release without further testing and tweakage!
#6 3708 Richard Geiger Changes for 2.3.6
#5 2061 Richard Geiger changes for 2.3.2:
  - can adjust db hash bucket size;
  - Add $DEPOT config variable
  - Handle labels with '#' or '@'
#4 1987 Richard Geiger Changes for 2.3.1
#3 1407 Richard Geiger === Release 1.3.2

- Reduce the memory footprint of bin/genmetadata. Previously, it was
  holding and sorting a complete copy of the metadata file "in-core"
  (as well as a copy of all of the RCS revision tags data!). This adds
  up quick, and some users saw genmetadata gobbling memory voraciously
  (and in some cases being running out, causing thrashing and/or process
  termination by the OS).

  genmetadata now keeps the metadata in a temp file, (sorting it in
  primary-key-sized chunks), and the revision tag information in a
  db-backed hash.

- Fix the label handling so that _all_ perforce revisions based on the
  labeled cvs revision are included in the generated
  labels. Previously, one of the N "correct" Perforce revisions were
  being tagged (effectively, at random). This stems from the fact that
  lazy copying and branching are explicit in Perforce, but implicit in
  CVS. I.e., the "#1" revision in a new Perforce branch _appears_ to
  be a separate entity (identical to the revision from which it was
  branched. This means that to use the converted labels, it will be up
  to _you_ to remember what labels go with what branches: but that's
  the way it is in CVS, too.

- A minor change in revmap to have a meaningful usage message, and
  properly handle the new rrevmap format.

- dochanges correctly deletes revmap database files for either
  *.db or *.pag/*.dat style databases.
#2 1185 Richard Geiger Changes for 1.3
(Labels!)
#1 130 Richard Geiger CVS-to-Perforce converter.
This is release 1.2.2
(first submit to the Perforce Public Depot)