xml style doesn't generate valid xml

Haszlakiewicz, Eric EHASZLA at transunion.com
Mon Nov 22 16:49:44 CST 2010

>-----Original Message-----
>From: Matt Mackall [mailto:mpm at selenic.com]
>On Mon, 2010-11-22 at 21:18 +0000, Haszlakiewicz, Eric wrote:
>> I'm continuing looking for ways to get structured, parseable data out of
>mercurial, this time I figured I'd try the xml style (vs. my other email
>about using a json style).
>> I noticed that the xml style doesn't work.  Specifically, it generates
>bad output for the "extra" info attached to a changeset if you do:
>> hg init x && cd x
>> echo foo > foo
>> hg add foo
>> hg ci -u user -m change1 foo
>> echo foo >> foo
>> hg ci -u user -m change2 foo
>> hg up -r0
>> echo bar > bar
>> hg add bar
>> hg ci -u user -m barchange
>> hg up -r1
>> hg --config "extensions.hgext.transplant=" transplant 2
>> hg log --debug --style xml > log.out
>> xmllint --noout log.out
>Where's the output?
>It's great that you've got a nice test script, it's NOT great that you
>apparently expect everyone to go to the effort of running it before we
>can even begin to think about your issue.

The output is that characters with a value of less than 0x20 get replaced with a space (as I said in my original email).  Characters with other values are output as-is, but since the transplant_source value in extra is the raw sha checksum it ends up outputting byte sequences that are not valid UTF-8 sequences.

I'm not going to paste the actual output into an email because it's not plain text.  However, here's a sample of what "less log.out" displays, minus the terminal dependent highlighting to distinguish between specially displayed characters and actual angle brackets:
<extra key="transplant_source"><CD><B9><AA>Q<FF><A3>}<AC>JI<D5><8E><D8>zWL,<FB>;<F7></extra>


More information about the Mercurial mailing list