Converting dropbear to mercurial.

Matt Johnston matt at ucc.asn.au
Sun Sep 11 21:48:31 WST 2011


On Sat, Sep 10, 2011 at 10:07:49PM -0500, Augie Fackler wrote:
> > Have you tried http://mercurial.selenic.com/wiki/ConvertExtension ?
> > 
> > I don't know the state of monotone support in mercurial, but I've never
> > used monotone, so...
> 
> Convert should work. If not, feel encouraged to give me the right mtn spell to get a clone of your mtn and I'll gladly poke it to see what's wrong.

The monotone converter gets confused by me doing 
rename "" -> "libtomcrypt" on one side of the merge in
revision fdf4a7a3b97ae5046139915de7e40399cceb2c01. That
happens via monotone's "merge_into_dir" command - I moved
the root directory of the ...ltc.dropbear  branch into a
subdirectory of the main dropbear branch.

The end result is that an old version of "changes" appears
in the toplevel directory of au.asn.ucc.matt.dropbear
branch, as well as the correct version at
"libtomcrypt/changes". (The same happens for various other
files there too).

Looking at the code in montone.py's getchanges() I can't see
how it would work correctly. It's iterating over all
renames/adds/deletes, but in a merge each operation will be
relative a particular parent revision denoted by the
"old_revision" lines.  See
http://matt.ucc.asn.au/dropbear/test/fdf4a7a-merge_into_dir.txt
for the Monotone revision (from "mtn automate
get_revision").

I've tried a few different tweaks but none seemed to 
improve things. Unfortunately a simple synthetic testcase
doesn't hit the same problem either :(
I might try making a simpler getchanges() version that
ignores renames and just uses mtn automate's get_manifest_of
to figure out the files - my repository I can live without
rename/copy tracking.

If you want to look at it I also needed the following for
the empty fromdir case to avoid paths with a leading slash.

if fromdir == "":
    renamed[tofile] = fromdir + tofile[len(todir)+1:]
else:
    renamed[tofile] = fromdir + tofile[len(todir):]

I also had to comment out the mercurial_source in convcmd.py
- otherwise it would abort before the monotone source was
tried. I'll report that one as a separate bug, I assume it
would affect any converter below mercurial_source.

I've put a cut down repository at
http://matt.ucc.asn.au/dropbear/test/small-dropbear.mtn

Cheers,
Matt


More information about the Dropbear mailing list