precommit hook that changes commit list?

Nicholas Tung ntung at ntung.com
Sat Sep 6 18:33:18 CDT 2008


On Sat, Sep 6, 2008 at 6:25 AM, Giorgos Keramidas
<keramida at ceid.upatras.gr>wrote:

> On Sat, 6 Sep 2008 01:32:56 -0700, "Nicholas Tung" <ntung at ntung.com>
> 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.


>
>
> > Or is there some script that would run whenever detecting changed
> > files?
>
> 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).

As I'm only working on my computer now, I can just alias some commit_myrepo
to build then commit.

Thanks anyway,
Nicholas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://selenic.com/pipermail/mercurial/attachments/20080906/e1b6ae9a/attachment.htm 


More information about the Mercurial mailing list