views:

96

answers:

4

I'm really quite frustrated at this point. I have an existing hg repository that has months of coding history in it, and I want to get this into a private Github repository so I can work on it from there. Unfortunately I use Windows and I can't seem to find any way to convert the repository that I can actually get to work properly. Practically every bit of help and advice I can find online seems to assume I'm running from some kind *nix shell, which I'm not.

I currently have installed: TortoiseHG, Python 3.1 and Git for Windows.

What I've tried:

  1. hg-init plugin for hg - When I try to use the gexport command (and others from hg-git), I just get strings of python exceptions. I totally can't get git to even recognise the gremote command. I tried following what was here: http://github.com/blog/439-hg-git-mercurial-plugin

  2. hg-to-git (fast-export) - All tutorials keep expecting me to run a .sh file. Another stackoverflow thread seemed to imply that Powershell can run .sh files, but I can't make it run them for the life of me. Example: http://hivelogic.com/articles/converting-from-mercurial-to-git

  3. Mercurial to git converter - http://permalink.gmane.org/gmane.comp.version-control.git/36601 - This one doesn't want to work when I run it via Python, which complains that it has a syntax error on line 44. I don't know python, so I've got no idea.

Four hours of Google searching and wading through useless tutorials and people-more-fortunate-than-me singing the praises of each supposedly-helpful blog post, but I haven't gotten anywhere with this. Can anyone offer any assistance or suggestions for me to try?

A: 

Have you considered installing msysgit? The git bash shell it gives you should be able to run .sh files.

Amber
If I don't know anything about bash, could I run into trouble?
Nathan Ridley
As long as you go carefully, you should be okay - plus, picking up at least some rudimentary linux command-line skills is probably a good thing to do for any developer.
Amber
May I ask why this was voted down?
Amber
+1 to cancel out the negatives. Seems like a valid answer to me
Chris T
I installed msysgit and ran bash, but the script still won't run because it can't import the Mercurial module, and I'm not sure how to resolve that.
Nathan Ridley
A: 

It might seem silly (or a solution for the desperate...) but I think that Bazaar has good support for both Hg and Git repositories, and it works well on Windows.
So if all else fails, maybe you can use bzr-hg and bzr-git to make the conversion...

PhiLho
Possibly, I'd prefer to not have to install yet another source control system though...
Nathan Ridley
+1  A: 
  1. Install Cygwin (with python, hg, git)
  2. Install git-hg
  3. run git-hg clone ...url...

Or tell me what the url is for this hg repo of yours, and I can convert it for you.

Erik Vold
Thankyou, you rock. This Cygwin thing is kinda cool actually! Now I can treat windows sorta like Linux. To clarify, after installing cygwin, I then followed the instructions at http://hivelogic.com/articles/converting-from-mercurial-to-git - I had some trouble before I discovered that I had to merge any stray heads. Once I was down to a single head, the conversion worked just fine.
Nathan Ridley
Np, I'm glad you were able to convert to git =]
Erik Vold
+1  A: 

Python 3.x has non-backward-compatible syntax with Python 2.x, which at least explains the syntax error in #3.

Mark Tolonen
I have uninstalled Python 3 and installed Python 2.6. I managed to get the script to run but near the end it had some errors and also deleted a bunch of my .cs files :(
Nathan Ridley