blob: b5f73ac87e1973629781e48b8840f0b18e287ed4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
#! @PERL@
# -*-Perl-*-
#
# 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.
#
# IMPORTANT: this script interacts with log_accum, they have to agree
# on the tmpfile name to use. See $LAST_FILE below.
#
# Contributed by David Hampton <hampton@cisco.com>
# Stripped to minimum by Roy Fielding
#
############################################################
$TMPDIR = $ENV{'TMPDIR'} || '/tmp';
$FILE_PREFIX = '#cvs.';
# If see a "-u $USER" argument, then destructively remove it from the
# argument list, so $ARGV[0] will be the repository dir again, as it
# used to be before we added the -u flag.
if ($ARGV[0] eq '-u') {
shift @ARGV;
$CVS_USERNAME = shift (@ARGV);
}
# This needs to match the corresponding var in log_accum.pl, including
# the appending of the pgrp and username suffixes (see uses of this
# var farther down).
$LAST_FILE = "$TMPDIR/${FILE_PREFIX}lastdir";
sub write_line {
my ($filename, $line) = @_;
# A check of some kind is needed here, but the rules aren't apparent
# at the moment:
# foreach($filename, $line){
# $_ =~ m#^([-\@\w.\#]+)$#;
# $_ = $1;
# }
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.$CVS_USERNAME", $ARGV[0]);
exit(0);
|