.hgrc/hooks automatic hook directory

anatoly techtonik techtonik at gmail.com
Fri Jan 4 05:02:19 UTC 2019


Thanks.

Did anything changed in hg policy to add non-interactive key/value
modification for config from command line?
There seems to be a few plugins with this ability that can be merged.

https://www.mercurial-scm.org/wiki/UsingExtensions#Configuration_management

On Thu, Jan 3, 2019 at 9:40 PM Arne Babenhauserheide <Arne_Bab at web.de> wrote:
>
> 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



-- 
anatoly t.



More information about the Mercurial mailing list