Page MenuHomeFreeBSD

D9893.diff
No OneTemporary

D9893.diff

Index: svnadmin/hooks/pre-commit
===================================================================
--- svnadmin/hooks/pre-commit
+++ svnadmin/hooks/pre-commit
@@ -116,6 +116,9 @@
# fix log message.
log-police.py -t "$TXN" "$REPO" || exit 1
+# catch some gross violations of commit template mangling.
+stomp_bad_formatting.pl "$REPO" "$TXN" || exit 1
+
# Nothing else, go ahead.
exit 0
Index: svnadmin/hooks/scripts/stomp_bad_formatting.pl
===================================================================
--- svnadmin/hooks/scripts/stomp_bad_formatting.pl
+++ svnadmin/hooks/scripts/stomp_bad_formatting.pl
@@ -0,0 +1,54 @@
+#!/usr/bin/perl -w
+#
+# $FreeBSD$
+
+use strict;
+my $debug = 0;
+
+# $ svnlook changed /home/svnmirror/base -r 12348
+# UU head/sbin/mountd/mountd.c
+# UU head/usr.sbin/mountd/mountd.c
+# $ svnlook log /home/svnmirror/base -r 12348
+# Avoid bogus free() of a junk pointer.
+#
+# Detected by: phkmalloc
+# Submitted by: grog@lemis.de (Greg Lehey)
+#
+# Except that when called to vette a commit, it'll be "-t txn", not "-r rev"
+
+
+my $repo = $ARGV[0];
+my $txn = $ARGV[1];
+
+my $log = "";
+
+open(LOG, "svnlook log $repo -t $txn |") || die "cannot open svnlook log: $!";
+foreach (<LOG>) {
+ print "$$: log: $_" if ($debug);
+ $log .= $_;
+}
+close(LOG);
+
+if (stomp_bad_formatting($log)) {
+ exit 1;
+}
+exit 0;
+
+# ============================================================
+# Look for a few specific mangled/broken template cases as a
+# stopgap for checking for a proper template.
+
+sub stomp_bad_formatting {
+ my ($log) = @_;
+ my $rv = 0;
+ if ($log =~ m|\n\nReviewers:[\t ]+|s) {
+ printf STDERR "**** Non-standard/badly formatted template - found 'Reviewers:' instead of 'Reviewed by:'.\n";
+ $rv = 1;
+ }
+ # There is really no need for this spam in log messages.
+ if ($log =~ m|\n\nSubscribers:[\t ]+|s) {
+ printf STDERR "**** Non-standard/badly formatted template - found 'Subscribers:'.\n";
+ $rv = 1;
+ }
+ $rv;
+}

File Metadata

Mime Type
text/plain
Expires
Wed, Nov 26, 3:07 AM (7 h, 27 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
26172735
Default Alt Text
D9893.diff (1 KB)

Event Timeline