[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-19 17:35:33 CEST

Chris Pepper wrote:
> At 3:23 PM +0100 2004/10/14, Julian Foad wrote:
>> I'm sure some people would find it of some utility, but the trouble is
>> that the more "svn" tries to write your log message for you, the less
>> people it will satisfy - either that, or it grows lots of options and
>> configurability and becomes a generic log message writer trying to
>> suit everybody.
> No, actually. I'm not asking for any changes to the default log
> message itself, which would remain blank. Instead I'm asking for an
> enhancement to the 'comment' area, below "--This line, and those below,
> will be ignored--", which would not show up in the log message, to help
> *humans* write log messages.

I understand that. When I said "log message" I meant "log message

> It's my belief that more context here will encourage people to
> confirm they're committing what they think, and make oversights in the
> commit messages less likely.

I agree with you on that point. That is why I usually append a diff to
my log message template myself, but often I prefer to use a side-by-side
diff in a separate window in my editor. In addition to the diff, I like
to automatically list the names of the files and functions affected, in
the format chosen by the Subversion team for its log messages. When
working on different projects I would like to list this information in a
different form. If the diff is going to run to many megabytes then I
don't append it to my log message template at all, but find some other
way of reviewing it before or while writing the log message.

I have the flexibility to choose these sorts of options, and if we were
to make "svn" append a diff it would need to have at least some of this
flexibility. I believe that this kind of feature is ideally suited to
being implemented in a GUI or as an external program or wrapper script,
and that it is not essential to the core purpose of the Subversion
command-line client. This is partly because the scope of the feature is
not clearly defined and is subject to many subjective decisions. What
if the diff is "too big"? How does the user specify a different diff
program, or options to it? Well, that is what the "svn diff" command is
for. The user should run "svn diff" to get the diff. You can run it
from within your editor if your editor lets you. (Somebody earlier
replied that in "vim" you can simply type ":r !svn diff" to append a
diff to your file.)

On the other hand, on the subject of scripting...

It is wrong for us to tell users, "Oh, you can do that by writing a
script." Especially when we haven't tried it and so haven't realised
how difficult it is. We should take responsibility for providing such
scripts when they are generally useful, like we provide some sample
repository hook scripts.

>> I recommend writing an external log-message-generator [...]
> Ugh. I'd have to start by patching the C code, [...]

I tried to write what you wanted as an SVN_EDITOR script, and found that
it's difficult or impossible in the general case to get the correct set
of diffs from the information provided in the default log message
template. One reason is that "svn diff" lacks a "--depth=0" mode for
diffing the directories.

However, it is quite easy to get what you want by using a wrapper around
"svn" in conjunction with an editor wrapper. How about something like this?

~/tmp/sandbox> cat ~/bin/svn-commit
svn diff "$@" > tmpdiff.txt
svn commit --editor-cmd=~/bin/svn-editor "$@"
~/tmp/sandbox> cat ~/bin/svneditor
cat tmpdiff.txt >> "$1"
vim "$1"
~/tmp/sandbox> svn-commit ...

Does this do what you want? If you insist that the command be "svn
commit" instead of "svn-commit", then write a script called "svn" that
calls the real "svn" unless the command is "commit". If you want it to
be installed and activated by default for your users, I'm sure we can
work out a way to make that happen. (Sorry if I'm sounding belligerent

I wonder if this is the heart of the matter: it is not just that you
want to have a way to review diffs while writing a log message, but that
you want to encourage all users to do this. Maybe we need to think more
broadly about ways to achieve this.

- Julian

To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Tue Oct 19 17:36:08 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.