[PATCH 2 of 2] subrepo: create subrepos using clone instead of pull

Martin Geisler mg at aragost.com
Fri Mar 25 10:39:07 CDT 2011


Matt Mackall <mpm at selenic.com> writes:

> On Fri, 2011-03-25 at 16:07 +0100, Martin Geisler wrote:
>> # HG changeset patch
>> # User Martin Geisler <mg at aragost.com>
>> # Date 1301064435 -3600
>> # Node ID d786036b749bc58d219b22039559480716bb5071
>> # Parent  a8019f68e1463d6b1d5406f5f22d17f9aa8c828c
>> subrepo: create subrepos using clone instead of pull
>> 
>> Subrepositories are currently always created empty and then filled
>> with data using pull. This is wasteful when you do an initial clone
>> since it means that no hardlinks are created for the subrepos.
>> 
>> This patch make the hgsubrepo._get method check for an empty subrepo
>> and in that case do a clone instead of a pull. This brings in the same
>> data while creating hardlinks when possible.
>
> This seems like a good idea to me.

Great! As noted on IRC, this patch conceptually unrelated to the first
patch.

One thing that bothers me a little is the clumsy way in which I do the
clone. I cannot just call localrepo.clone since that does not know how
to make hardlinks and ultimately calls the stream_in or pull method.

It would be nice if pull knew how to hardlinks individual revlogs if it
could detect that it needs the whole file. On the other hand, I think
pulling from a local clone is a somewhat rare case after the initial
clone.

-- 
Martin Geisler

aragost Trifork
Professional Mercurial support
http://aragost.com/en/services/mercurial/blog/


More information about the Mercurial-devel mailing list