Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

mercurial: "Cloning" just one file from one repository into another one?

Tags:

mercurial

I've got a perl project's mercurial/hg repository here with a lot of modules. Now, I've realized that some of the modules, a branch of modules, does not fit into this project anymore but would be better suited in another project.

So, is it possible to "clone" these modules from repository1 into my other repository2 while keeping these modules's revision history and at the same time flagging the modules in repository1 as "removed"?

I think it is possible with a number of steps. But I think cloning the whole repo1 and then removing all the unnecessary files would clutter my new repo2 with a lot of unrelated revision history. Still, as I understand the "clone" and "pull" commands neither of them is suited to clone just a slice of another repository, right? Or is it possible to "move" a file from one repository into another? As I see it that's the analogy of what I want to do..

like image 530
isync Avatar asked Aug 04 '10 19:08

isync


People also ask

How do I clone a Mercurial repository?

Clone a remote Mercurial repositoryFrom the main menu, select Hg | Get from Version Control. The Get from Version Control dialog opens. In the dialog that opens, select Mercurial from the Version control list and specify the URL of the remote repository you want to clone. Click Clone.

What is .HG folder?

hg folder keeps track of one repo only. If you've got one in your home directory it means your home directory is under version control.


1 Answers

Absolutely! Take a look at the Convert extension, specifically the Mercurial-to-Mercurial section which should do exactly what you want.

After you've split off those modules, you can use hg forget, hg remove to remove them from your original repository, or even use hg convert again to create a new repository without them.

like image 56
Niall C. Avatar answered Oct 16 '22 10:10

Niall C.