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

Diff of property mods: better format?

From: Giovanni Bajo <rasky_at_develer.com>
Date: 2006-05-31 19:12:53 CEST

Hello,

the current format used by "svn diff" to show property modifications suffers
from the problem of being unparsable for a computer. For instance:

Property changes on: .
___________________________________________________________________
Name: svn:ignore
   - Debug
Release

   + Debug
Release
foo

Notice how it's programatically impossible to understand when the "old"
version ends and begins the new version. If you match against " +", you can
get false positives.

GNU diff (and many other textual formats, like YAML, or the RFC for e-mail
headers) uses a very simple convention when quoting arbitrary portions of
texts which may contain newlines: they prepend to each line a fixed number
of whitespaces (eg: 2 on a standard unified/context diff; 1 tab on a line
continuation of a long e-mail header). In our case, the output could become
something like:

Property changes on: .
___________________________________________________________________
- Debug
  Release

+ Debug
  Release
  foo

Notice how it's now clear how to parse this piece of code: it's sufficient
to fetch the first line (which begins with either "+ " or "- ") and then
keep fetching all the lines which begins with two whitespaces. When you hit
a line which is either empty, or begins with something else, you're sure
you're done.

Of course, there's also the question on why we couldn't output a better
unified-like diff:

Property changes on: .
___________________________________________________________________
Name: svn:ignore
  Debug
- Release
+ foo

but I guess this is for another day.

-- 
Giovanni Bajo
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Wed May 31 19:22:11 2006

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.