Let’s say I have a branch in a repository with several historical changeset in it like below.
== repository1 ==
( init)A -> B -> C -> D - E -> ... (default branch)
\
\ -> C'1 -> C'2 -> C'3 -> .... (branch1)
Now, I want to move(transplant) branch1 to another separate repository like below.
== repository1 ==
(init)A -> B -> C -> D - E -> ... (default branch)
\
\ -> C'1 -> C'2 -> C'3 -> .... (branch1)
== repository2 ==
(init)C'1 -> C'2 -> C'3 -> ... (default branch)
Has anyone knows how to do that? Thanks.
Update:
It seems a little strange to transfer part of a repository without including its ancestors. The situation I encountered where we have started to develop a big project for a while and the people who pays money for the project wants to be able to develop some components of the project respectively, separately and independently. Because they think the components are so good to be an independent product or an small open source project, therefor they don’t want any unrelated historical code left in repository.
The transplant extension (as noted) might be the best thing, but you should also look at the convert extension. Although it’s nominally intended for converting from other revision control systems to mercurial, it’s also useful for ‘converting’ from one Mercurial repository to another, with quite elaborate support for filtering and selection.
Depending on precisely what you want to do, ‘convert’ may or may not be the most straightforward way of expressing it.