Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
237 views
in Technique[技术] by (71.8m points)

python - 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?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
  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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...