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

Re: 'svn log --diff' foils log output parsers

From: Stefan Sperling <stsp_at_elego.de>
Date: Thu, 23 Jun 2011 22:22:32 +0200

On Thu, Jun 23, 2011 at 03:32:37PM -0400, C. Michael Pilato wrote:
> On 06/23/2011 03:18 PM, Mark Phippard wrote:
> > Why do we have to do anything? There is no danger of breaking
> > existing scripts here because this requires adding an additional
> > option. Do we just feel like it would be impossible to parse the
> > current output? Can't --xml be used?
>
> The current output will have to be ... more heuristically parsed, yes. (You
> could look for a line of 72 hyphens followed by a line that begins with 'r',
> I suppose.) --xml is an option, always, but a bit like using a Buick to
> swat a fly for most folks.
>
> But as you've noted, the *default* output of 'svn log' and 'svn log -v'
> haven't changed, so maybe that's all we need to care about. And the log
> line count is still accurate in the --diff case, if not altogether as
> useful. So if the community thinks this is a non-issue, that's fine -- I
> don't feel strongly enough about it to hang on it.

I see your concern.

But I'd like to note that the --diff option is intended to address
a particular use case. It was added for human consumption (code review).
So you can do 'svn log -r{"one week ago"} --diff' to catch up with
what's been happening while you were out camping in the woods, instead
of having to switch between 'svn log' and 'svn diff' all the time.

That's also why 'svn log --diff' does not support all options that
'svn diff' supports. It purposefully hardcodes some options in a way
that keeps the output short. E.g. it always sets --no-diff-deleted.

As you've noted, parsers that really care about parsing individual log
messages from the output can simply omit the --diff option.
Such tools are going to do some post-processing on the log messages
anyway, and most likely won't care about the diffs. And if they do,
they should be invoking 'svn diff' as well as 'svn log'.

They could also be adjusted to treat the diff as noise, and look for
a next "log header" line that says how many valid lines of log message
will follow. But I think parsing 'svn log' and 'svn diff' output
separately would be easier.
Received on 2011-06-23 22:23:14 CEST

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.