4 # Perl filter to handle pre-commit checking of files. This program
5 # records the last directory where commits will be taking place for
6 # use by the log_accum.pl script.
8 # IMPORTANT: this script interacts with log_accum, they have to agree
9 # on the tmpfile name to use. See $LAST_FILE below.
11 # Contributed by David Hampton <hampton@cisco.com>
12 # Stripped to minimum by Roy Fielding
14 ############################################################
15 $TMPDIR = $ENV{'TMPDIR'} || '/tmp';
16 $FILE_PREFIX = '#cvs.';
18 # If see a "-u $USER" argument, then destructively remove it from the
19 # argument list, so $ARGV[0] will be the repository dir again, as it
20 # used to be before we added the -u flag.
21 if ($ARGV[0] eq '-u') {
23 $CVS_USERNAME = shift (@ARGV);
26 # This needs to match the corresponding var in log_accum.pl, including
27 # the appending of the pgrp and username suffixes (see uses of this
29 $LAST_FILE = "$TMPDIR/${FILE_PREFIX}lastdir";
32 my ($filename, $line) = @_;
34 # A check of some kind is needed here, but the rules aren't apparent
37 # foreach($filename, $line){
38 # $_ =~ m#^([-\@\w.\#]+)$#;
42 open(FILE, ">$filename") || die("Cannot open $filename: $!\n");
43 print(FILE $line, "\n");
48 # Record this directory as the last one checked. This will be used
49 # by the log_accumulate script to determine when it is processing
50 # the final directory of a multi-directory commit.
54 &write_line("$LAST_FILE.$id.$CVS_USERNAME", $ARGV[0]);