views:

2549

answers:

4

I use GIT on a Mac. Enough said. I have the tools, I have the experience. And I want to continue to use it. No wars here...

The problem is always with interoperability. Most people use SVN, which is great for me. Git SVN works out of the box, and is a no frills solution. People can continue happily use SVN and I don't loose my workflow and neither my tools.

Now... Some guys come along with Mercurial. Fine for them: they have their reasons. But I can't find any GIT HG out-of-the-box. I don't want to switch to HG, but I still need to interoperate with their repository.

Any of you guys know a simple solution for this?

+1  A: 

Hg-Git Mercurial Plugin. Haven't tried it myself, but might be worth checking out.

Magnus Skog
This is a plugin which allows mercurial users to push and pull from git repos, not the other way around, which is what the OP wants.
sykora
+3  A: 

You can try hg2git, which is python script and is part of fast-export, which you can find at http://repo.or.cz/w/fast-export.git .

You'll need to have mercurial installed though.

sykora
This converted an hg repo into a git repo, thank you very much!
wizard
+1  A: 

Since hg-git is a two-way bridge, it will also allow you to push changesets from Git to Mercurial. I have also not tried the extension, but as far as I know it is the only option for Mercurial <-> Git interoperability.

Martin Geisler
+27  A: 

You should be able to use hg-git.

hg clone <hg repository>

edit ~/.hgrc and add :

[extensions]
hgext.bookmarks =
hggit =

create a bookmark so you will have a master in git :

hg bookmark -r default master

edit .hg/hgrc in the repository and add :

[git]
intree = true

now you can create the git repository :

hg gexport

and you can use the resulting directory as a git clone. pulling from mercurial would be :

hg pull
hg gexport

and pushing to mercurial :

hg gimport
hg push

(Yes, you need to use hg with this workflow but your hacking will be all in git)

P.S. If you have a problem with this workflow, please file a bug.

Abderrahim Kitouni
don't forget to run easy_install hg-git first
Christian Oudard
Not exactly what I wanted, but still doable. Thanks.
Hugo S Ferreira