Hi all,
latest darcs (>2.4) reintroduced a bug that was fixed back in
2008 ([1]_): the output of "darcs pull --dry-run --xml-output" starts
with a pointless (in XML context) verbosity "Would pull from XXX...".
The defect imposes 3rd party consumers (such as Tailor, to
mention one :) to "massage" the output removing non-XML before feeding
it to a XML parser. Not a big deal ([2]_), but annoying to say the
least.
Ideally, when --xml-output is given, darcs should emit a clean and
consistent XML stream on its output (maybe redirecting the
informational messages to stderr?).
Consider the following transcript:
1. I create a sample repository
$ cd /tmp/
$ mkdir test
$ cd test
$ darcs init
$ darcs --version
2.4.4 (release)
$ touch a
$ darcs add a
$ darcs rec -a -m "First"
Finished recording patch 'First'
2. I create an empty repository and pull from the sample
$ cd ..
$ mkdir other
$ cd other
$ darcs init
$ darcs pull --dry-run --xml-output ../test
<patches>
<patch author='lele@nautilus.homeip.net' date='20100620083122' local_date='Sun Jun 20 10:31:22 CEST 2010' inverted='False' hash='20100620083122-97f81-152958635c941142ea3e00c861f3eab23beb4718.gz'>
<name>First</name>
<comment>Ignore-this: b4c104a51d2623519ab352ce6d8eccde</comment>
</patch>
</patches>
Look ma, no noisy lines... Good!
3. But tailor needs more info
$ darcs pull --summary --dry-run --xml-output ../test
Would pull from "/tmp/test"...
<patches>
<patch author='lele@nautilus.homeip.net' date='20100620083122' local_date='Sun Jun 20 10:31:22 CEST 2010' inverted='False' hash='20100620083122-97f81-152958635c941142ea3e00c861f3eab23beb4718.gz'>
<name>First</name>
<comment>Ignore-this: b4c104a51d2623519ab352ce6d8eccde</comment>
<summary>
<add_file>
a
</add_file>
</summary>
</patch>
</patches>
Gasp! Need to drop the first line before parsing the output...
4. Repeat the previous command
$ darcs pull --dry-run --xml-output ../test
Would pull from "/tmp/test"...
<patches>
<patch author='lele@nautilus.homeip.net' date='20100620083122' local_date='Sun Jun 20 10:31:22 CEST 2010' inverted='False' hash='20100620083122-97f81-152958635c941142ea3e00c861f3eab23beb4718.gz'>
<name>First</name>
<comment>Ignore-this: b4c104a51d2623519ab352ce6d8eccde</comment>
</patch>
</patches>
Uh, what the heck is going on here?? This confused me a lot trying
to distill the test case... Apparently, executing "darcs changes
--summary" in the third step alters the behaviour of succeeding
commands??
5. Darcs 2.3.1 did behave differently
$ darcs-2.3.1 pull --dry-run --xml-output ../test
<patches>
<patch author='lele@nautilus.homeip.net' date='20100620083122' local_date='Sun Jun 20 10:31:22 CEST 2010' inverted='False' hash='20100620083122-97f81-152958635c941142ea3e00c861f3eab23beb4718.gz'>
<name>First</name>
<comment>Ignore-this: b4c104a51d2623519ab352ce6d8eccde</comment>
</patch>
</patches>
$ darcs-2.3.1 pull --summary --dry-run --xml-output ../test
<patches>
<patch author='lele@nautilus.homeip.net' date='20100620083122' local_date='Sun Jun 20 10:31:22 CEST 2010' inverted='False' hash='20100620083122-97f81-152958635c941142ea3e00c861f3eab23beb4718.gz'>
<name>First</name>
<comment>Ignore-this: b4c104a51d2623519ab352ce6d8eccde</comment>
<summary>
<add_file>
a
</add_file>
</summary>
</patch>
</patches>
$ darcs-2.3.1 pull --dry-run --xml-output ../test
<patches>
<patch author='lele@nautilus.homeip.net' date='20100620083122' local_date='Sun Jun 20 10:31:22 CEST 2010' inverted='False' hash='20100620083122-97f81-152958635c941142ea3e00c861f3eab23beb4718.gz'>
<name>First</name>
<comment>Ignore-this: b4c104a51d2623519ab352ce6d8eccde</comment>
</patch>
</patches>
I hope to be back with a test script.
thank you,
ciao, lele.
.. [1] See patch 'Honour --xml-output when printing the patches in the
"will do"/"would do" message'
.. [2] http://progetti.arstecnica.it/tailor/changeset/1669
--
nickname: Lele Gaifax | Quando vivrò di quello che ho pensato ieri
real: Emanuele Gaifas | comincerò ad aver paura di chi mi copia.
lele@nautilus.homeip.net | -- Fortunato Depero, 1929.
|