Add earlier history retroactively?

Tom Widmer tom.widmer at googlemail.com
Fri Apr 9 12:12:33 CDT 2010


Nikolaus Rath wrote:
> Hello,
> 
> I have a project that was initally managed in subversion. At some point
> I created a Mercurial repository and imported the most recent subversion
> revision. From that point on, the project was managed in Mercurial.
> 
> Now I have noticed the existence of "hg convert" to convert the entire
> history of a subversion repository. However, it seems to insist on
> creating a fresh mercurial repository.
> 
> Is it also possible to retroactively add the old subversion history to
> an already existing mercurial repository? How would I go about that?

Using hg convert, which can convert from HG to HG surprisingly!

Say your new history since your move to HG is in repoA.

Use hg convert to create a fresh HG repo from the old SVN history, call 
it repoB. Use hg convert --splicemap to convert from repoA with the 
target set to repoB, and a splicemap containing:
<full sha hash of the final rev of repoB> <full sha hash of the 2nd rev 
of repoA>

That should do it (see 
http://mercurial.selenic.com/wiki/ConvertExtension for more info on 
--splicemap).

Note that the new repo will be incompatible with the old one (so all 
developers should merge all their changes to repoA and delete their 
local repos before you do the final convert from repoA).

It will be more complicated if you've got multiple SVN branches - you 
might need multiple entries in the splicemap to join each branch to the 
subsequent HG revisions on that branch.

Tom



More information about the Mercurial mailing list