We've had a spate of errors lately that would have been detected by
checking whether or not some XML file was well formed, so I've written a
mercurial hook to check. It is written in python such that it runs
within your existing hg commands without spawning another process; I
don't believe that it significantly affects performance.
It can be used both to check for changes being committed and to check
changesets being pulled as a group. If any XML file in the change is
not well formed, it aborts and rolls back the transaction (the commit or
pull fails and your local repo is unchanged). In the case of pulling,
if a file is changed in more than one changeset, only its final form is
checked. If the last change is to remove the file, it is not checked.
You can get the hook by checking out a copy of my tools collection into
anywhere in your local files that's convenient:
https://bitbucket.org/oz_linden/tools
it's in the hooks subdirectory. Or by just fetching:
https://bitbucket.org/oz_linden/tools/raw/16d049e51924/hooks/well_formed_xml.py
(I recommend the former, since it will make pulling any update easier)
Install by putting the configuration below into your ~/.hgrc file (or
the .hg/hgrc file of a specific repository), changing /path/to/ to the
full path to your copy of the file:
[hooks]
pretxncommit = python:/path/to/well_formed_xml.py:hook
pretxnchangegroup = python:/path/to/well_formed_xml.py:hook
*
I strongly urge all viewer developers to begin using this ASAP, since
effective immediately I have it installed and will fail any merge
request to viewer-development that fails this test.
*
_______________________________________________
Policies and (un)subscribe information available here:
http://wiki.secondlife.com/wiki/OpenSource-Dev
Please read the policies before posting to keep unmoderated posting privileges