Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

git submodule from Hg repo?

Tags:

I have a very old project that includes the source from another project directly, instead of linking it as a library. Back in the bad days, when I was keeping everything in CVS, I had the external code on a vendor branch and did periodic imports. Now that my project is in git it would make more sense to include the external project as a submodule. But, there's a problem: the external project has migrated to Mercurial. I've found the git-hg and hg-git projects, but I'm not sure if either one handles submodules properly.

Is there a way to create a git submodule that points to an Hg repo instead of a git repo?

like image 713
Brandon Fosdick Avatar asked Jul 02 '09 05:07

Brandon Fosdick


1 Answers

Since the hg-git does mention that submodules are not supported yet, that leaves only a manual option:

  • setup a Git repository somewhere that you have push access to,
  • add it as a Git remote and then
  • run hg gpush from within your project.

For example:

$ cd hg-git # (an Hg repository)
$ hg gremote add origin [email protected]/schacon/hg-git.git
$ hg gpush

That Git repo will represent your submodule, but if you modify and push that submodule, you will still have to pull from that Git repo to the actual Hg repo.

Other great git-hg commands are listed in this "rosetta stone".

like image 66
VonC Avatar answered Nov 15 '22 12:11

VonC