tags:

views:

998

answers:

7

I have a Mercurial repository containing a handful of related projects. I want to branch just one of these projects to work on it elsewhere.

Is cloning just part of a repository possible, and is that the right way to achieve this?

+1  A: 

I believe Mercurial doesn't allow operations on only part of the repository. For example, there is only a single .hg directory, at the root of the repo.

Ned Batchelder
+1  A: 

It is not possible, hg clone will clone the whole repository.

You can take a look a the sub-repository extension that allows you to have repositories inside a repository, which might match your needs.

Romain
+4  A: 

What you want is a narrow or partial clone, but this is not yet supported.

Martin Geisler
Thanks - I've found a workaround for what I need to do. Interesting to see the issues involved.
James Hopkin
What was the workaround that you were able to come up with?
Wally Lawless
+1  A: 

One option, is to instead not do a sub clone, but to use the convert extention to split your repo into more than one repo.

ConvertExtension

Nathan Lee
A: 

Hey, James Hopkin

Could you please tell me what workaround you have found to dealing with such kind of repository.

I also have similar kind of repository and would like to clone the portion (project1) of the repository so that each team can work on their clone portion and push their final changes in to main repository.

You can also mail me your workaround details on [email protected].

Thanks, Praveen

praveen
In my case, it's only a small repository I'm using to share some of my own stuff between home and work. I doubt my work-around would scale to a team of developers. For what it's worth, I've just created a new repository for the single project and copied changes backwards and forwards between the two repositories. It has enough history to make merging easy in my simple case.
James Hopkin
A: 

I used xcopy for now, no idea what the Linux equivalent is, or if I really needed all of the switches, but it does the trick:

xcopy /D /S /I /Q /H /R /K /Y "django\django\contrib\admin\media" "D:\Coding\Workspace\src\django_apps\media"

nih
A: 

This is straight forward with ConvertExtension. http://mercurial.selenic.com/wiki/ConvertExtension#Converting_from_Mercurial