3

I was working on a git repository and now I need to convert it to a hg repository for some reason. My original git repository has 41 commits and had a size of 320MB.

I am trying to convert the repository using hg convert git-repo hg-repo. This command starts converting the git repo to hg but hangs (does not stop) midway at version number 18. I checked that the size of the hg repo at this time was 50Mb. I know that the rev no. 18 and size=15M are not that significant but hg convert is not printing any error that I can debug.

Does hg print error at some unknown location? Does the size of repository have an effect on the "hg convert" program?

vaultah
  • 44,105
  • 12
  • 114
  • 143
prathmesh.kallurkar
  • 5,468
  • 8
  • 39
  • 50
  • 1
    possible duplicate of [How do I convert a git repository to mercurial?](http://stackoverflow.com/questions/491554/how-do-i-convert-a-git-repository-to-mercurial) - Furthermore, you should report the bug to Selenic. – Kimvais Feb 11 '12 at 12:18
  • If this is a bug, you should report it directly to the Mercurial devs like @Kimvais. – krtek Feb 11 '12 at 13:12
  • @knittl hg-git is also not working. – prathmesh.kallurkar Feb 11 '12 at 17:00
  • @Kimvais but here the tool reported in the given site is not working .. – prathmesh.kallurkar Feb 11 '12 at 17:03
  • @krtek how should i file a bug to mercurial devs. sorry for the stupidity but i have not filed one before. – prathmesh.kallurkar Feb 11 '12 at 17:03
  • @prathmesh.kallurkar You can follow this wiki entry : http://mercurial.selenic.com/wiki/BugTracker – krtek Feb 11 '12 at 17:18
  • Try using `--verbose --debug` in your initial `hg convert` command and see what additional info you're able to provide. – Ry4an Brase Feb 11 '12 at 21:15
  • i tried doing it. the problem is that the conversion is stuck at getting a particular file. The size of the file was very big and i had some troubles in committing it to the repository. I don't remember what exactly happened as this happened some months back. But even if that is the case, should not hg just return saying "i could not fetch that file for you" sort of thing ?? – prathmesh.kallurkar Feb 12 '12 at 06:51

1 Answers1

3

hg convert hasn't been the easiest tool to use in my experience, but hg-git has always worked flawlessly for me. Since you mention having some troubles with the git repository a while back, you should try a full integrity check:

git fsck-objects --full

(I'm assuming the repository is local, but if not, make a local clone and check it there.)

It shouldn't be necessary, but you can force a garbage collection before proceeding:

git gc

and if you're really paranoid, you can follow that up with another integrity check. Using hg git (make sure you have it installed and enabled in .hgrc), it's very easy to do a local Mercurial clone:

hg clone path/to/git/repo path/to/hg/repo

(This may take some time -- you are going through the revisions one by one and resaving them.)

Now, the hg clone will actually have a hidden copy of the git repo stored internally -- you can see this by running git status from within the cloned directory. This hidden copy won't transferred on pull or push, so if you really want get rid of the git heritage, you can do another clone:

hg clone path/to/hg/repo path/to/new/repo

If at some point you decide you want to go back to git, you can also do that using the hidden git repo from hg-git:

git init path/to/new/git/repo
cd path/to/new/git/repo 
git pull path/to/hg/repo/.hg/git

If you don't still have the hybrid repo hanging around, you can recreate it in place via hg gexport (part of hg-git) or use something like git-hg or the hg/brz-bridge for git. See also Git interoperability with a Mercurial Repository.

Community
  • 1
  • 1
Livius
  • 3,240
  • 1
  • 17
  • 28