4

I know this question asked before several times and marked "possible duplicate", but none of them seems working correct. I tried fast-export and it gives error. Could anyone help How to migrate from Mercurial to Git? I need the history. It would be appreciated if it is listed step by step.

UPDATE:

I tried fast export:

cd ~
git clone git://repo.or.cz/fast-export.git
git init git_repo
cd git_repo
~/fast-export/hg-fast-export.sh -r /path/to/old/mercurial_repo **[I get error in this line]**
git checkout HEAD

this gives error:

..... hg-fast-export.sh: line 79: python: command not found

Thanks for the help!

Dilshod
  • 3,189
  • 3
  • 36
  • 67
  • This S.O. question contains a lot of options and links to documentation (not only the fast-export option): http://stackoverflow.com/questions/10710250/converting-mercurial-folder-to-a-git-repository – Sidney Gijzen Jul 31 '13 at 12:28
  • If you expect us to help you, ***please add more details to your question***. What commands are you using to do the migration? Are there any error messages? What have you already tried that isn't working? The more info you give, the more we can help you! –  Jul 31 '13 at 12:29
  • @MF82 I exactly followed that link. See my update – Dilshod Jul 31 '13 at 12:36
  • how is your python installed? – mnagel Jul 31 '13 at 12:45
  • @mnagel I installed the python-2.6.6.msi. – Dilshod Jul 31 '13 at 12:48
  • So, what's happening on line 79 of that script? And does the answer of Lazy Badger solve that? – Sidney Gijzen Jul 31 '13 at 15:00
  • @MF82 I don't know what is happening on line 79. I am not very familiar with python. I was going to try Lazy Badger's suggestion, but was very confusing (i think that is lack of my English). – Dilshod Jul 31 '13 at 15:26

1 Answers1

5
  1. Add hg-git to Mercurial
  2. Push hg-repo to git-target

Step-by-step Guide

A Clone Hg-Git Extension from it's repository into some local PATH\TO\HG-GIT

B Enable extension in (global mercurial.ini or repository's-specific .hgrc)

[extensions]
bookmarks = 
...
hggit = PATH\TO\HG-GIT

bookmark was added long time ago, when this extension wasn't part of TortoiseHG|Mercurial, not sure about today's configuration

C Create new Git-repository with read|write access to it (or remeber existing?!)

D Add Git-repo from p. C into [paths] section of .hgrc for Mercurial repository, which you want to export in Git under any name. Sample for my local Mercurial repository, which have Git-mirror on Github

[paths]
default = git+ssh://git@github.com/lazybadger/Fiver-l10n.git

E After it you can use Git-repository as usual remote repository in Mercurial and, as fist operation (for created empty Git-repository) you have to push to your new remote

F Check existence of Git-repository with full history from Mercurial mirrored into it after push

G Use Git-repository by usual way

Sources, used in this guide

  • Local Mercurial repository of WP-theme with very easy linear history

Local repo in Workbench

Mirror

Lazy Badger
  • 94,711
  • 9
  • 78
  • 110
  • Could you please provide more steps? – Dilshod Jul 31 '13 at 14:57
  • @Dilshod - yes, answer expanded (will be) now – Lazy Badger Aug 01 '13 at 05:20
  • Thanks for posting everything. I am trying to add extension to my HG, but it is not showing up on the list of extensions. This is how I tried. hgext.bookmarks = hggit = C:/hg_builds/hg-git. and I tried the path with back slashes "\" and with quotes. Not sure whats wrong. – Dilshod Aug 01 '13 at 12:47
  • @Dilshod - I never used pure Mercurial (only THG), thus - can't say anything in this area – Lazy Badger Aug 01 '13 at 15:28
  • stuck on the the point (D), how do you build the "git+ssh://git@github.com/lazybadger/Fiver-l10n.git" string? – serge Mar 12 '18 at 17:35