diff options
author | joe <joe@FreeBSD.org> | 2001-09-08 02:11:35 +0000 |
---|---|---|
committer | joe <joe@FreeBSD.org> | 2001-09-08 02:11:35 +0000 |
commit | a1bb03a63440878abb92e20895b4de31c3a68b6f (patch) | |
tree | 5b51cb863cc93d006c88b60385567af4cd36f7a2 /CVSROOT/commit_prep.pl | |
parent | f0637c9a3553c3b3a4acb1801e78ec865456faf9 (diff) | |
download | FreeBSD-ports-a1bb03a63440878abb92e20895b4de31c3a68b6f.zip FreeBSD-ports-a1bb03a63440878abb92e20895b4de31c3a68b6f.tar.gz |
Add code to unexpand $FreeBSD: xxxx $ (or whatever is defined in
the config file as being our $IDHEADER$) upon commit. This is useful
to avoid a '+1 -1' delta against the version string.
(Tested with both local and remote commits).
Diffstat (limited to 'CVSROOT/commit_prep.pl')
-rwxr-xr-x | CVSROOT/commit_prep.pl | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/CVSROOT/commit_prep.pl b/CVSROOT/commit_prep.pl index a12ef60..c37baf0 100755 --- a/CVSROOT/commit_prep.pl +++ b/CVSROOT/commit_prep.pl @@ -158,6 +158,11 @@ 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); @@ -206,6 +211,29 @@ sub check_version { return(0); } + +# Do file fixups, i.e. replacing $ Id: .* $ with $ Id $. +sub fix_up_file { + my $filename = shift; + + open F, "< $filename" or die "Can't open $filename!\n"; + my @file = <F>; + close F; + + open F, "> $filename.tmp" or die "Can't create $filename tmpfile!\n"; + while (@file) { + my $line = shift @file; + + $line =~ s/\$$HEADER:.*?\$/\$$HEADER\$/g; + print F $line or die "Out of disk space?\n"; + } + close F; + + # overwrite the original file...... + system("/bin/mv", "$filename.tmp", $filename); + die "Can't recreate $filename!\n" if $? >> 8; +} + ############################################################# # # Main Body |