clone part of a repository

Guido Ostkamp hg at ostkamp.fastmail.fm
Fri Nov 2 06:31:49 CDT 2007


On Thu, 01 Nov 2007 15:09:16 +0100, "Philippe Fremy"
<phil at freehackers.org> said:
> I would like to clone part of a repository. Is it possible ?
> 
> Basically, I have a repository with:
> + projects
>     + project1
>     + project2
>     +...
> 
> I like the idea of having one global repository, because when I move to
> a new computer, it is quite convenient. But when I work on an individual
> project, I only want a "checkout" of that project.
> 
> Is it possible ?

As soon as I know, it is not possible.

You can however create a new repository from your existing
repository, that contains only the stuff for one project and
then clone that.

For this you must use the 'convert' extension. After
enabling it in your ~/.hgrc with

[extensions]
hgext.convert=

create a 'filemap' file with the line

include projects/project1

and then call

$ hg convert --filemap filemap oldrepo newrepo

This will create the new repository. Then you can clone
that one the normal way. Because the changesets have
different id's to the original ones in oldrepo, I believe
you will not be able to push changes back to oldrepo.
You will have to export and import them instead.

Breaking up your oldrepo into several newrepos and
then using the 'forest' extension might also be worth
to look at.

Regards

Guido


More information about the Mercurial mailing list