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
_______________________________________________
Mercurial mailing list
[email protected]
https://www.mercurial-scm.org/mailman/listinfo/mercurial

Reply via email to