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

'svn log --diff' foils log output parsers

From: C. Michael Pilato <cmpilato_at_collab.net>
Date: Thu, 23 Jun 2011 15:15:08 -0400

When we designed 'svn log' many moons ago, we added the "N lines" header
information to aid parsers of the output. Most of us had had poor
experiences with parsers looking for sentinel lines which could themselves
appear inside the delimited content. We didn't want to see folks writing
scripts around 'svn log' and trying to look for lines consisting of 72
hyphens, only to croak the first time someone's log message had -- you
guessed it -- a line with 72 hyphens in it. So, we provided the log message
line count. Parsers reader the header line, read any non-empty lines that
follow the header line, skip the first non-empty line, and then parse the
number of lines in the line count. Done deal.

With the introduction of the --diff option, this algorithm goes to pot.
Parsers can't even fall back to looking for a separator line after the log
message, because the diff *could* carry the removal of a line with 71
hyphens in it (which is, of course, represented as a minus/hyphen followed
by 71 more of them).

We discussed in IRC some solutions:

  - spool the diff, count the lines in it, and provide that count in
    some fashion
  - indent the diff by a single column
  - wrap the whole diff in some start/end markers ("[[[" and "]]]", e.g.)

Keep in mind that the diff itself might be provided by a third-party tool
('svn log --diff --diff-cmd /usr/bin/shoot myfoot", as danielsh so
eloquently put it).


C. Michael Pilato <cmpilato_at_collab.net>
CollabNet   <>   www.collab.net   <>   Distributed Development On Demand

Received on 2011-06-23 21:15:42 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.