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

Re: Diffs into default log template

From: Julian Foad <julianfoad_at_btopenworld.com>
Date: 2004-10-12 14:55:55 CEST

Chris Pepper wrote:
> The default log "template" provided by "svn commit", listing files
> that are changed for review is quite useful. It would be even more
> useful if it showed the actual diffs about to be applied, so I could
> make sure my log message is complete and in sync with what I'm about to
> actually commit.
> Is there a way to accomplish this?

I create my log message like this:

svnlogmsg | vim -

where 'svnlogmsg' is a script I wrote (attached) to write the diff and also write the names of files and functions changed, in the format specified in HACKING; and 'vim -' invokes my editor starting with text read from standard input.

I do this before issuing an 'svn commit', because there is usually something I want to check or change before finally committing it, but if you want this sort or thing to be invoked by 'svn commit' as a log message editor, I'm sure you can easily modify it into a suitable form.

'svnlogmsg' takes an optional list of paths, just as 'svn diff' does.

'svnlogmsg' uses GNU 'diff -p' to find the names of functions, and the result is not accurate - but it gets most of the right symbols most of the time and provides a reasonable starting point.

- Julian

# Write a log message template, listing the files that would be committed.
FILES=`svn st "$@" | grep "^[^?]" | sed 's/^.......//' | sort`
for FILE in $FILES; do
  echo "* $FILE"
  # Find the names of the functions affected, and list them in parentheses.
  svn diff --diff-cmd diff -x -up $FILE | sed -e "s/^@@ [^@]* @@ .*\<\([A-Za-z_][A-Za-z0-9_]*\) *(.*/ (\1): /" -e "t" -e "d" | uniq
# (when in sorted order) svn diff -x -up "$@"
for FILE in $FILES; do
  svn diff --diff-cmd diff -x -up $FILE

To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Tue Oct 12 15:01:14 2004

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

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