Skip to contentSkip to conversation

Can git pull from a mercurial repository?

DISCUSSION Joachim Schmitz 9 participants 19 messages Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

Is there an easy way to get git to clone/pull from a Mercurial repository?

Bye, Jojo

#1 lore raw
Quoted 2 lines · Joachim Schmitz

Is there an easy way to get git to clone/pull from a Mercurial repository?

Yes. Google "git remote helpers" and you'll most likely find it.

Signature · 7 lines
Andreas Ericsson                   [email protected]
OP5 AB                             www.op5.se
Tel: +46 8-230225                  Fax: +46 8-230231

Considering the successes of the wars on alcohol, poverty, drugs and
terror, I think we should give some serious thought to declaring war
on peace.
#2 lore raw
Quoted 11 lines

From: Andreas Ericsson [mailto:[email protected]]
Sent: Tuesday, September 18, 2012 1:46 PM
To: Joachim Schmitz
Cc: [email protected]
Subject: Re: Can git pull from a mercurial repository?

Quoted 2 lines · Joachim Schmitz

Is there an easy way to get git to clone/pull from a Mercurial repository?

Yes. Google "git remote helpers" and you'll most likely find it.

Well, I found a few. No idea how to get them to work though (so far for the 'easy' part of my question)

It seems https://github.com/rfk/git-remote-hg requires Python 2.5 (and I only have 2.4), also I have no idea how to get it installed
https://github.com/SRabbelier/git is 3 years old, apparently never made it into git, guess for a reason?
Then I found https://github.com/fingolfin/git/commits/remote-hg, looks very confusing to me...

#15 lore raw
Quoted 11 lines

From: Georgi Chorbadzhiyski [mailto:[email protected]]
Sent: Tuesday, September 18, 2012 2:06 PM
To: Joachim Schmitz
Cc: [email protected]
Subject: Re: Can git pull from a mercurial repository?

Around 09/18/2012 02:22 PM, Joachim Schmitz scribbled:

Quoted 1 line

Is there an easy way to get git to clone/pull from a Mercurial repository?

I'm using http://offbytwo.com/git-hg/
It works beautifully.

Thanks, but that requires Mercurial to be available, installed and in PATH. I want to use git exactly because I don't have Mercurial (yet?)

Bye, Jojo

#16 lore raw
Quoted 2 lines · Joachim Schmitz

Thanks, but that requires Mercurial to be available, installed and in PATH. I want to use git exactly because I don't have Mercurial (yet?)

That doesn't make sense. If one wants to access a mercurial repository the best way to do that is to use the facilities provided by mercurial.

Andreas.

Signature · 3 lines
Andreas Schwab, [email protected]
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."
#17 lore raw
Quoted 6 lines

From: Andreas Schwab [mailto:[email protected]]
Sent: Tuesday, September 18, 2012 2:34 PM
To: Joachim Schmitz
Cc: 'Georgi Chorbadzhiyski'; [email protected]
Subject: Re: Can git pull from a mercurial repository?

Quoted 7 lines
Quoted 2 lines · Joachim Schmitz

Thanks, but that requires Mercurial to be available, installed and in PATH. I want to use git exactly because I don't have Mercurial (yet?)

That doesn't make sense. If one wants to access a mercurial repository the best way to do that is to use the facilities provided by mercurial.

Not if you don't have Mercurial to begin with.
Git can access cvs and svn repos, right? And without having cvs/scv on the machine...

#18 lore raw
Quoted 1 line · Joachim Schmitz

Git can access cvs and svn repos, right?

It uses the facilities provided by cvs and svn, respectively.

Quoted 1 line

And without having cvs/scv on the machine...

Git does not reimplement either cvs nor svn.

Andreas.

Signature · 3 lines
Andreas Schwab, [email protected]
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."
#3 lore raw
In reply to Joachim Schmitz
Quoted 10 lines · Joachim Schmitz
Quoted 10 lines

From: Andreas Ericsson [mailto:[email protected]]
Sent: Tuesday, September 18, 2012 1:46 PM
To: Joachim Schmitz
Cc: [email protected]
Subject: Re: Can git pull from a mercurial repository?

Quoted 2 lines · Joachim Schmitz

Is there an easy way to get git to clone/pull from a Mercurial repository?

Quoted 7 lines
Quoted 1 line

Yes. Google "git remote helpers" and you'll most likely find it.

Well, I found a few. No idea how to get them to work though (so far for the 'easy' part of my question)

It seems https://github.com/rfk/git-remote-hg requires Python 2.5 (and I only have 2.4), also I have no idea how to get it installed
https://github.com/SRabbelier/git is 3 years old, apparently never made it into git, guess for a reason?
Then I found https://github.com/fingolfin/git/commits/remote-hg, looks very confusing to me...

