Migrating from Mercurial to Git
Asked Answered
R

1

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!

Rewrite answered 31/7, 2013 at 12:24 Comment(7)
This S.O. question contains a lot of options and links to documentation (not only the fast-export option): #10710750Chirr
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!Gracegraceful
@MF82 I exactly followed that link. See my updateRewrite
how is your python installed?Boneyard
@Boneyard I installed the python-2.6.6.msi.Rewrite
So, what's happening on line 79 of that script? And does the answer of Lazy Badger solve that?Chirr
@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).Rewrite
S
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://[email protected]/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

Suanne answered 31/7, 2013 at 13:43 Comment(5)
Could you please provide more steps?Rewrite
@Rewrite - yes, answer expanded (will be) nowSuanne
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.Rewrite
@Rewrite - I never used pure Mercurial (only THG), thus - can't say anything in this areaSuanne
stuck on the the point (D), how do you build the "git+ssh://[email protected]/lazybadger/Fiver-l10n.git" string?Distaff

© 2022 - 2024 — McMap. All rights reserved.