[I haven't tried to make this official as I don't have the stomach for the inevitable Bourne shell versus perl flames. Personally, I think that the Bourne shell is a pretty rotten scripting language (whether one likes perl or not), but I suspect that others have different opinions -kingdon] Date: Fri, 12 Sep 1997 14:07:06 -0400 (EDT) From: "David J. MacKenzie" To: Jim Kingdon Subject: Re: rcs-to-cvs depends on /usr/tmp and /usr/ucb/vi . . . Fri Sep 12 14:02:11 1997 David J. MacKenzie * rcs-to-cvs: Rewrite in perl5, restructuring for clarity. Remove code to set the comment leader manually, as the RCS man pages say it's obsolete now (not necessary anymore). Check for error returns from external programs. Make messages clearer. Warn if CVS files are already present. [patch snipped; see next mesage] Date: Fri, 12 Sep 1997 15:51:29 -0400 (EDT) From: "David J. MacKenzie" To: kingdon@cyclic.com Subject: rcs-to-cvs, bug just found Well, hey, I thought it was working, but another developer here just pointed out that I mistyped "755" instead of "775" in the mkdir calls. So: #! /usr/local/bin/perl5 -w # # Based on the CVS 1.0 checkin csh script. # Contributed by Per Cederqvist . # Rewritten in perl by David MacKenzie . # # Copyright (c) 1989, Brian Berliner # # You may distribute under the terms of the GNU General Public License. # ############################################################################# # # Check in sources that previously were under RCS or no source control system. # # The repository is the directory where the sources should be deposited. # # Traverses the current directory, ensuring that an # identical directory structure exists in the repository directory. It # then checks the files in in the following manner: # # 1) If the file doesn't yet exist, check it in as revision 1.1 # # The script also is somewhat verbose in letting the user know what is # going on. It prints a diagnostic when it creates a new file, or updates # a file that has been modified on the trunk. # # Bugs: doesn't put the files in branch 1.1.1 # doesn't put in release and vendor tags # ############################################################################# use Getopt::Std; use File::Basename; $usage = "Usage: $0 [-m message] [-f message_file] repository\n"; $temp_message = 0; &getopt('m:f:'); die $usage unless @ARGV == 1; $repository = shift; defined $ENV{CVSROOT} || die "ERROR: Set the environment variable CVSROOT to the root of the tree you wish to update.\n"; if (-d "SCCS") { die "ERROR: SCCS files found\n"; } if (-d "CVS") { die "ERROR: CVS files already found in this directory\n"; } $tmpdir = $ENV{TMPDIR} || "/var/tmp"; $message_file = $opt_f || "$tmpdir/checkin.$$"; if ($opt_m) { open F, ">$message_file" || die "ERROR: $message_file: $!\n"; print F $opt_m, "\n"; close F; $temp_message = 1; } elsif (!$opt_f) { open F, ">$message_file" || die "ERROR: $message_file: $!\n"; print F "Please edit this file to contain the RCS log information to be associated with this directory (please remove these lines).\n"; close F; system($ENV{EDITOR} || "vi", $message_file) and die "ERROR: edit failed\n"; $temp_message = 1; } # Ya gotta share. umask 0; $update_dir="$ENV{CVSROOT}/$repository"; unless (-d $update_dir) { mkdir $update_dir, 0775 || die "ERROR: mkdir $update_dir: $!\n"; } -d "RCS" && system "co RCS/*,v RCS/.*,v"; opendir DOT, "."; while ($name = readdir DOT) { next if $name =~ /^RCS$|~$|^\.\.?$/; print "$name\n"; if (-d $name) { unless (-d "$update_dir/$name") { print "INFO: Creating new directory $repository/$name\n"; mkdir "$update_dir/$name", 0775 || die "ERROR: mkdir $update_dir/$name: $!\n"; } chdir "$name" || die "ERROR: cd $name: $!\n"; system $0, "-f", $message_file, "$repository/$name" and die "ERROR: recursive run failed\n"; chdir ".."; next; } elsif (! -f $name) { warn "WARNING: $name: ignored, neither a regular file nor a directory\n"; next; } $new_file="$update_dir/$name,v"; if (-f $new_file) { warn "WARNING: $name: ignored, exists in repository\n"; next; } if (-f "$update_dir/Attic/$name,v") { warn "WARNING: $name: ignored, exists in repository Attic\n"; next; } if (-f "RCS/$name,v") { print "INFO: Copying old RCS file $repository/$name\n"; system "cp", "RCS/$name,v", $new_file and die "ERROR: Can not copy RCS/$name,v to $new_file\n"; next; } print "INFO: Creating new file $repository/$name\n"; system "ci", "-q", "-u1.1", "-t$message_file", "-m.", $new_file and die "ERROR: Check-in of $new_file failed\n"; } closedir DOT; END { $temp_message && unlink $message_file; }