title: Using Mercurial hooks to create/load database dumps for versioning
body: <p>I've started using Mercurial for version-controlling my Drupal project source files (I'm both a VCS and Mercurial newbie). However, the database is still "version-controlled" using a directory of dated .sql.gz files.</p>
  
  <p>What I want is to have a single database dump file somewhere within my repository, that would be overwritten with a current dump when the database changes, and imported into the database when I want to rollback to another version.</p>
  
  <p>I did it manually, and it worked. But what I'd really like is something that does the dumping/loading automatically on each commit/update. I'd really prefer that it would hook into Mercurial than being something external like a makefile that first dumps the database and then commits, since I like working with TortoiseHg's tools, and I don't feel like having another script to run.</p>
  
  <p>Now, it seems that something like an <code>mysql .... &lt; dumpfile.sql</code> on an <code>update</code> hook would be an easy way to load the database dump after each update. But what about the automatic dumping? </p>
  
  <p>There was a <a href="https://stackoverflow.com/questions/397001/is-it-safe-to-commit-more-files-as-a-pre-commit-hook">similar question</a> about SVN's pre-commit hook, and the accepted answer was that it's probably a bad idea. Does it apply to Mercurial? Maybe another hook (<code>prechangegroup</code>?) would work?</p>
  
  <p>EDIT:</p>
  
  <p>I should point out that I'm using it by myself, on my local machine. It shouldn't scale beyond a single user.</p>