Aw: Re: .hgrc/hooks automatic hook directory
Arne Babenhauserheide
Arne_Bab at web.de
Thu Jan 3 18:40:11 UTC 2019
Hi Anatoly,
> > For automation it should suffice to use
> >
> > echo '[hooks]
> > post-clone.something = ~/.hghooks/post-clone
> > ' >> ~/.hgrc
>
> No idempotency in this case.
>
> What happens if `[hooks]` would be specified several
> times? Will key/values be merged? Or are they replaced
> by the new block?
You can specify it several times and all blocks get used.
If you want to replace a value, just use the same suffix (after the period).
The folloing prints moo after every commit:
[hooks]
commit.foo = echo foo
commit.foo = echo moo
If you want to ensure that your hook is used regardless of the content of the ~/.hgrc, you can use a uuid.
Here’s a version to play it safe:
echo "
[hooks]
post-clone.$(uuidgen) = ~/.hghooks/post-clone
" >> ~/.hgrc
Best wishes,
Arne
More information about the Mercurial
mailing list