You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by Roy Fielding <fi...@hyperreal.com> on 1997/06/26 18:32:21 UTC

cvs commit: CVSROOT commit_prep.pl log_accum.pl rcstemplate

fielding    97/06/26 09:32:20

  Modified:    .         commit_prep.pl log_accum.pl rcstemplate
  Log:
  Implemented logging/mail of new (Added) files with revision 1.1.
  Removed the commit preparation and logging code having to do with
  checking Id lines, since we can't use it (and its a bad idea anyway).
  Cleaned up the perl code to be more robust and easier to maintain.
  Added a PR: line to the template.
  
  Revision  Changes    Path
  1.4       +11 -146   CVSROOT/commit_prep.pl
  
  Index: commit_prep.pl
  ===================================================================
  RCS file: /export/home/cvs/CVSROOT/commit_prep.pl,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -C3 -r1.3 -r1.4
  *** commit_prep.pl	1997/06/26 14:39:06	1.3
  --- commit_prep.pl	1997/06/26 16:32:18	1.4
  ***************
  *** 2,168 ****
    #
    # Perl filter to handle pre-commit checking of files.  This program
    # records the last directory where commits will be taking place for
  ! # use by the log_accumulate script.  For new file, it forcing the
  ! # existence of a RCS "Id" keyword in the first ten lines of the file.
  ! # For existing files, it checks version number in the "Id" line to
  ! # prevent losing changes because an old version of a file was copied
  ! # into the direcory.
  ! #
  ! # Possible future enhancements:
  ! #
  ! #
  ! #    Check for cruft left by unresolved conflicts.  Search for
  ! #    "^<<<<<<<$", "^-------$", and "^>>>>>>>$".
  ! #
  ! #    Look for a copyright and automagically update it to the
  ! #    current year.
    #
    # Contributed by David Hampton <ha...@cisco.com>
  ! #
  ! 
  ! ############################################################
  ! #
  ! # Configurable options
    #
    ############################################################
  ! #
  ! # Check each file (except dot files) for an RCS "Id" keyword.
  ! #
  ! $check_id = 0;
    
  ! #
  ! # Record the directory for later use by the log_accumulate stript.
  ! #
  ! $record_directory = 1;
  ! 
  ! ############################################################
  ! #
  ! # Constants
  ! #
  ! ############################################################
  ! $LAST_FILE     = "/tmp/##cvs.lastdir";
  ! $ENTRIES       = "CVS/Entries";
  ! 
  ! $NoId = "
  ! %s - Does not contain a line with the keyword \"Id:\".
  !     Please see the template files for an example.\n";
  ! 
  ! # Protect string from substitution by RCS.
  ! $NoName = "
  ! %s - The ID line should contain only \"\$\I\d\:\ \$\" for a newly created file.\n";
  ! 
  ! $BadName = "
  ! %s - The file name '%s' in the ID line does not match
  !     the actual filename.\n";
  ! 
  ! $BadVersion = "
  ! %s - How dare you!!  You replaced your copy of the file '%s',
  !     which was based upon version %s, with an %s version based
  !     upon %s.  Please move your '%s' out of the way, perform an
  !     update to get the current version, and them merge your changes
  !     into that file.\n";
  ! 
  ! ############################################################
  ! #
  ! # Subroutines
  ! #
  ! ############################################################
    
    sub write_line {
        local($filename, $line) = @_;
  !     open(FILE, ">$filename") || die("Cannot open $filename, stopped");
        print(FILE $line, "\n");
        close(FILE);
    }
    
  - sub check_version {
  -     local($i, $id, $rname, $version);
  -     local($filename, $cvsversion) = @_;
  - 
  -     open(FILE, $filename) || die("Cannot open $filename, stopped");
  -     for ($i = 1; $i < 10; $i++) {
  - 	$pos = -1;
  - 	last if eof(FILE);
  - 	$line = <FILE>;
  - 	$pos = index($line, "Id: ");
  - 	last if ($pos >= 0);
  -     }
  - 
  -     if ($pos == -1) {
  - 	printf($NoId, $filename);
  - 	return(1);
  -     }
  - 
  -     ($id, $rname, $version) = split(' ', substr($line, $pos));
  -     if ($cvsversion{$filename} == 0) {
  - 	if ($rname ne "\$") {
  - 	    printf($NoName, $filename);
  - 	    return(1);
  - 	}
  - 	return(0);
  -     }
  - 
  -     if ($rname ne "$filename,v") {
  - 	printf($BadName, $filename, substr($rname, 0, length($rname)-2));
  - 	return(1);
  -     }
  -     if ($cvsversion{$filename} < $version) {
  - 	printf($BadVersion, $filename, $filename, $cvsversion{$filename},
  - 	       "newer", $version, $filename);
  - 	return(1);
  -     }
  -     if ($cvsversion{$filename} > $version) {
  - 	printf($BadVersion, $filename, $filename, $cvsversion{$filename},
  - 	       "older", $version, $filename);
  - 	return(1);
  -     }
  -     return(0);
  - }
  - 
  - #############################################################
  - #
  - # Main Body
  - #
  - ############################################################
  - 
  - $id = getpgrp();
  - #print("ARGV - ", join(":", @ARGV), "\n");
  - #print("id   - ", id, "\n");
  - 
  - #
  - # Suck in the Entries file
  - #
  - open(ENTRIES, $ENTRIES) || die("Cannot open $ENTRIES.\n");
  - while (<ENTRIES>) {
  -     local($filename, $version) = split('/', substr($_, 1));
  -     $cvsversion{$filename} = $version;
  - }
  - 
  - $directory = $ARGV[0];
  - shift @ARGV;
  - 
  - #
  - # Now check each file name passed in, except for dot files.  Dot files
  - # are considered to be administrative files by this script.
  - #
  - if ($check_id != 0) {
  -     $failed = 0;
  -     foreach $arg (@ARGV) {
  - 	next if (index($arg, ".") == 0);
  - 	$failed += &check_version($arg);
  -     }
  -     if ($failed) {
  - 	print "\n";
  - 	exit(1);
  -     }
  - }
  - 
    #
    # Record this directory as the last one checked.  This will be used
    # by the log_accumulate script to determine when it is processing
    # the final directory of a multi-directory commit.
    #
  ! if ($record_directory != 0) {
  !     &write_line("$LAST_FILE.$id", $directory);
  ! }
    exit(0);
  --- 2,33 ----
    #
    # Perl filter to handle pre-commit checking of files.  This program
    # records the last directory where commits will be taking place for
  ! # use by the log_accum.pl script.
    #
    # Contributed by David Hampton <ha...@cisco.com>
  ! # Stripped to minimum by Roy Fielding
    #
    ############################################################
  ! $TMPDIR        = $ENV{'TMPDIR'} || '/tmp';
  ! $FILE_PREFIX   = '#cvs.';
    
  ! $LAST_FILE     = "$TMPDIR/${FILE_PREFIX}lastdir"; # MUST match log_accum.pl
    
    sub write_line {
        local($filename, $line) = @_;
  ! 
  !     open(FILE, ">$filename") || die("Cannot open $filename: $!\n");
        print(FILE $line, "\n");
        close(FILE);
    }
    
    #
    # Record this directory as the last one checked.  This will be used
    # by the log_accumulate script to determine when it is processing
    # the final directory of a multi-directory commit.
    #
  ! $id = getpgrp();
  ! 
  ! &write_line("$LAST_FILE.$id", $ARGV[0]);
  ! 
    exit(0);
  
  
  
  1.27      +107 -166  CVSROOT/log_accum.pl
  
  Index: log_accum.pl
  ===================================================================
  RCS file: /export/home/cvs/CVSROOT/log_accum.pl,v
  retrieving revision 1.26
  retrieving revision 1.27
  diff -C3 -r1.26 -r1.27
  *** log_accum.pl	1997/06/26 14:39:08	1.26
  --- log_accum.pl	1997/06/26 16:32:19	1.27
  ***************
  *** 9,15 ****
    # names of the first and last commit directories in a temporary file.
    #
    # Contributed by David Hampton <ha...@cisco.com>
  ! #
    
    ############################################################
    #
  --- 9,15 ----
    # names of the first and last commit directories in a temporary file.
    #
    # Contributed by David Hampton <ha...@cisco.com>
  ! # Roy Fielding removed useless code and added log/mail of new files
    
    ############################################################
    #
  ***************
  *** 17,27 ****
    #
    ############################################################
    #
  - # Do cisco Systems, Inc. specific nonsense.
  - #
  - $cisco_systems = 0;
  - 
  - #
    # Where do you want the RCS ID and delta info?
    # 0 = none,
    # 1 = in mail only,
  --- 17,22 ----
  ***************
  *** 40,62 ****
    $STATE_REMOVED = 3;
    $STATE_LOG     = 4;
    
  ! $LAST_FILE     = "/tmp/##cvs.lastdir";
  ! $CHANGED_FILE  = "/tmp/#cvs.files.changed";
  ! $ADDED_FILE    = "/tmp/#cvs.files.added";
  ! $REMOVED_FILE  = "/tmp/#cvs.files.removed";
  ! $LOG_FILE      = "/tmp/#cvs.files.log";
  ! $BRANCH_FILE   = "/tmp/#cvs.files.branch";
  ! $SUMMARY_FILE  = "/tmp/#cvs.files.summary";
  ! $FILE_PREFIX   = "#cvs.files";
  ! 
  ! $CVSROOT       = "$ENV{'CVSROOT'}";
  ! 
  ! $AVAIL_FILE    = "$CVSROOT/CVSROOT/avail";
  ! $MAIL_FILE     = "/tmp/#cvs.mail";
  ! $VERSION_FILE  = "version";
  ! $TRUNKREV_FILE = "TrunkRev";
  ! #$CHANGES_FILE  = "Changes";
  ! #$CHANGES_TEMP  = "Changes.tmp";
    
    ############################################################
    #
  --- 35,54 ----
    $STATE_REMOVED = 3;
    $STATE_LOG     = 4;
    
  ! $TMPDIR        = $ENV{'TMPDIR'} || '/tmp';
  ! $FILE_PREFIX   = '#cvs.';
  ! 
  ! $LAST_FILE     = "$TMPDIR/${FILE_PREFIX}lastdir";
  ! $CHANGED_FILE  = "$TMPDIR/${FILE_PREFIX}files.changed";
  ! $ADDED_FILE    = "$TMPDIR/${FILE_PREFIX}files.added";
  ! $REMOVED_FILE  = "$TMPDIR/${FILE_PREFIX}files.removed";
  ! $LOG_FILE      = "$TMPDIR/${FILE_PREFIX}files.log";
  ! $BRANCH_FILE   = "$TMPDIR/${FILE_PREFIX}files.branch";
  ! $SUMMARY_FILE  = "$TMPDIR/${FILE_PREFIX}files.summary";
  ! 
  ! $CVSROOT       = $ENV{'CVSROOT'};
  ! 
  ! $MAIL_TO       = 'apache-cvs';
    
    ############################################################
    #
  ***************
  *** 67,72 ****
  --- 59,65 ----
    sub format_names {
        local($dir, @files) = @_;
        local(@lines);
  + 
        $lines[0] = sprintf(" %-08s", $dir);
        foreach $file (@files) {
    	if (length($lines[$#lines]) + length($file) > 60) {
  ***************
  *** 78,116 ****
    }
    
    sub cleanup_tmpfiles {
  !     local($all) = @_;
  !     local($wd, @files);
    
  !     $wd = `pwd`;
  !     chdir("/tmp");
  !     opendir(DIR, ".");
  !     if ($all == 1) {
  ! 	push(@files, grep(/$id$/, readdir(DIR)));
  ! 	push(@files, "$MAIL_FILE.$id.db") if (-e "$MAIL_FILE.$id.db");
  ! 	push(@files, "$MAIL_FILE.$id.dir") if (-e "$MAIL_FILE.$id.dir");
  ! 	push(@files, "$MAIL_FILE.$id.pag") if (-e "$MAIL_FILE.$id.pag");
  !     } else {
  ! 	push(@files, grep(/^$FILE_PREFIX.*$id$/, readdir(DIR)));
  !     }
        closedir(DIR);
        foreach (@files) {
  ! 	unlink $_;
        }
  -     chdir($wd);
    }
    
    sub write_logfile {
        local($filename, @lines) = @_;
  !     open(FILE, ">$filename") || die ("Cannot open log file $filename.\n");
        print(FILE join("\n", @lines), "\n");
        close(FILE);
    }
    
    sub append_to_file {
        local($filename, $dir, @files) = @_;
        if (@files) {
    	local(@lines) = &format_names($dir, @files);
  ! 	open(FILE, ">>$filename") || die ("Cannot open file $filename.\n");
    	print(FILE join("\n", @lines), "\n");
    	close(FILE);
        }
  --- 71,100 ----
    }
    
    sub cleanup_tmpfiles {
  !     local(@files);
    
  !     opendir(DIR, $TMPDIR);
  !     push(@files, grep(/^${FILE_PREFIX}.*\.${id}$/, readdir(DIR)));
        closedir(DIR);
        foreach (@files) {
  ! 	unlink "$TMPDIR/$_";
        }
    }
    
    sub write_logfile {
        local($filename, @lines) = @_;
  ! 
  !     open(FILE, ">$filename") || die ("Cannot open log file $filename: $!\n");
        print(FILE join("\n", @lines), "\n");
        close(FILE);
    }
    
    sub append_to_file {
        local($filename, $dir, @files) = @_;
  + 
        if (@files) {
    	local(@lines) = &format_names($dir, @files);
  ! 	open(FILE, ">>$filename") || die ("Cannot open file $filename: $!\n");
    	print(FILE join("\n", @lines), "\n");
    	close(FILE);
        }
  ***************
  *** 118,139 ****
    
    sub write_line {
        local($filename, $line) = @_;
  !     open(FILE, ">$filename") || die("Cannot open file $filename.\n");
        print(FILE $line, "\n");
        close(FILE);
    }
    
    sub append_line {
        local($filename, $line) = @_;
  !     open(FILE, ">>$filename") || die("Cannot open file $filename.\n");
        print(FILE $line, "\n");
        close(FILE);
    }
    
    sub read_line {
  -     local($line);
        local($filename) = @_;
  !     open(FILE, "<$filename") || die("Cannot open file $filename.\n");
        $line = <FILE>;
        close(FILE);
        chop($line);
  --- 102,126 ----
    
    sub write_line {
        local($filename, $line) = @_;
  ! 
  !     open(FILE, ">$filename") || die("Cannot open file $filename: $!\n");
        print(FILE $line, "\n");
        close(FILE);
    }
    
    sub append_line {
        local($filename, $line) = @_;
  ! 
  !     open(FILE, ">>$filename") || die("Cannot open file $filename: $!\n");
        print(FILE $line, "\n");
        close(FILE);
    }
    
    sub read_line {
        local($filename) = @_;
  !     local($line);
  ! 
  !     open(FILE, "<$filename") || die("Cannot open file $filename: $!\n");
        $line = <FILE>;
        close(FILE);
        chop($line);
  ***************
  *** 141,148 ****
    }
    
    sub read_file {
  -     local(@text);
        local($filename, $leader) = @_;
        open(FILE, "<$filename") || return ();
        while (<FILE>) {
    	chop;
  --- 128,136 ----
    }
    
    sub read_file {
        local($filename, $leader) = @_;
  +     local(@text) = ();
  + 
        open(FILE, "<$filename") || return ();
        while (<FILE>) {
    	chop;
  ***************
  *** 154,162 ****
    }
    
    sub read_logfile {
  -     local(@text);
        local($filename, $leader) = @_;
  !     open(FILE, "<$filename") || die ("Cannot open log file $filename.\n");
        while (<FILE>) {
    	chop;
    	push(@text, $leader.$_);
  --- 142,151 ----
    }
    
    sub read_logfile {
        local($filename, $leader) = @_;
  !     local(@text) = ();
  ! 
  !     open(FILE, "<$filename") || die ("Cannot open log file $filename: $!\n");
        while (<FILE>) {
    	chop;
    	push(@text, $leader.$_);
  ***************
  *** 214,338 ****
    	}
    
    	$diff = "\n\n";
  ! 	$prev_rev = $rev;
  ! 	$prev_rev =~ /(.*)\.([0-9]+$)/;
  ! 	$prev = $2 - 1;
  ! 	$prev_rev = $1 . "." .  $prev;
  ! #print STDERR "Rev: $rev, $1, $2,  $prev, $prev_rev\n";
  ! 	open(DIFF, "-|") || exec 'cvs', '-Qn', 'diff', '-C3', "-r$prev_rev", "-r$rev", $file;
  ! 	while (<DIFF>) {
    		$diff .= $_;
    	}
  - 	close(DIFF);
  - 	$diff .= "\n\n";
  - #print STDERR "Diff:\n $diff\n";
    
  ! 	&append_line($out, sprintf("%-9s%-12s%s%s", $rev, $delta, $rcsfile, $diff));
        }
    }
    
    
  - sub bump_version {
  -     local($trunkrev, $editnum, $version);
  - 
  -     $trunkrev = &read_line("$CVSROOT/$repository/$TRUNKREV_FILE");
  -     $editnum  = &read_line("$CVSROOT/$repository/$VERSION_FILE");
  -     &write_line("$CVSROOT/$repository/$VERSION_FILE", $editnum+1);
  -     $version = $trunkrev . "(" . $editnum . ")";
  - }
  - 
    sub build_header {
  -     local($version) = @_;
        local($header);
        delete $ENV{'TZ'};
        local($sec,$min,$hour,$mday,$mon,$year) = localtime(time);
  !     $version = '';
  !     $header = sprintf("%-8s  %s  %02d/%02d/%02d %02d:%02d:%02d",
  ! 		       $login, $version, $year%100, $mon+1, $mday,
    		       $hour, $min, $sec);
    }
    
    # !!! Mailing-list and history file mappings here !!!
  ! sub mlist_map {
  !     local($dir) = @_;		# perl warns about this....
       
  !     return 'cvs-CVSROOT'      if($dir =~ /^CVSROOT/);
  ! 
  !     return 'cvs-apache';
    }    
    
  ! sub do_changes_file {
  !     local($changes,$category);
  !     local(@text) = @_;
    
  -     $category = $mlist;
  -     $category =~ s/^cvs-//;
  -     
        $changes = "$CVSROOT/CVSROOT/commitlogs/$category";
    
  !     open(CHANGES, ">>$changes") || die("Cannot open $changes.\n");
  !     print(CHANGES join("\n", @text), "\n\n");
  !     close(CHANGES);
  ! }
  ! 
  ! sub do_avail_file {
  !     local($where) = @_;
  !     local($users,$repo,$who);
  ! 
  !     dbmopen(%MAILFILE, "$MAIL_FILE.$id", 0666);
  !     open(AVAIL, "<$AVAIL_FILE") || die("Cannot open $AVAIL_FILE.\n");
  !     while(<AVAIL>) {
  ! 	if(/^avail\|([^|]*)\|(.*)$/) {
  ! 	    $users = $1;
  ! 	    $repo = $2;
  ! 	    if(($where eq $repo) || ($where =~ /^$repo\//)) {
  ! 		foreach $who (split(/,/, $users)) {
  ! 		    $MAILFILE{$who} = 1;
  ! 		}
  ! 	    }
  ! 	} elsif(/^avail\|([^|]*)$/) {
  ! 	    foreach $who (split(/,/, $1)) {
  ! 		$MAILFILE{$who} = 1;
  ! 	    }
  ! 	}
        }
  -     close(AVAIL);
  -     dbmclose(%MAILFILE);
  - }
  - 
  - sub add_cc {
  -     local($who) = @_;
  - 
  -     # chop CC: and any leading space
  -     $who =~ s/^CC:[\s]+//i;	
  - 
  -     # re-quote it if possible..  I really don't want a rfc822 parser.. :-)
  -     $who =~ s/"//g;
  -     $who =~ s/^/"/;
  -     $who =~ s/$/"/;
  - 
  -     dbmopen(%MAILFILE, "$MAIL_FILE.$id", 0666);
  -     $MAILFILE{$who} = 1;
  -     dbmclose(%MAILFILE);
    }
    
  ! 
  ! sub mail_notification {
        local(@text) = @_;
  -     local($names);
  - #    local($mailing_lists); 
  - #    $committers = "CVS-committers"; 
  -     print "Mailing the commit message...\n";
  - #    dbmopen(MAILFILE, "$MAIL_FILE.$id", 0666);
  - #    $mailing_lists = join(' ', $mlist, $committers);
  - #    $names = join(" ", keys %MAILFILE) . " $mailing_lists";
  - #    $names =~ s,\n,,;
  - #    dbmclose(MAILFILE);
    
  ! # Just send everything to apache-cvs for now.
  ! 	$names = "apache-cvs";
    
  !     open(MAIL, "| mail -s \"cvs commit: $ARGV[0]\" $names");
        print(MAIL join("\n", @text));
        close(MAIL);
    }
  --- 203,279 ----
    	}
    
    	$diff = "\n\n";
  ! 
  ! 	if ($rev =~ /^(.*)\.([0-9]+)$/) {
  ! 	    $prev = $2 - 1;
  ! 	    $prev_rev = $1 . '.' .  $prev;
  ! 
  ! 	    if ($rev eq '1.1') {
  ! 	        open(DIFF, "-|") || exec 'cvs', '-Qn', 'update', '-p',
  ! 	                                 '-r1.1', $file;
  ! 	        $diff .= "Index: $file\n=================================="
  ! 	                 . "=================================\n";
  ! 	    }
  ! 	    else {
  ! 	        open(DIFF, "-|") || exec 'cvs', '-Qn', 'diff', '-C3',
  ! 	                                 "-r$prev_rev", "-r$rev", $file;
  ! 	    }
  ! 
  ! 	    while (<DIFF>) {
    		$diff .= $_;
  + 	    }
  + 	    close(DIFF);
  + 	    $diff .= "\n\n";
    	}
    
  ! 	&append_line($out, sprintf("%-9s%-12s%s%s", $rev, $delta,
  ! 	                                            $rcsfile, $diff));
        }
    }
    
    
    sub build_header {
        local($header);
        delete $ENV{'TZ'};
        local($sec,$min,$hour,$mday,$mon,$year) = localtime(time);
  ! 
  !     $header = sprintf("%-8s    %02d/%02d/%02d %02d:%02d:%02d",
  ! 		       $login, $year%100, $mon+1, $mday,
    		       $hour, $min, $sec);
    }
    
    # !!! Mailing-list and history file mappings here !!!
  ! sub mlist_map
  ! {
  !     local($path) = @_;
       
  !     if ($path =~ /^([^\/]+)/) { return $1; }
  !     else                      { return 'apache'; }
    }    
    
  ! sub do_changes_file
  ! {
  !     local($category, @text) = @_;
  !     local($changes);
    
        $changes = "$CVSROOT/CVSROOT/commitlogs/$category";
    
  !     if (open(CHANGES, ">>$changes")) {
  !         print(CHANGES join("\n", @text), "\n\n");
  !         close(CHANGES);
  !     }
  !     else { 
  !         warn "Cannot open $changes: $!\n";
        }
    }
    
  ! sub mail_notification
  ! {
        local(@text) = @_;
    
  !     print "Mailing the commit message...\n";
    
  !     open(MAIL, "| mail -s \"cvs commit: $ARGV[0]\" $MAIL_TO");
        print(MAIL join("\n", @text));
        close(MAIL);
    }
  ***************
  *** 342,347 ****
  --- 283,292 ----
    # Main Body
    #
    ############################################################
  + #
  + # Setup environment
  + #
  + umask (002);
    
    #
    # Initialize basic variables
  ***************
  *** 363,389 ****
    #print("dir   - ", $dir, "\n");
    #print("id    - ", $id, "\n");
    
    $mlist = &mlist_map($files[0]);
    
    #
    # Check for a new directory first.  This will always appear as a
    # single item in the argument list, and an empty log message.
    #
    if ($ARGV[0] =~ /New directory/) {
  !     $version = &bump_version if ($cisco_systems != 0);
  !     $header = &build_header($version);
        @text = ();
        push(@text, $header);
        push(@text, "");
        push(@text, "  ".$ARGV[0]);
  !     &do_changes_file(@text);
  !     &mail_notification(@text);
        exit 0;
    }
    
  - #no longer useful. the CC: line would be _too_ big.
  - #&do_avail_file($dir);
  - 
    #
    # Iterate over the body of the message collecting information.
    #
  --- 308,341 ----
    #print("dir   - ", $dir, "\n");
    #print("id    - ", $id, "\n");
    
  + #
  + # Map the repository directory to a name for commitlogs.
  + #
    $mlist = &mlist_map($files[0]);
    
  + ##########################
  + # Uncomment the following if we ever have per-repository cvs mail
  + #
  + # if (defined($mlist)) {
  + #     $MAIL_TO = $mlist . '-cvs';
  + # }
  + # else { undef $MAIL_TO; }
  + ##########################
    #
    # Check for a new directory first.  This will always appear as a
    # single item in the argument list, and an empty log message.
    #
    if ($ARGV[0] =~ /New directory/) {
  !     $header = &build_header;
        @text = ();
        push(@text, $header);
        push(@text, "");
        push(@text, "  ".$ARGV[0]);
  !     &do_changes_file($mlist, @text);
  !     &mail_notification(@text) if defined($MAIL_TO);
        exit 0;
    }
    
    #
    # Iterate over the body of the message collecting information.
    #
  ***************
  *** 404,419 ****
        push (@added_files,   split) if ($state == $STATE_ADDED);
        push (@removed_files, split) if ($state == $STATE_REMOVED);
        if ($state == $STATE_LOG) {
  ! 	if (/^Reviewed by:$/i ||
    	    /^Submitted by:$/i ||
    	    /^Obtained from:$/i) {
    	    next;
    	}
  - # Not accepted as generally useful yet.
  - #	if (/^CC:/i) {
  - #	    &add_cc($_);
  - #	    # next;	# uncomment this to prevent logging CC: lines
  - #	}
    	push (@log_lines,     $_);
        }
    }
  --- 356,367 ----
        push (@added_files,   split) if ($state == $STATE_ADDED);
        push (@removed_files, split) if ($state == $STATE_REMOVED);
        if ($state == $STATE_LOG) {
  ! 	if (/^PR:$/i ||
  ! 	    /^Reviewed by:$/i ||
    	    /^Submitted by:$/i ||
    	    /^Obtained from:$/i) {
    	    next;
    	}
    	push (@log_lines,     $_);
        }
    }
  ***************
  *** 457,463 ****
    &append_to_file("$CHANGED_FILE.$i.$id", $dir, @changed_files);
    &append_to_file("$REMOVED_FILE.$i.$id", $dir, @removed_files);
    if ($rcsidinfo) {
  !     &change_summary("$SUMMARY_FILE.$i.$id", @changed_files);
    }
    
    #
  --- 405,411 ----
    &append_to_file("$CHANGED_FILE.$i.$id", $dir, @changed_files);
    &append_to_file("$REMOVED_FILE.$i.$id", $dir, @removed_files);
    if ($rcsidinfo) {
  !     &change_summary("$SUMMARY_FILE.$i.$id", (@changed_files, @added_files));
    }
    
    #
  ***************
  *** 465,471 ****
    #
    if (-e "$LAST_FILE.$id") {
       $_ = &read_line("$LAST_FILE.$id");
  !    $tmpfiles=$files[0];
       $tmpfiles =~ s,([^a-zA-Z0-9_/]),\\$1,g;
       if (! grep(/$tmpfiles$/, $_)) {
    	print "More commits to come...\n";
  --- 413,419 ----
    #
    if (-e "$LAST_FILE.$id") {
       $_ = &read_line("$LAST_FILE.$id");
  !    $tmpfiles = $files[0];
       $tmpfiles =~ s,([^a-zA-Z0-9_/]),\\$1,g;
       if (! grep(/$tmpfiles$/, $_)) {
    	print "More commits to come...\n";
  ***************
  *** 478,487 ****
    # into a single message, fire a copy off to the mailing list, and drop
    # it on the end of the Changes file.
    #
  ! # Get the full version number
  ! #
  ! $version = &bump_version if ($cisco_systems != 0);
  ! $header = &build_header($version);
    
    #
    # Produce the final compilation of the log messages
  --- 426,432 ----
    # into a single message, fire a copy off to the mailing list, and drop
    # it on the end of the Changes file.
    #
  ! $header = &build_header;
    
    #
    # Produce the final compilation of the log messages
  ***************
  *** 506,519 ****
        }
        push(@text, "");
    }
  - if ($cisco_systems != 0) {
  -     @ddts = grep(/^CSCdi/, split(' ', join(" ", @text)));
  -     $text[0] .= "  " . join(" ", @ddts);
  - }
    #
  ! # Put the log message at the beginning of the Changes file
    #
  ! &do_changes_file(@text);
    #
    # Now generate the extra info for the mail message..
    #
  --- 451,460 ----
        }
        push(@text, "");
    }
    #
  ! # Append the log message to the commitlogs/<module> file
    #
  ! &do_changes_file($mlist, @text);
    #
    # Now generate the extra info for the mail message..
    #
  ***************
  *** 535,540 ****
    #
    # Mail out the notification.
    #
  ! &mail_notification(@text);
  ! &cleanup_tmpfiles(1);
    exit 0;
  --- 476,481 ----
    #
    # Mail out the notification.
    #
  ! &mail_notification(@text) if defined($MAIL_TO);
  ! &cleanup_tmpfiles;
    exit 0;
  
  
  
  1.2       +10 -6     CVSROOT/rcstemplate
  
  Index: rcstemplate
  ===================================================================
  RCS file: /export/home/cvs/CVSROOT/rcstemplate,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -C3 -r1.1 -r1.2
  *** rcstemplate	1996/01/14 16:08:21	1.1
  --- rcstemplate	1997/06/26 16:32:19	1.2
  ***************
  *** 1,15 ****
  ! Reviewed by:	
  ! Submitted by:	
    Obtained from:
    CVS: ----------------------------------------------------------------------
    CVS: Obtained from:
    CVS:   If this change has been taken from another system, such as NCSA,
    CVS:   then name the system in this line, otherwise delete it.
  - CVS: Reviewed by:
  - CVS:   Before committing changes please have someone check your work and
  - CVS:   include their name here. If the change is trivial and you have not
  - CVS:   had it reviewed then delete this line.
    CVS: Submitted by:
    CVS:   If this code has been contributed to Apache by someone else; i.e.,
    CVS:   they sent us a patch or a new module, then include their name/email
    CVS:   address here. If this is your work then delete this line.
  --- 1,19 ----
  ! PR:
    Obtained from:
  + Submitted by:	
  + Reviewed by:	
    CVS: ----------------------------------------------------------------------
  + CVS: PR:
  + CVS:   If this change addresses a PR in the problem report tracking
  + CVS:   database, then enter the PR number(s) here.
    CVS: Obtained from:
    CVS:   If this change has been taken from another system, such as NCSA,
    CVS:   then name the system in this line, otherwise delete it.
    CVS: Submitted by:
    CVS:   If this code has been contributed to Apache by someone else; i.e.,
    CVS:   they sent us a patch or a new module, then include their name/email
    CVS:   address here. If this is your work then delete this line.
  + CVS: Reviewed by:
  + CVS:   If we are doing pre-commit code reviews and someone else has
  + CVS:   reviewed your changes, include their name(s) here.
  + CVS:   If you have not had it reviewed then delete this line.
  
  
  

Re: cvs commit: CVSROOT commit_prep.pl log_accum.pl rcstemplate

Posted by Dean Gaudet <dg...@arctic.org>.
Hey can you fix the first-commit-on-a-branch bug?  It tries to get branch
rev a.b.c.-1 when it should just get a.b. 

Dean

On Thu, 26 Jun 1997, Roy Fielding wrote:

> fielding    97/06/26 09:32:20
> 
>   Modified:    .         commit_prep.pl log_accum.pl rcstemplate
>   Log:
>   Implemented logging/mail of new (Added) files with revision 1.1.
>   Removed the commit preparation and logging code having to do with
>   checking Id lines, since we can't use it (and its a bad idea anyway).
>   Cleaned up the perl code to be more robust and easier to maintain.
>   Added a PR: line to the template.