git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] Add hg-to-git conversion utility.

From
Shawn O. Pearce <spearce@spearce.org>
Date
Jan 12, 2007, 22:15 UTC
Message-ID
<20070112221525.GA20956@spearce.org>
In-Reply-To
<1168639023.13640.2.camel@localhost.localdomain>
Stelian Pop <stelian@popies.net> wrote:
> hg-to-git.py  is able to convert a Mercurial repository into a git one,
> and preserves the branches in the process (unlike tailor)
Cool!

You've already written the converter, but you may want to look at using git-fast-import as the backend interface to Git. I think your code may come out shorter, be clearer, and will run faster.

For example Simon Schubert's cvs -> git converter was written in one night (last night) in Ruby using git-fast-import as the backend (Simon already had the heavy lifting CVS portions done). I peeked at his source and its quite readable, though maybe that's just the Ruby talking. ;-) Simon is apparently trying to import FreeBSD's CVS repository to Git. A non-trivial task.

Chris Lee also has an svn -> git converter that uses gfi as its backend. Its only 150 or so lines of Python and is also quite readable. Chris is apparently trying to import KDE to Git. An equally non-trivial task.

I think the common thread between the two implementations is that there's less process forking and less manipulation of ugly environment variables. So the import runs faster and its a little easier to organize the code.

The gitweb (and mirror URLs) for gfi is available here:
  http://repo.or.cz/w/git/fastimport.git

Post 1.5.0 I'm going to nudge Junio to get gfi added to the main git.git repository. (Right now I don't want to distract him from the release.)

-- 
Shawn.
Previous: Stelian PopNext: Stelian Pop
Message 5 of 15 in “Mercurial to git converter.”
  1. Stelian PopJan 11, 2007
  2. Jakub NarebskiJan 12, 2007
  3. Stelian PopJan 12, 2007
  4. Add hg-to-git conversion utility.Stelian Pop, Jan 12, 2007
  5. Shawn O. PearceJan 12, 2007
  6. Stelian PopJan 12, 2007
  7. Junio C HamanoJan 12, 2007
  8. Stelian PopJan 12, 2007
  9. Nick AndrewJun 14, 2008
  10. Johannes SchindelinJun 14, 2008
  11. Jakub NarebskiJun 14, 2008
  12. Shawn O. PearceJun 16, 2008
  13. Nick AndrewJun 16, 2008
  14. Mike HommeyJun 16, 2008
  15. Johannes SchindelinJun 17, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.