Install a newer python and hg
Are you really sure, that python 2.5 doesn't exist for your machine? Most non embedded devices should offer python 2.5 or newer (for some distros you just have to add 'alternative' repositories)

#4 lore raw
Quoted 22 lines · Gelonida N
Quoted 12 lines · Joachim Schmitz
Quoted 11 lines

From: Andreas Ericsson [mailto:[email protected]]
Sent: Tuesday, September 18, 2012 1:46 PM
To: Joachim Schmitz
Cc: [email protected]
Subject: Re: Can git pull from a mercurial repository?

Quoted 2 lines · Joachim Schmitz

Is there an easy way to get git to clone/pull from a Mercurial repository?

Yes. Google "git remote helpers" and you'll most likely find it.

Quoted 8 lines

Well, I found a few. No idea how to get them to work though (so far for the 'easy' part of my question) It seems
https://github.com/rfk/git-remote-hg requires Python 2.5 (and I only have 2.4), also I have no idea how to get it installed
https://github.com/SRabbelier/git is 3 years old, apparently never made it into git, guess for a reason? Then I found
https://github.com/fingolfin/git/commits/remote-hg,
looks very confusing to me...

Quoted 2 lines

Install a newer python and hg
Are you really sure, that python 2.5 doesn't exist for your machine?

Yes, I am sure. Python 2.4 had been ported more than 5 years ago by a former workmate, otherwise we wouldn't even have that.

Quoted 2 lines

Most non embedded devices should offer python 2.5 or newer (for some distros you just have to add 'alternative' repositories)

