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

RE: Re: Commit log templates

From: Bart Robinson <lomew_at_pobox.com>
Date: 2006-08-28 22:12:03 CEST

On 2006-8-28 Chris.Fouts@qimonda.com wrote:
> Bart, we're trying something similar, but using Perl scripts
> that has a "built-in" template. However, users will have to
> use the Perl scripts. Your way however, seems to be more
> generic so I'd like to pursue it. Some questions though...
>
> - I assume I'll have a script, say svnlog.sh, that contains
> the code you provided correct? This will reside on the
> server side or client side?

The script needs to be runnable from wherever clients do
commits. The server side would not need any modifications. The
script assumes a Unix-like environment. For Windows users you
may have to provide something different, although Cygwin might
be an option.

> - Will I have to set my SVN_EDITOR to this script, ie,
> setenv SVN_EDITOR svnlog.sh?

Yep.

> - In your pre-commit, is /project-foo/ just a stand-in
> for a real project, so one can use say $project for it?

That is just to restrict the template-enforcement to a
particular project (or branch of a project, etc). If you want
it to apply to the whole repository you can of course remove the
svnlook check.

-- bart

>
> -chris
>
> >-----Original Message-----
> >From: Bart Robinson [mailto:lomew@pobox.com]
> >Sent: Friday, August 25, 2006 7:48 PM
> >To: Garrett Rooney
> >Cc: Irvine, Chuck R [LTD]; users@subversion.tigris.org
> >Subject: Re: Commit log templates
> >
> >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 Mon Aug 28 22:13:43 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.