Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Converting a Mercurial (hg) repository to Git on Windows (7)

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?

like image 851
Nathan Ridley Avatar asked Jul 16 '10 17:07

Nathan Ridley


People also ask

Does GitHub work with Mercurial?

hg-github is a Mercurial extension that wraps hg-git, and supports a work-flow where repositories are hosted on Bitbucket and mirrored on GitHub. This work-flow normally requires adding Git paths to each repository's config file, and creating Mercurial bookmarks pointing to the GitHub repository's branch name.

What is hg in Git?

The Hg-Git plugin can convert commits/changesets losslessly from one system to another, so you can push via a Mercurial repository and another Mercurial client can pull it. In theory, the changeset IDs should not change, although this may not hold true for complex histories. Commands.


1 Answers

  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.

like image 102
erikvold Avatar answered Oct 15 '22 21:10

erikvold