10

I have tried the instructions from this SO post:

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
git checkout HEAD

However when doing git checkout HEAD it throws:

error: pathspec 'HEAD' did not match any file(s) known to git

What is the work-around for this?

Update:

I managed to install mercurial-python howen when I try to import still it would not work, the error is:

Error: No --marks option given

When doing:

C:\fast-export\hg-fast-export.py -r C:\path\to\repo
Community
  • 1
  • 1
quarks
  • 29,080
  • 65
  • 239
  • 450
  • Did the `~/fast-export/hg-fast-export.sh -r /path/to/old/mercurial_repo` command generate any errors? It sounds like you don't have any commits in your Git repository. – Chris Dec 21 '13 at 18:12
  • @Chris My Hg repository have lots of commits which I need to export to Git. – quarks Dec 21 '13 at 18:27
  • @Chris, oh I see one error when I try to run hg-fast-export.py instead: No module named mercurial – quarks Dec 21 '13 at 18:31
  • Does regular Mercurial work from the command line? Try `hg --version`. – Chris Dec 21 '13 at 18:57
  • @Chris I manage to fix the Hg issue, I have updated my post – quarks Dec 21 '13 at 19:06

1 Answers1

9

Try running hg-fast-export.sh instead of hg-fast-export.py. It looks like the shell wrapper includes an option for --marks for you.

Chris
  • 93,263
  • 50
  • 204
  • 189
  • In Windows it throws './hg-fast-export.py' No such file of directory – quarks Dec 21 '13 at 19:23
  • 1
    `hg-fast-export` doesn't appear to be designed for (or tested on) Windows, as it lacks a `.bat` wrapper. If you want to try it anyway, try this: ``hg-fast-export.py -r path\to\hg\repo --marks .git\hg2git-marks --mapping .git\hg2git-mapping --heads .git\hg2git-heads --status .git\hg2git-state``. This is roughly taken from the shell wrapper. There is some caching and stuff that we're not doing here, but it shouldn't break. You may have to create an empty `.git\hg2git-marks` file first. – Chris Dec 21 '13 at 19:37
  • 5
    I know this is 3 years later, but it took me a day and half trying to work all this out. Adding the `--marks ...` stuff above to the Python call doesn't work, but if you're doing this in Windows, **use the Git bash**. In there, you can use the shell script and it works just fine. – rodeo90 Aug 25 '16 at 18:02
  • it still does not work on windows for me even from under Git bash. – EgoPingvina Aug 21 '20 at 13:26