Hooks

This patchset fixes a couple of problems with hooks:
* handling of the return value from preupdate
* change when the postupdate hooks are run
* call precommit/postcommit also when adding new files
* add a new pretemplateupdate hook