[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: Commit log templates

From: Bart Robinson <lomew_at_pobox.com>
Date: 2006-08-26 01:47:44 CEST

On 2006-8-14 Garrett Rooney <rooneg@electricjellyfish.net> wrote:
> On 8/14/06, Irvine, Chuck R [LTD] <Chuck.R.Irvine@embarq.com> wrote:
> > We consider the ability to have commit log templates (something similar
> > to the CVS rcsinfo mechanism) a requirement really. I searched the
> > mailing list archives and found that there was past discussion on adding
> > this functionality and what the design would look like. Is this
> > functionality in the latest version of subversion or is it targeted to
> > an upcoming release? Thanks -Chuck
>
> There are various people who have talked about working on it, but
> AFAIK nobody is currently working on it.

A workaround is to make use of the SVN_EDITOR env var. This
would of course require client-side configuration (at this point
providing a custom built svn with your log message hardcoded is
also an option).

Here is an SVN_EDITOR script for Unix-like environments that
might work for you:

---------------------------------------------------------------------
#!/bin/sh
#
# Example SVN_EDITOR script
#

[ $# -eq 1 ] || {
    echo "usage: $0 file"
    exit 1
}
file=$1

ed=$VISUAL
[ -z $ed ] && ed=$EDITOR
[ -z $ed ] && ed=vi

cat <<ENDTEMPLATE >$file.$$
BugId:
Approved-By:
ENDTEMPLATE

cat $file >> $file.$$

sum=`cksum $file.$$`
if $ed $file.$$; then
    newsum=`cksum $file.$$`
    if [ "$newsum" != "$sum" ]; then
        rm -f $file
        mv $file.$$ $file
    else
        # no changes
        rm -f $file.$$
    fi
else
    echo "editor \"$ed\" failed"
    exit 1
fi
---------------------------------------------------------------------

You could then check the format of log messages in the
pre-commit hook, and if they are wrong the stderr can instruct
them how to properly configure their client, e.g.:

------ in pre-commit ------------------------------------------------
# Make sure they used the template
if $SVNLOOK dirs-changed -t "$TXN" "$REPOS" | grep /project-foo/; then
  $SVNLOOK log -t "$TXN" "$REPOS" | grep "^BugId:" > /dev/null || {
    echo "*** Please configure your client to use the log message template" >&2
    echo "*** Instructions are here: http://foo" >&2
    exit 1
  }
fi
---------------------------------------------------------------------

-- bart

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Received on Sat Aug 26 01:48:49 2006

This is an archived mail posted to the Subversion Users mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.