diff options
author | joe <joe@FreeBSD.org> | 2001-09-11 07:05:28 +0800 |
---|---|---|
committer | joe <joe@FreeBSD.org> | 2001-09-11 07:05:28 +0800 |
commit | a9a1afa039d1e8dd52661062e384983e5408e348 (patch) | |
tree | 875d47ffbb962450629274e0309e2d6ecb68ed68 /CVSROOT | |
parent | 36bc80400a0ffd4ffecf3417dcdfbfb4ffe4684f (diff) | |
download | freebsd-ports-gnome-a9a1afa039d1e8dd52661062e384983e5408e348.tar.gz freebsd-ports-gnome-a9a1afa039d1e8dd52661062e384983e5408e348.tar.zst freebsd-ports-gnome-a9a1afa039d1e8dd52661062e384983e5408e348.zip |
Delay the unexpanding of rcsids until after all the revision string
checks have been done.
Diffstat (limited to 'CVSROOT')
-rwxr-xr-x | CVSROOT/commit_prep.pl | 56 |
1 files changed, 34 insertions, 22 deletions
diff --git a/CVSROOT/commit_prep.pl b/CVSROOT/commit_prep.pl index c37baf0237c5..27d6bed31c93 100755 --- a/CVSROOT/commit_prep.pl +++ b/CVSROOT/commit_prep.pl @@ -98,25 +98,13 @@ sub write_line { close FILE; } -sub check_version { +# Check to see whether a file is mentioned in the exclusion file. +sub exclude_file { my $filename = shift; my $directory = shift; - my $hastag = shift; - my $lastversion = shift; - - my $found_rcsid; # True if our rcsid was found in the file. - my $rcsid; # The rcsid that was in the file. - my $rcsid_info; # The expanded values of the rcsid. - my $rname; # The file pathname, parsed from the rcsid. - my $version; # The file version, parsed from the rcsid. - # not present - either removed or let cvs deal with it. - return 0 unless -f $filename; - - # If an exclusion list exists use it to see whether this - # file should be exempt from version checking. - my $exclude = $cvsroot . "/CVSROOT/exclude"; - my $path = $directory . "/" . $filename; + my $exclude = "$cvsroot/CVSROOT/exclude"; + my $path = "$directory/$filename"; if (open(EX, "<$exclude")) { while (<EX>) { chomp; @@ -126,12 +114,31 @@ sub check_version { if ($path =~ /$ex_entry/) { close(EX); - return(0); + return(1); } } close(EX); } + # File shouldn't be excluded. + return(0); +} + +sub check_version { + my $filename = shift; + my $directory = shift; + my $hastag = shift; + my $lastversion = shift; + + my $found_rcsid; # True if our rcsid was found in the file. + my $rcsid; # The rcsid that was in the file. + my $rcsid_info; # The expanded values of the rcsid. + my $rname; # The file pathname, parsed from the rcsid. + my $version; # The file version, parsed from the rcsid. + + # not present - either removed or let cvs deal with it. + return 0 unless -f $filename; + # Search the file for our rcsid. # NOTE: We stop after finding the first potential match. open FILE, $filename or die "Cannot open $filename, stopped\n"; @@ -158,11 +165,6 @@ sub check_version { $rcsid_info = $2 || ""; ($rname, $version) = split /\s/, $rcsid_info; - # Now that we're definitely sure that the file was supposed - # to have rcsid's in it, unexpand them in the file that's - # being checked in. - fix_up_file($filename) if $cfg::UNEXPAND_RCSID; - # Ignore version mismatches (MFC spamming etc) on branches. if ($hastag) { return (0); @@ -294,8 +296,18 @@ if ($check_id != 0) { next if (index($arg, ".") == 0); next if ($check_id == 2 && $arg ne "Makefile"); next if ($check_id == 3 && $hastag); + + # Ignore the file if it's in the exclude list. + next if exclude_file($arg, $directory); + + # Check to make sure that the file hasn't had + # it's revision string changed. $failed += &check_version($arg, $directory, $hastag, $cvsversion{$arg}); + + # Unexpand the rcsid if required. + fix_up_file($arg) if $cfg::UNEXPAND_RCSID and !$failed; + } if ($failed) { print "\n"; |