svn commit: r266966 - svnadmin/hooks/scripts

Peter Wemm peter at FreeBSD.org
Mon Jun 2 06:08:10 UTC 2014


Author: peter
Date: Mon Jun  2 06:08:09 2014
New Revision: 266966
URL: http://svnweb.freebsd.org/changeset/base/266966

Log:
  Add initial post-commit -> bugzilla hook

Added:
  svnadmin/hooks/scripts/notify_bz.sh   (contents, props changed)

Added: svnadmin/hooks/scripts/notify_bz.sh
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ svnadmin/hooks/scripts/notify_bz.sh	Mon Jun  2 06:08:09 2014	(r266966)
@@ -0,0 +1,39 @@
+#! /bin/sh
+# $FreeBSD$
+
+TZ=UTC
+export TZ
+
+REPO="$1"
+REV="$2"
+
+if [ -z "$REV" -o -z "$REPO" -o ! -d "$REPO" ]; then
+  echo "Bad args: repo rev" 1>&2
+  exit 1
+fi
+
+PR="$(svnlook info "$REPO" -r "$REV" | sed -nE -e 's/^[ 	]*[pP][rR]:[ 	]*[a-zA-Z]+\/([0-9]+)/\1/p' -e 's/^[ 	]*[pP][rR]:[ 	]*([0-9]+)/\1/p')"
+
+if [ -z "$PR" ]; then
+  exit 0
+fi
+WHO="$(svnlook author "$REPO" -r "$REV")"
+
+(
+echo "From: commit-hook at freebsd.org"
+echo "To: notify-bz at freebsd.org"
+echo "Subject: [Bug $PR]"
+echo ""
+echo "A commit references this bug:"
+echo ""
+echo "Author: $WHO"
+echo "Date: $(date)"
+echo "New revision: $REV"
+echo "URL: http://svnweb.freebsd.org/changeset/base/$REV"
+echo ""
+echo "Log:"
+svnlook log "$REPO" -r "$REV" | sed -e 's/^/  /'
+echo ""
+echo "Changes:"
+svnlook changed "$REPO" -r "$REV" | sed -E -e 's/^[A-Z]*[ 	]+/  /'
+) | sed -e 's/^[ 	]*$//' | cat -s | /usr/sbin/sendmail -oi -f commit-hook at freebsd.org notify-bz at freebsd.org


More information about the svn-src-svnadmin mailing list