using template to distinguish between files and files with spaces

Jens Alfke jens at
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 "":
header = '<?xml version="1.0" encoding="UTF-8" ?>\n<repository  
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.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 1875 bytes
Desc: not available
Url : 

More information about the Mercurial mailing list