aboutsummaryrefslogtreecommitdiffstats
path: root/CVSROOT
diff options
context:
space:
mode:
authorpeter <peter@FreeBSD.org>1997-06-08 10:18:37 +0800
committerpeter <peter@FreeBSD.org>1997-06-08 10:18:37 +0800
commitd5b9d15e309a7ac2b8fa870997f45db0b9012b24 (patch)
treeb907bec3f74d13c16f301a0a65cf77b2e59ce643 /CVSROOT
parent204e38fe874e71ca41af9209aa65d0ed75fafe2f (diff)
downloadfreebsd-ports-graphics-d5b9d15e309a7ac2b8fa870997f45db0b9012b24.tar.gz
freebsd-ports-graphics-d5b9d15e309a7ac2b8fa870997f45db0b9012b24.tar.zst
freebsd-ports-graphics-d5b9d15e309a7ac2b8fa870997f45db0b9012b24.zip
Checkin of eventual replacement for the editinfo stuff. This will be run
from the verifymsg hook to clean the log message on all commits including remote ones, cvs commit -m 'msg' and cvs commit -F msgfile, rather than just local commits on freefall with the editor.
Diffstat (limited to 'CVSROOT')
-rwxr-xr-xCVSROOT/logcheck71
1 files changed, 71 insertions, 0 deletions
diff --git a/CVSROOT/logcheck b/CVSROOT/logcheck
new file mode 100755
index 00000000000..eaa9cdf8294
--- /dev/null
+++ b/CVSROOT/logcheck
@@ -0,0 +1,71 @@
+#! /usr/bin/perl
+#
+# $Id$
+#
+# This hack is to sanitise the results of what the user may have
+# "done" while editing the commit log message.. :-) Peter Wemm.
+#
+# Note: this uses an enhancement to cvs's verifymsg functionality.
+# Normally, the check is advisory only, the FreeBSD version reads
+# back the file after the verifymsg file so that this script can
+# can make changes.
+#
+
+if (!@ARGV) {
+ die "Usage: logcheck filename\n";
+}
+$filename = $ARGV[0];
+$tmpfile = $filename . "tmp";
+
+open(IN, "< $filename") ||
+ die "cvsedit: Cannot open for reading: $filename: $!\n";
+
+open(OUT, "> $tmpfile") ||
+ die "cvsedit: Cannot open for writing: $tmpfile: $!\n";
+
+# In-place edit the result of the user's edit on the file.
+$blank = 0; # true if the last line was blank
+$first = 0; # true if we have seen the first real text
+while(<IN>) {
+
+ # Dont let CVS: lines upset things, strip them out.
+ if (/^CVS:/) {
+ next;
+ }
+
+ chop; # strip trailing newline
+ s/[\s]+$//; # strip trailing whitespace
+
+ # collapse multiple blank lines, and trailing blank lines.
+ if (/^$/) {
+ # Blank line. Remember in case more text follows.
+ $blank = 1;
+ next;
+ } else {
+ # Delete if they only have whitespace after them.
+ if (/^Reviewed by:$/i ||
+ /^Submitted by:$/i ||
+ /^Obtained from:$/i ||
+ /^PR:$/i) {
+ next;
+ }
+ if ($blank && $first) {
+ # Previous line(s) was blank, this isn't. Close the
+ # collapsed section.
+ print OUT "\n";
+ }
+ $blank = 0; # record non-blank
+ $first = 1; # record first line
+ print OUT "$_\n";
+ }
+}
+close(IN);
+close(OUT);
+
+unlink($filename . "~"); # Nuke likely editor backups..
+unlink($filename . ".bak"); # Nuke likely editor backups..
+
+rename("$tmpfile", "$filename") ||
+ die("logcheck: Could not rename $tmpfile to $filename: $!");
+
+exit(0);