Adding hook on lookup
Cédric Krier
cedric.krier at b2ck.com
Sat Jul 28 15:37:58 UTC 2018
On 2018-07-28 18:09, Yuya Nishihara wrote:
> 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.
Thanks, I know the share feature. It is very useful and I use it locally
very often for branching.
But it is not useful for my CI case. I may not have give enough
information about the architecture. Our CI machine is on a different
location than our mercurial server. The CI machine uses drone.io to
build on each commit in a new docker image. So the first build step is
to clone the repository with:
hg clone -r 123456789 https://hg.tryton.org/trytond
To limit the load on the mercurial server, we redirect the https
traffic on the build machine which serves a mirror of hg.tryton.org. So
with the hooks, we just have to fetch the latest changeset locally once
instead of downloading the full repository. With this setup we have
reduced the bandwidth consumption per month of about 50Go.
--
Cédric Krier - B2CK SPRL
Email/Jabber: cedric.krier at b2ck.com
Tel: +32 472 54 46 59
Website: http://www.b2ck.com/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 376 bytes
Desc: not available
URL: <http://lists.mercurial-scm.org/pipermail/mercurial/attachments/20180728/5437f492/attachment.asc>
More information about the Mercurial
mailing list