For this platform (HP NonStop) basically nothing is available from any repository on the web but ITUGLIB (http://ituglib.connect-community.org) and that's the machine I'm working on/for ;-)

We're currently trying to port Python-2.7, but it ain't easy...

Bye, Jojo

#5 lore raw
Quoted 3 lines · Joachim Schmitz

For this platform (HP NonStop) basically nothing is available from any repository on the web but ITUGLIB (http://ituglib.connect-community.org) and that's the machine I'm working on/for ;-)

Use a more modern machine as an interim point. You can do the import to git there, then pull from that intermediate repo from pure git.

hth,

m

Signature · 5 lines
 [email protected]
 [email protected] -- Software Architect - OLPC
 - ask interesting questions
 - don't get distracted with shiny stuff  - working code first
 - http://wiki.laptop.org/go/User:Martinlanghoff
#6 lore raw
In reply to Joachim Schmitz

Hi there,

Quoted 6 lines · Joachim Schmitz
Quoted 6 lines

From: Andreas Ericsson [mailto:[email protected]]
Sent: Tuesday, September 18, 2012 1:46 PM
To: Joachim Schmitz
Cc: [email protected]
Subject: Re: Can git pull from a mercurial repository?

Quoted 7 lines
Quoted 5 lines · Joachim Schmitz
Quoted 2 lines

Is there an easy way to get git to clone/pull from a Mercurial repository?

Yes. Google "git remote helpers" and you'll most likely find it.

Well, I found a few. No idea how to get them to work though (so far for the 'easy' part of my question)

I think there is a lot of demand for a "git-hg" bridge, a way to seemlessly access a Mercurial repository as if it was a git repository. A converse to hg-git <http://hg-git.github.com/>

As you discovered, there are several attempts to this. A recent overview over some of them can be found here:

https://github.com/dubiousjim/yagh/blob/master/README.md

Another remark:

Quoted 4 lines

It seems https://github.com/rfk/git-remote-hg requires Python 2.5 (and I only have 2.4), also I have no idea how to get it installed
https://github.com/SRabbelier/git is 3 years old, apparently never made it into git, guess for a reason?
Then I found https://github.com/fingolfin/git/commits/remote-hg, looks very confusing to me...

This is mine, and I am sorry that it causes confusion -- but in fact, my goal it is kind of a continuation of the https://github.com/SRabbelier/git code. OR rather, it collects code others wrote to improve that codebase, and I just added a few fixes that made it work for me.

In particular, I tried to figure out the reasons for why it never made it into git, and in the process, created this Wiki page: <https://github.com/msysgit/msysgit/wiki/Guide-to-git-remote-hg>. Which attempts to document how to use this code, and what needs to be done. My hope was that perhaps more people would be interested in this, and in helping out with it, but so far no such luck.

My goals were noble, but you are the second person who considers this work to be confusing, so if that is what the majority thinks, I am willing to remove that text again (or rather, hide it away in some private repository).

Cheers,
Max

#7 lore raw
Quoted 18 lines

From: Max Horn [mailto:[email protected]]
Sent: Tuesday, September 25, 2012 4:15 PM
To: Joachim Schmitz
Cc: 'Andreas Ericsson'; [email protected]
Subject: Re: Can git pull from a mercurial repository?

Hi there,

Quoted 7 lines · Joachim Schmitz
Quoted 7 lines

From: Andreas Ericsson [mailto:[email protected]]
Sent: Tuesday, September 18, 2012 1:46 PM
To: Joachim Schmitz
Cc: [email protected]
Subject: Re: Can git pull from a mercurial repository?

On 09/18/2012 01:22 PM, Joachim Schmitz wrote:

Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines

Is there an easy way to get git to clone/pull from a Mercurial repository?

Yes. Google "git remote helpers" and you'll most likely find it.

Well, I found a few. No idea how to get them to work though (so far for the 'easy' part of my question)

I think there is a lot of demand for a "git-hg" bridge, a way to seemlessly access a Mercurial repository as if it was a git

repository. A

Quoted 11 lines

converse to hg-git <http://hg-git.github.com/>

As you discovered, there are several attempts to this. A recent overview over some of them can be found here:

https://github.com/dubiousjim/yagh/blob/master/README.md

Another remark:

Quoted 2 lines

It seems https://github.com/rfk/git-remote-hg requires Python 2.5 (and I only have 2.4), also I have no idea how to get it

installed

Quoted 5 lines
Quoted 2 lines

https://github.com/SRabbelier/git is 3 years old, apparently never made it into git, guess for a reason? Then I found https://github.com/fingolfin/git/commits/remote-hg, looks very confusing to me...

This is mine, and I am sorry that it causes confusion -- but in fact, my goal it is kind of a continuation of the
https://github.com/SRabbelier/git code. OR rather, it collects code others wrote to improve that codebase, and I just added a few

fixes

Quoted 4 lines

that made it work for me.

In particular, I tried to figure out the reasons for why it never made it into git, and in the process, created this Wiki page:
<https://github.com/msysgit/msysgit/wiki/Guide-to-git-remote-hg>. Which attempts to document how to use this code, and what needs

to

Quoted 1 line

be done. My hope was that perhaps more people would be interested in this, and in helping out with it, but so far no such luck.

Ah, with that pages it gets much clearer! Only how should anyone know that https://github.com/fingolfin/git/commits/remote-hg is related in any form or shape with https://github.com/msysgit/msysgit/wiki/Guide-to-git-remote-hg?
I'm afraid it still won't help me much though, as I guess it too requites Python 2.5 or later, as it uses the Mercuroal Python API (and that actually may be the reason why it never made it into git? I believe to have read somewhere that git tries to restrict itself to Python 2.4)

Quoted 1 line

My goals were noble, but you are the second person who considers this work to be confusing, so if that is what the majority

thinks, I am

Quoted 1 line

willing to remove that text again (or rather, hide it away in some private repository).

No, please don't. Rather make that clear on https://github.com/fingolfin/git/commits/remote-hg ...

Bye, Jojo

#8 lore raw
In reply to Max Horn

Around 09/25/2012 05:15 PM, Max Horn scribbled:

Quoted 1 line

I think there is a lot of demand for a "git-hg" bridge, a way to seemlessly access a Mercurial repository as if it was a git repository. A converse to hg-git <http://hg-git.github.com/>

I've already mentioned this, but such a tool already exists and it is working very well (IMHO): http://offbytwo.com/git-hg/

Signature · 2 lines
Georgi Chorbadzhiyski
http://georgi.unixsol.org/
#9 lore raw
Quoted 5 lines · Georgi Chorbadzhiyski

Around 09/25/2012 05:15 PM, Max Horn scribbled:

Quoted 1 line

I think there is a lot of demand for a "git-hg" bridge, a way to seemlessly access a Mercurial repository as if it was a git repository. A converse to hg-git <http://hg-git.github.com/>

I've already mentioned this, but such a tool already exists and it is working very well (IMHO): http://offbytwo.com/git-hg/

I guess this is a matter of perspective. It doesn't work at all for me because it does not really support pushing. (It does have a "push" command, but at least last time I looked, it was utterly broken; see also <https://github.com/dubiousjim/yagh/blob/master/Backends.md> for a discussion (not written by me!). I'd be happy to learn that has changed, though I just looked, and it still uses "hg convert", so I don't see how it possibly could work...

Cheers,
Max

#10 lore raw

Around 09/26/2012 11:46 AM, Max Horn scribbled:

Quoted 8 lines · Georgi Chorbadzhiyski
Quoted 5 lines

Around 09/25/2012 05:15 PM, Max Horn scribbled:

Quoted 1 line

I think there is a lot of demand for a "git-hg" bridge, a way to seemlessly access a Mercurial repository as if it was a git repository. A converse to hg-git <http://hg-git.github.com/>

I've already mentioned this, but such a tool already exists and it is working very well (IMHO): http://offbytwo.com/git-hg/

I guess this is a matter of perspective. It doesn't work at all for me because it does not really support pushing. (It does have a "push" command, but at least last time I looked, it was utterly broken; see also <https://github.com/dubiousjim/yagh/blob/master/Backends.md> for a discussion (not written by me!). I'd be happy to learn that has changed, though I just looked, and it still uses "hg convert", so I don't see how it possibly could work...

I have not tested push (I'm using git-hg to sync hg repo and develop using git, no pushing back to hg, just sending patches).

According to git-hg README "Push supported added as well although it is still experimental". You should report the "push" bugs to the author(s) they may be able to fix them.

Signature · 2 lines
Georgi Chorbadzhiyski
http://georgi.unixsol.org/
#11 lore raw

I definitely wrote git-hg for the purpose of checking out a mercurial repo so I can develop locally against it with git and then submit patches. Getting push support was never really a priority for me. Someone did eventually contribute some mechanism for pushing things back in a pull request, so I merged it in. I occasionally get pull requests for minor things around push, so it seems like at least a few people are using it.

The way to get proper push support would be to use the hg-git extension. The git-hg-again project uses that, and if I had some time I'd love to move git-hg over to that approach as well. Patches welcome. Alternatively, you can always https://www.gittip.com/cosmin/
:)

- Cosmin

Quoted 20 lines · Georgi Chorbadzhiyski

Around 09/26/2012 11:46 AM, Max Horn scribbled:

Quoted 8 lines · Georgi Chorbadzhiyski
Quoted 5 lines

Around 09/25/2012 05:15 PM, Max Horn scribbled:

Quoted 1 line

I think there is a lot of demand for a "git-hg" bridge, a way to seemlessly access a Mercurial repository as if it was a git repository. A converse to hg-git <http://hg-git.github.com/>

I've already mentioned this, but such a tool already exists and it is working very well (IMHO): http://offbytwo.com/git-hg/

I guess this is a matter of perspective. It doesn't work at all for me because it does not really support pushing. (It does have a "push" command, but at least last time I looked, it was utterly broken; see also <https://github.com/dubiousjim/yagh/blob/master/Backends.md> for a discussion (not written by me!). I'd be happy to learn that has changed, though I just looked, and it still uses "hg convert", so I don't see how it possibly could work...

I have not tested push (I'm using git-hg to sync hg repo and develop using git, no pushing back to hg, just sending patches).

According to git-hg README "Push supported added as well although it is still experimental". You should report the "push" bugs to the author(s) they may be able to fix them.

--
Georgi Chorbadzhiyski
http://georgi.unixsol.org/

#12 lore raw
In reply to Max Horn

Hi,

Quoted 14 lines · Max Horn
Quoted 12 lines · Joachim Schmitz
Quoted 11 lines

From: Andreas Ericsson [mailto:[email protected]]
Sent: Tuesday, September 18, 2012 1:46 PM
To: Joachim Schmitz
Cc: [email protected]
Subject: Re: Can git pull from a mercurial repository?

Quoted 2 lines · Joachim Schmitz

Is there an easy way to get git to clone/pull from a Mercurial repository?

Yes. Google "git remote helpers" and you'll most likely find it.

Quoted 7 lines
Quoted 1 line

Well, I found a few. No idea how to get them to work though (so far for the 'easy' part of my question)

I think there is a lot of demand for a "git-hg" bridge, a way to seemlessly access a Mercurial repository as if it was a git repository. A converse to hg-git <http://hg-git.github.com/>

As you discovered, there are several attempts to this. A recent overview over some of them can be found here:

https://github.com/dubiousjim/yagh/blob/master/README.md

And here's a new one:
https://github.com/felipec/git/blob/fc-remote-hd/contrib/remote-hd/git-remote-hg

I took a look at several of them, and none satisfied me; too complicated, depends on another tool, hard to install, etc. This one is simple, and works fine. Only for local repositories, and only for fetching at the moment, but it's easy to use, and doesn't require much to install.

I think it has good chances of getting into git mainline, and hopefully other people will help adding the rest of the features. The code is not hard at all :)

Cheers.

Signature · 1 line
Felipe Contreras