[darcs-users] GUI

Thomas Zander zander at kde.org
Thu Dec 16 10:15:45 UTC 2004


On Thursday 16 December 2004 07:32, Michael Conrad wrote:
> On Wed, Dec 15, 2004 at 07:35:17PM -0500, David Roundy wrote:
> > XML output from whatsnew is essentially equivalent to an alternative
> > format for darcs patches.  If we added XML output, it would also seem
> > nice to make darcs also able to parse XML patch files.  Probably this
> > would be slow enough that it couldn't replace the existing patch
> > format, but I'm not sure.  In any case, this would be a big enough
> > quantity of code (especially if we supported both XML input and output)
> > that I'd like to see some discussion before implementation.
>
> Well, it would be a lot of code to parse (just because XML is a little
> more complicated than it looks, and because you have to check for
> correctness) 
Isn't there a xml-library you can use?  XML Parsing is harder then it looks, 
and many tools have had loads of problems because they felt it was no 
problem to parse it themselves..

> but writing XML is rather simple.  (all you really need is a 
> string-escaping function)
That ignores encodings; so you might wanna check how haskall does that.

> > If the format weren't darcs-parseable, I'd at least like to make sure
> > that in theory it *could* be darcs-parseable (i.e. there are no
> > ambiguities where two patches could give the same XML output). 
> > Otherwise we'd eventually run into an application where the XML output
> > is insufficient, which would be a real shame.  I'm imagining external
> > tools to, for example, create darcs primitive patches which get fed
> > into darcs record.
>
> Well, I was about to suggest a list of tags, and get the discussion
> started, but it just occoured to me that XML isn't whitespace-sensitive,
> and that if we run any of the patch text through any standard XML tools
> there's a chance to totally corrupt the data.  (not to mention the line
> endings, lol )
This is not true; XML is whitespace sensitive, this is just one of those 
myths that roam..  (probably sustained by incorrect XML parsers).
If you have <foo><bla>123</bla></foo> then you will get a different DOM tree 
from when you have those spread over 5 lines.  XML specifies your reader 
needs to provide them all.
Next to that there is a tag (xml:space="preserve") that will make tell the 
parser it should preserve whitespace.  The funny thing is; that tag is 
default set to "preserve", so each xml per default already is ok.

> So here's the next question: would we be able to wrap the patch data
> (like the text in a hunk) inside a CDATA tag?  Do any XML experts out
> there know if that would preserve binary equivalence even after
> transformations by standard tools?
CData is not needed; but it would indeed preserve what you want.  Its just 
overkill.
This is more correct and complete:
<whatsnew>
  <patch type="hunk" param="5" filename="foo/bar">
  <hunk adds="1" removes="1">- Lorem ipsum dolor &quot;sit 
+ amet, consectetuer adipiscing elit
</hunk>
  </patch>
</whatsnew>

Run this through xmllint (part of libxml2-utils) and he will not destroy any 
whitespace or lineendings.  Though the lineendings part needs some 
investigation on Windows tools.

> Come to think of it, this doesn't really save much effort at all from the
> hunk format.  Maybe XML isn't really needed... (but I admit that I'm
> biased against XML)

I really like XML for many things, but I fully agree that this does not seem 
worth it.  I'm a bit confused why perl would need xml to parse the current 
whatsnew, since I feel its very easy to do right now.

-- 
Thomas Zander
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.osuosl.org/pipermail/darcs-users/attachments/20041216/f78e5027/attachment.pgp 


More information about the darcs-users mailing list