How-to Open Source

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:

# Begin configuration
recipients="user1@example.com user2@example.com"
# End configuration

repos="`cd $1 && pwd`"
user="${3:-repo admin}"

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

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

Schreibe einen Kommentar

Diese Website verwendet Akismet, um Spam zu reduzieren. Erfahre mehr darüber, wie deine Kommentardaten verarbeitet werden.