On commit to repository I have a hook defined in Mercurial:
[hooks]
precommit.exportDB=exportDB.bat
This creates/updates a SQL-dump from my database, which should be included in the commit.
BUT: although this works, the Sql is marked as new, but not part of the now commiting changeset.
How can I automatically include it so it gets into the set of changed files?
Hope this makes sense…
Thx
Reinhard
This’ll sound crazy, but you can do it in two steps. First change your
precommithook to apre-commithook — yup, both exist and they’re different. Without the dash the commit has already started and some lock has been acquired. With the dash it happens before the commit starts and you can stillhg addthe new file.On a unix like that total change would be:
presumably there’s something similar on Windows, or you could make the
hg addthe last line of the batch file.P.S. Don’t commit generated files. 🙂
Update:
I just tested this and it works as I suggested:
Notice that before the commit only ‘afile’ is added and ‘otherfile’ is unknown, and after the commit both files are ‘C’ (meaning “Clean’ — they’ve been added and committed).