Adding hook on lookup

Yuya Nishihara yuya at tcha.org
Sat Jul 28 09:09:07 UTC 2018


On Thu, 26 Jul 2018 09:53:46 +0200, Cédric Krier wrote:
> Until recently, I used the extension hgwebcachingproxy [1] to maintain
> local repositories as cache for our CI machines. But the extension does
> not work anymore with latest mercurial versions.
> So I found an easy replacement solution to maintain an up to date cache
> repository locally by using a hook like this (I do not need automatic
> creation):
> 
>     [hooks]
>     preoutgoing = hg pull
> 
> It works very well for `hg clone <path>` but it does not with a revision
> `hg clone -r <rev> <path>` (how our CI is cloning).
> With revision option, it does not work because a lookup is performed
> before the preoutgoing hook is triggered and so if the revision has not
> yet been pull, it raises an error.
> For now, I patched mercurial to trigger a hook on lookup command. Do you
> think it makes sense to have this hook in standard? If yes, what should
> be the name of this hook, 'lookup'?

I don't have a direct answer to your question, but maybe you can use the
"share.pool" feature to manage local cache of repositories.

https://www.mercurial-scm.org/repo/hg/help/share



More information about the Mercurial mailing list