views:

436

answers:

2

Hi, I've already tried hg2git through fast-export and I've already tried hg-git.

Both with no success. hg2git actually worked, but I had to ask a friend who runs a Unix machine to do it. And that messed up all the linefeeds throughout the files.

hg-git simply failed with some libzip compression error.

Has anyone had any success converting a hg repo to git on Windows?

To be clear, I don't care about interop. I want to port the whole repo from hg to git, taking the history with me. I don't need to push changes back and forth - only convert once.

Thanks in advance!

A: 

There doesn't seem to be any reason you can't run hg2git on windows. It's python which has a windows port. Just make sure the proper libraries are there and run it on the window box.

Jeremy Wall
No unfortunately not. I tried running the py scripts directly and I couldn't invoke them due to not being able to execute .sh on Win..And I really don't want to install cygwin for this.
Tigraine
A: 

If you're really only looking to do it this once you can use hg export like this:

hg export 0:tip -o all-changesets-in-one.patch

or if git prefers only one patch per file you can create one per changeset like this:

hg export 0:tip -o changeset-%r.patch

presumably git apply can take one or the other of those formats.

Ry4an
Thanks, but unfortunately I didn't find a way to make git apply those patches and preserve the commit message.
Tigraine
Really? Managing patches received by email is one of the things git is supposed to do well, and mercurial uses the git diff format, so I'd think with minimal massaging you could get the emailed patches applied.
Ry4an
I also have to admit that I didn't really try all that hard. It kept reporting a whitespace error in the file. Seems like "hg export --diff" isn't the same patch format after all..
Tigraine