I use MODx, a CMF, and it stores all templates, snippets and user code in some MySQL tables. It makes usage of Mercurial for these projects very tiresome. Import/export of mysql dumps takes a lot of time.
So, is there an approach to avoid it?
I'm not familiar with Mercurial but I edit all my MODx snippets and plugins on the file system.
The standard way to do this is to create a MODx snippet that simply returns the contents of a php file containing your main snippet code, which you can edit using an IDE and benefit from version control:
<?php
$file = include $modx->getOption('core_path') . 'path/to/your/snippet.php';
return $file;
Here's a method you can use to get file-based Chunks in your snippet code:
However both techniques will be redundant when the upcoming Revolution 2.2 is released as it introduces a new Static Element type allowing you to use file based elements natively:
http://rtfm.modx.com/display/revolution20/Upgrading+to+2.2.x#Upgradingto2.2.x-StaticElements