Gmane
Gravatar
From: Patrick Georgi <patrick <at> georgi-clan.de>
Subject: hg2mtn 0.0.20070824
Newsgroups: gmane.comp.version-control.monotone.devel
Date: 2007-08-24 21:40:28 GMT (1 year, 14 weeks, 4 days and 3 minutes ago)
Hi,

I hereby do the first public release of hg2mtn, an importer of hg repositories 
into monotone. It's licensed under GPL (v2+) as it makes use of other GPL 
components.

I first tried to write something general based on an implementation of the 
git-fast-import interface for mtn, but that wasn't such a good idea as it 
basically results in two lossy steps: whatever-to-git-semantics and 
git-semantics-to-mtn, so I wrote a direct hg2mtn importer now.

At this time, it lacks all the usability bits (like getopt parsing, a tarball 
release, or sane user feedback).

It requires the automate stuff of tracvc. It's probably easiest to just have 
the whole tracvc tree in the PYTHONPATH for now. It also requires an 
installation of mercurial (it basically uses its code to read the repo)

The location of the hg repository, the mtn repository and the branch where all 
the hg stuff should end up are set in some variables in the source.

I also recommend adding a transaction guard to automate stdio because mtn 
commits every single put_file, which leads to a massive slowdown (at least on 
some filesystems - on ZFS it's 4 minutes instead of 20 now)

For now, it stops execution after 50 commits, you can restart and it will skip 
the existing revisions (that's partly a work around for the transaction 
guard - it really requires an "automate commit" command, so that at certain 
points the database state can be frozen, as otherwise all work is lost on 
ctrl-c).

Export to mercurial shouldn't be too hard (the import keeps the hg revision as 
cert to every mtn revision), but that's beyond the scope of my work for now.

Also missing (but on my TODO):
 - handling of hg tags
 - handling of whatever rename facility they have

Some hg repos seem to contain merges that are invalid on monotone (revival of 
files in a merge that were killed on one side) - hg2mtn fails with an 
monotone invariant there.

As it's one of my first large python project "from scratch", it's probably 
full of no-nos of python design. Patches welcome and accepted!

Regards,
Patrick Georgi
Attachment (hg2mtn.py): application/x-python, 4225 bytes
_______________________________________________
Monotone-devel mailing list
Monotone-devel <at> nongnu.org
http://lists.nongnu.org/mailman/listinfo/monotone-devel