[opensource-dev] Mercurial hook checking for well-formed XML

Kadah kadah.coba at gmail.com
Fri Aug 12 19:40:29 PDT 2011


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

We did something similar in Firestorm, but winthin the viewer, all
malformed XML is treated as an error in RelWithDebInfo and Debug.
Testing builds in RelWithDebInfo instead of release is always a good
idea anyway as it treats many silly goofs as errors instead of warns,
like missing settings.

http://hg.phoenixviewer.com/phoenix-firestorm-lgpl/rev/2c68d4aa5a01
http://hg.phoenixviewer.com/phoenix-firestorm-lgpl/rev/8fc22bdb1e7b

On 8/12/2011 2:18 PM, Oz Linden (Scott Lawrence) wrote:
> 
> 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
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQEcBAEBAgAGBQJOReQdAAoJEIdLfPRu7qE2irMH/0d57WHuvfM0BvIGu2FP1Yni
72pMCwLt/p2LlEB+bBji7Iv05EUwrxCO36CJuet2kMusjvGfXPmp9Jsef4F2raoH
HLmL7OUJLwp7dv11bcfm11tcxSInvTxbcj8IJBApGKTOk/k9X7RrVE49vMEypLR7
4cXdOqf46Cfl6gsptKUwU+/o/H3ZeoZ3jdKJfccmnzES5zj2da3stK0s2b33Fzi8
I86CWJdffScSHU8pMMXNoPiJk6EyKTelYHb3/uqJqkbnwa6t3beukGn2vPPL289O
loBENGSTbuXcZvfcnRmsk7bTN8LxHc7OzyCSVm/bQUazXj5WS2UAiDiCPRXhr1I=
=06La
-----END PGP SIGNATURE-----


More information about the opensource-dev mailing list