[PATCH] XML output for hg log

Nicolas Dumazet nicdumz at gmail.com
Mon Dec 28 18:18:39 CST 2009


Hello!

2009/12/29 Matt Mackall <mpm at selenic.com>:
> On Mon, 2009-12-28 at 21:35 +0100, Robert Bachmann wrote:
>> Hello,
>>
>> The patch adds the template file "templates/map-cmdline.xml".
>> This file provides a simple XML format for changelogs. The format
>> was modelled after the XML log format used by Subversion.
>>
>> The typical usage would be:
>> $ hg log --style xml > changelog.xml
>>
>> The changeset can be found at:
>> - http://bitbucket.org/rbachmann/hg-crew-xml/changeset/bf33cfb026a3/
>>
>> I needed to use the template variable "footer" to write the closing
>> tag of the XML output. Since "footer" was not supported by
>> cmdutil.py, I've changed this. Since I'm not entierly certain
>> about my changes I've provided them in an extra changeset:
>> - http://bitbucket.org/rbachmann/hg-crew-xml/changeset/4d150b066660/
>
> I'm glad someone's finally tackled this! Please use the patchbomb
> extension to mail your patches to this list for review, preferably with
> the footer patch first.

Thanks a lot, Robert!

I just had a quick look at the patches, they look promising.

How difficult is it to add tests for XML output?
We usually write short shell scripts, to check for the stability of
output. Have a look for example at tests/test-log and
tests/test-log.out
You can find some documentation here
http://mercurial.selenic.com/wiki/WritingTests
I'd love to see a short test included with your patches :)


On a related note, do we want to include XSD data if we start using XML output?
I am wondering what will happen if we decided to extend the XML
syntax, or change it later to include some other informations.
If we don't use XSD/specify a schema, then any further moves will be
painful, requiring users to follow carefully the changes to crew to
make sure tools don't break.
If, on the other hand, we use XSD and ensure that XML output is always
compliant to our schema, we can simply rely on a versioned,
well-documented XSD schema to document output history.
I caught a related discussion on subversion-dev (
http://svn.haxx.se/dev/archive-2005-07/1379.shtml )

Any thoughts on this?

Regards,

>
> --
> http://selenic.com : development and support for Mercurial and Linux
>
>
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel
>



-- 
Nicolas Dumazet — NicDumZ


More information about the Mercurial-devel mailing list