precommit hook that changes commit list?

Giorgos Keramidas keramida at ceid.upatras.gr
Sat Sep 6 19:45:25 CDT 2008


On Sat, 6 Sep 2008 16:33:18 -0700, "Nicholas Tung" <ntung at ntung.com> wrote:
>On Sat, Sep 6, 2008 at 6:25 AM, Giorgos Keramidas wrote:
>>On Sat, 6 Sep 2008 01:32:56 -0700, Nicholas Tung wrote:
>>> Hello,
>>> I have a precommit hook script that will compile a LaTeX file before
>>> committing. I know some people feel storing generated files is messy,
>>> but with the web server, it's just too convenient. Is there a way to
>>> make Mercurial rescan the commit list to see that this generated file
>>> has changed before it commits?
>>
>> Not really.  Even if there was `changing' a commit on the fly is not
>> possible without modifying the changeset hashes and altering the repo
>> history.
>
> I take it the changeset hashes only has file names, not content?
> Because if the file is modified and will be committed, then it can be
> changed by the pre-commit hook.

No the hash includes much more details (including file contents).

>> Why don't you build the files right _after_ commits?  If you have a
>> build script called `mybuild.sh' then something like this would work:
>>
>>    [hooks]
>>    changegroup = /home/keramida/tools/mybuild.sh
>>    commit = /home/keramida/tools/mybuild.sh
>>    # To rebuild after every "hg update" too, add:
>>    # update = /home/keramida/tools/mybuild.sh
>
> The point is not for users downloading the repository to get an
> updated generated file, but for the version on the web interface to be
> current (i.e.  what's in the repository).

I got that.  You can install hooks in *remote* repositories too.  When
you push a change over the wire, the hooks will still trigger.



More information about the Mercurial mailing list