hg convert vs. strange svn repo...

Ryan C. Gordon icculus at icculus.org
Tue Jan 12 00:58:09 CST 2010


I'm experimenting with converting Simple Directmedia Layer ( 
http://libsdl.org/ ) from Subversion to Mercurial, and I'm having some 
trouble.

The svn repo--which was built by converting several CVS repositories 
into one many years ago--needs a good bit of untangling. My plan is to 
rip all the separate projects into their own hg repositories, and keep 
all the revision history for each.

In ripping this apart, I'm taking this approach:

mkdir -p sdlhg
# one run for each project.
for feh in SDL SDL_image SDL_mixer SDL_net SDL_rtf SDL_ttf ; do
     echo "include $feh" >sdlfilemap.txt
     rm -rf sdlhg/$feh
     hg convert --authors a.txt --filemap f.txt --datesort svn hg/$feh
     rm -f sdlfilemap.txt
done

Most of the projects, which are pretty simple, work out fine, but the 
main project (SDL) is having a few issues.

The big problem I'm running into is that we're losing branches.

I believe these are the offending revisions...

   http://www.libsdl.org/cgi/viewvc.cgi?view=revision&revision=2608
   http://www.libsdl.org/cgi/viewvc.cgi?view=revision&revision=2609

...in these, we moved the svn trunk to a branch, and deleted the trunk, 
then moved a branch to the trunk and deleted that branch. So between 
those two revisions, /trunk/SDL is completely gone...I think this is 
confusing the heck out of Mercurial.

It's possible this is a good case of You're Doing It Wrong on our part, 
but the next-gen stuff was a branch until we decided to focus on it, 
then the stable code became a branch instead. They were wildly 
different, and both branches got a lot of unrelated revisions on them.


If I run hg convert with --verbose --debug, I get lines like this...

   fetching revision log for "/trunk" from 5476 to 0
   [...snip...]
   parsing revision 2609 (2 changes)
   '/branches/SDL-1.3' is not under '/trunk', ignoring
   parsing revision 2608 (2 changes)
   '/branches/SDL-1.2' is not under '/trunk', ignoring

...and later...

   fetching revision log for "/branches/SDL-1.2" from 5446 to 0
   [...snip...]
   reparent to file:///home/icculus/svn
   reparent to file:///home/icculus/svn/branches/SDL-1.2
   found parent of branch /branches/SDL-1.2 at 2596: /trunk/SDL
   '/trunk/SDL' is not under '/branches/SDL-1.2', ignoring

...eventually we'll get a converted repo, but with changesets from 
/branches/SDL-1.2 (etc) missing. Which is serious for us, as it's not a 
throwaway-experiment branch.

We lose a few other branches and tags, and probably all of them involved 
various shenanigans on our side like this (or a variant: 
create-a-branch-whoops-i-messed-up-delete-it-and-try-again).


So how do I untangle this thing? Is this a bug in hg convert, or is it 
doing the right thing with my wrong data? In any case, is there a 
reasonable way to coerce hg convert to work with this, or a reasonable 
way to manipulate a dump of the svn repo into a form that Mercurial 
would be more happy to parse?

I can make the full svn repository available to anyone that needs it for 
debugging, either as a svnadmin dump or the original fsfs tree.

--ryan.



More information about the Mercurial mailing list