svn log message updating script


Subversion logoHere is a simple script to allow updating your Subversion commit messages and have the repository admins receive a nice email message with the change.Put the following into the file hooks/pre-revprop-change in your repository (on the server) and chmod 755:

#!/bin/sh
# Begin configuration
recipients="user1@example.com user2@example.com"
# End configuration

repos="`cd $1 && pwd`"
rev="$2"
user="${3:-repo admin}"
propname="$4"
action="$5"

if [ "$action" = "M" -a "$propname" = "svn:log" ]; then
  (echo "Updated from"
   echo "============"
   svnlook propget --revprop "$repos" -r "$rev" "$propname"
   echo ""
   echo "Updated to"
   echo "=========="
   cat
  ) | Mail -s "[svn:$repos] $user updated svn:log for revision $rev" $recipients
  exit 0
fi

echo "Changing revision properties other than svn:log is prohibited" >&2
exit 1

This is adapted from the hook template created as part of the repository. Feel free to adapt it to your needs.

Then, on your next (as admin on the server)

svnadmin setlog /path/to/repository -r 123 /path/to/new/log

or (as user in the working directory)

svn propedit -r 123 --revprop svn:log .

the users listed in the $recipient variable will receive a mail such as:

From: admin@example.org
To: user1@example.org, user2@example.org
Subject: [svn:/path/to/repos] joe.user updated svn:log for revision 123

Updated from
============
This was the old log message

Updated to
==========
This is the new log message
,

Let’s stay in touch!

Receive a mail whenever I publish a new post.

About 1-2 Mails per month, no Spam.

Follow me on the Fediverse

Web apps


Leave a Reply

Only people in my network can comment.

This site uses Akismet to reduce spam. Learn how your comment data is processed.