So it turns out that this breaks my darcsver tool (in the case that there are crc errors
present).
With darcs-2.2.0 installed:
-------
$ python setup.py darcsver
running darcsver
setup.py darcsver: wrote '0.9.35' into _version.py
-------
After upgrading to 2.3.1+271 patches it gets a parse error since the stdout is no longer well-
formed XML:
-------
$ python setup.py darcsver
running darcsver
Traceback (most recent call last):
File "setup.py", line 36, in <module>
'License :: GNU General Public License',
File "/usr/lib/python2.6/distutils/core.py", line 152, in setup
dist.run_commands()
File "/usr/lib/python2.6/distutils/dist.py", line 975, in run_commands
self.run_command(cmd)
File "/usr/lib/python2.6/distutils/dist.py", line 995, in run_command
cmd_obj.run()
File "/usr/local/lib/python2.6/dist-packages/darcsver-unknown-
py2.6.egg/darcsver/setuptools_command.py", line 77, in run
(rc, verstr) = darcsvermodule.update(self.project_name, self.version_file,
self.count_all_patches, abort_if_snapshot=self.abort_if_snapshot, loud=loud, EXE_NAME="setup.py
darcsver")
File "/usr/local/lib/python2.6/dist-packages/darcsver-unknown-
py2.6.egg/darcsver/darcsvermodule.py", line 112, in update
doc = xml.dom.minidom.parseString(output)
File "/usr/lib/python2.6/xml/dom/minidom.py", line 1928, in parseString
return expatbuilder.parseString(string)
File "/usr/lib/python2.6/xml/dom/expatbuilder.py", line 940, in parseString
return builder.parseString(string)
File "/usr/lib/python2.6/xml/dom/expatbuilder.py", line 223, in parseString
parser.Parse(string, True)
xml.parsers.expat.ExpatError: junk after document element: line 288, column 0
-------
The tail of the string that it attempted to parse looks like this:
<name>Document the 'overwrite-tags' for git</name>\n-<comment>Also, emit a critical
log indicating the possible source of the\nproblem, mentioning the
option.</comment>\n</patch>\n</changelog>\n\nWarning: CRC errors found. These are probably
harmless but should be repaired.\nSee 'darcs gzcrcs --help' for more information.\n\n
I've made a new version of darcsver which before XML parsing scans for "</changelog>" and
strips off everything which follows it. That appears to restore darcsver to correct behavior
in this case.
If you're planning to release another stable in the 2.3 series then if you could move that
warning from stdout to stderr this would allow the current version of darcsver to continue to
work. (This could be useful because, for example, some of my projects have a copy of darcsver
bundled in with the project's own source code, so it will continue to be using the old version
of darcsver even after I've published a newer one with this work-around.)
In any case, in the future it might be convenient if darcs uses stderr for warnings,
exceptions, errors, and "communication to the user" and reserves stdout for a structured value
that can be consumed programmatically (when that makes sense).
|