using template to distinguish between files and files with spaces

Jens Alfke jens at mooseyard.com
Mon Mar 17 17:45:11 CDT 2008


On 17 Mar '08, at 1:43 PM, Matt Mackall wrote:

> That looks very handy. Perhaps we should ship something like this

I think it'd be a good idea. I use this in a GUI client I'm writing;  
that way I can just toss the output of 'hg status' or 'hg log' into an  
XML parser and look at the DOM.

You're welcome to take the templates I posted and put them into  
Mercurial itself.

Here's another one I use with "hg log" when all I want is the topology  
of the revision graph. It's faster to generate and parse since there's  
nothing in it but the revision IDs; that makes a big difference with  
the Mercurial trunk repository!

# File "xmlminimal.style":
header = '<?xml version="1.0" encoding="UTF-8" ?>\n<repository  
name="{repo}">\n\n'
footer = '</repository>\n'
changeset = '<changeset rev="{rev}" />\n{parents}</changeset>\n'
parent = '<parent rev="{rev}" />\n'

FYI: There's a bug in hg that I run into when using these. The  
"footer=" directive seems to be ignored, so the closing "</ 
repository>" doesn't get emitted. That causes the XML parser to barf,  
which I work around by appending that close tag to the data returned  
from 'hg' before parsing it. Yuck.

—Jens
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 1875 bytes
Desc: not available
Url : http://selenic.com/pipermail/mercurial/attachments/20080317/2655b180/attachment.bin 


More information about the Mercurial mailing list