Adding hook on lookup
Cédric Krier
cedric.krier at b2ck.com
Sun Jul 29 07:17:28 UTC 2018
On 2018-07-29 10:55, Yuya Nishihara wrote:
> On Sat, 28 Jul 2018 17:37:58 +0200, Cédric Krier wrote:
> > 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
>
> Just to be clear, I meant "share.pool", not "hg share" command. If there's
> a way to attach the pool directory on the CI machine to new docker instance
> (by --mount, -v/--volume or NFS), "share.pool" can be used to keep the cache
> sync with the master repository.
Sorry, I understand it was the command. So indeed it could be an
option but I will have to request a change in the drone-hg plugin to
activate it.
But if the hook on lookup still make sense, I can provide the patch.
Thanks.
--
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/20180729/a1198c6b/attachment.asc>
More information about the Mercurial
mailing list