threads / discuss / 31585

Can git pull from a mercurial repository?

Subject: Can git pull from a mercurial repository?

## tl;dr

19 messages between Sep 18, 2012 and Oct 17, 2012.

replies: 18people: 9as markdown or json

Andreas Ericsson· Sep 18, 2012, 11:46 UTC · re: Joachim Schmitz · lore

Re: Can git pull from a mercurial repository?

On 09/18/2012 01:22 PM, Joachim Schmitz wrote:
> 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.
-- 
Andreas Ericsson                   andreas.ericsson@op5.se
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.
Joachim Schmitz· Sep 18, 2012, 12:40 UTC · re: Andreas Ericsson · lore

RE: Can git pull from a mercurial repository?

Show 11 quoted lines
> From: Andreas Ericsson [mailto:ae@op5.se]
> Sent: Tuesday, September 18, 2012 1:46 PM
> To: Joachim Schmitz
> Cc: git@vger.kernel.org
> Subject: Re: Can git pull from a mercurial repository?
> 
> On 09/18/2012 01:22 PM, Joachim Schmitz wrote:
> > 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...

Gelonida N· Sep 25, 2012, 07:43 UTC · re: Joachim Schmitz · lore

Re: Can git pull from a mercurial repository?

On 09/18/2012 02:40 PM, Joachim Schmitz wrote:
Show 17 quoted lines
>> From: Andreas Ericsson [mailto:ae@op5.se]
>> Sent: Tuesday, September 18, 2012 1:46 PM
>> To: Joachim Schmitz
>> Cc: git@vger.kernel.org
>> Subject: Re: Can git pull from a mercurial repository?
>>
>> On 09/18/2012 01:22 PM, Joachim Schmitz wrote:
>>> 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...

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)

Joachim Schmitz· Sep 25, 2012, 12:56 UTC · re: Gelonida N · lore

Re: Can git pull from a mercurial repository?

Gelonida N wrote:
Show 24 quoted lines
> On 09/18/2012 02:40 PM, Joachim Schmitz wrote:
>>> From: Andreas Ericsson [mailto:ae@op5.se]
>>> Sent: Tuesday, September 18, 2012 1:46 PM
>>> To: Joachim Schmitz
>>> Cc: git@vger.kernel.org
>>> Subject: Re: Can git pull from a mercurial repository?
>>>
>>> On 09/18/2012 01:22 PM, Joachim Schmitz wrote:
>>>> 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...
>
> 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.

> 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
Martin Langhoff· Sep 25, 2012, 14:39 UTC · re: Joachim Schmitz · lore

Re: Can git pull from a mercurial repository?

On Tue, Sep 25, 2012 at 8:56 AM, Joachim Schmitz <jojo@schmitz-digital.de> wrote:

> 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
-- 
 martin.langhoff@gmail.com
 martin@laptop.org -- Software Architect - OLPC
 - ask interesting questions
 - don't get distracted with shiny stuff  - working code first
 - http://wiki.laptop.org/go/User:Martinlanghoff
Max Horn· Sep 25, 2012, 14:15 UTC · re: Joachim Schmitz · lore

Re: Can git pull from a mercurial repository?

Hi there,
On 18.09.2012, at 14:40, Joachim Schmitz wrote:
Show 13 quoted lines
>> From: Andreas Ericsson [mailto:ae@op5.se]
>> Sent: Tuesday, September 18, 2012 1:46 PM
>> To: Joachim Schmitz
>> Cc: git@vger.kernel.org
>> Subject: Re: Can git pull from a mercurial repository?
>> 
>> On 09/18/2012 01:22 PM, Joachim Schmitz wrote:
>>> 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:
> 
> 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

Joachim Schmitz· Sep 25, 2012, 14:42 UTC · re: Max Horn · lore

RE: Can git pull from a mercurial repository?

Show 26 quoted lines
> From: Max Horn [mailto:postbox@quendi.de]
> Sent: Tuesday, September 25, 2012 4:15 PM
> To: Joachim Schmitz
> Cc: 'Andreas Ericsson'; git@vger.kernel.org
> Subject: Re: Can git pull from a mercurial repository?
> 
> Hi there,
> 
> 
> On 18.09.2012, at 14:40, Joachim Schmitz wrote:
> 
> >> From: Andreas Ericsson [mailto:ae@op5.se]
> >> Sent: Tuesday, September 18, 2012 1:46 PM
> >> To: Joachim Schmitz
> >> Cc: git@vger.kernel.org
> >> Subject: Re: Can git pull from a mercurial repository?
> >>
> >> On 09/18/2012 01:22 PM, Joachim Schmitz wrote:
> >>> 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
Show 11 quoted 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:
> 
> 
> >
> > 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
Show 5 quoted 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
> 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.

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)

> 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).
No, please don't. Rather make that clear on https://github.com/fingolfin/git/commits/remote-hg ...
Bye, Jojo
Georgi Chorbadzhiyski· Sep 26, 2012, 07:38 UTC · re: Max Horn · lore

Re: Can git pull from a mercurial repository?

Around 09/25/2012 05:15 PM, Max Horn scribbled:
> 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/

-- 
Georgi Chorbadzhiyski
http://georgi.unixsol.org/
Max Horn· Sep 26, 2012, 08:46 UTC · re: Georgi Chorbadzhiyski · lore

Re: Can git pull from a mercurial repository?

On 26.09.2012, at 09:38, Georgi Chorbadzhiyski wrote:
Show 5 quoted lines
> Around 09/25/2012 05:15 PM, Max Horn scribbled:
>> 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

Georgi Chorbadzhiyski· Sep 26, 2012, 09:46 UTC · re: Max Horn · lore

Re: Can git pull from a mercurial repository?

Around 09/26/2012 11:46 AM, Max Horn scribbled:
Show 8 quoted lines
> On 26.09.2012, at 09:38, Georgi Chorbadzhiyski wrote:
>> Around 09/25/2012 05:15 PM, Max Horn scribbled:
>>> 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/
Cosmin Stejerean· Sep 26, 2012, 20:21 UTC · re: Georgi Chorbadzhiyski · lore

Re: Can git pull from a mercurial repository?

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
On Wed, Sep 26, 2012 at 4:46 AM, Georgi Chorbadzhiyski <gf@unixsol.org> wrote:
Show 20 quoted lines
> Around 09/26/2012 11:46 AM, Max Horn scribbled:
>> On 26.09.2012, at 09:38, Georgi Chorbadzhiyski wrote:
>>> Around 09/25/2012 05:15 PM, Max Horn scribbled:
>>>> 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/
Felipe Contreras· Oct 17, 2012, 12:44 UTC · re: Max Horn · lore

Re: Can git pull from a mercurial repository?

Hi,
On Tue, Sep 25, 2012 at 4:15 PM, Max Horn <postbox@quendi.de> wrote:
Show 21 quoted lines
> On 18.09.2012, at 14:40, Joachim Schmitz wrote:
>
>>> From: Andreas Ericsson [mailto:ae@op5.se]
>>> Sent: Tuesday, September 18, 2012 1:46 PM
>>> To: Joachim Schmitz
>>> Cc: git@vger.kernel.org
>>> Subject: Re: Can git pull from a mercurial repository?
>>>
>>> On 09/18/2012 01:22 PM, Joachim Schmitz wrote:
>>>> 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

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.
-- 
Felipe Contreras
Felipe Contreras· Oct 17, 2012, 13:29 UTC · re: Felipe Contreras · lore

Re: Can git pull from a mercurial repository?

On Wed, Oct 17, 2012 at 2:44 PM, Felipe Contreras <felipe.contreras@gmail.com> wrote:

> On Tue, Sep 25, 2012 at 4:15 PM, Max Horn <postbox@quendi.de> wrote:
> And here's a new one:
> https://github.com/felipec/git/blob/fc-remote-hd/contrib/remote-hd/git-remote-hg

Er: https://github.com/felipec/git/blob/fc-remote-hg/contrib/remote-hg/git-remote-hg

-- 
Felipe Contreras
Georgi Chorbadzhiyski· Sep 18, 2012, 12:06 UTC · re: Joachim Schmitz · lore

Re: Can git pull from a mercurial repository?

Around 09/18/2012 02:22 PM, Joachim Schmitz scribbled:
> 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.

-- 
Georgi Chorbadzhiyski
http://georgi.unixsol.org/
Joachim Schmitz· Sep 18, 2012, 12:10 UTC · re: Georgi Chorbadzhiyski · lore

RE: Can git pull from a mercurial repository?

Show 11 quoted lines
> From: Georgi Chorbadzhiyski [mailto:gf@unixsol.org]
> Sent: Tuesday, September 18, 2012 2:06 PM
> To: Joachim Schmitz
> Cc: git@vger.kernel.org
> Subject: Re: Can git pull from a mercurial repository?
> 
> Around 09/18/2012 02:22 PM, Joachim Schmitz scribbled:
> > 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
Andreas Schwab· Sep 18, 2012, 12:33 UTC · re: Joachim Schmitz · lore

Re: Can git pull from a mercurial repository?

"Joachim Schmitz" <jojo@schmitz-digital.de> writes:
> 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.
-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."
Joachim Schmitz· Sep 18, 2012, 12:40 UTC · re: Andreas Schwab · lore

RE: Can git pull from a mercurial repository?

Show 13 quoted lines
> From: Andreas Schwab [mailto:schwab@linux-m68k.org]
> Sent: Tuesday, September 18, 2012 2:34 PM
> To: Joachim Schmitz
> Cc: 'Georgi Chorbadzhiyski'; git@vger.kernel.org
> Subject: Re: Can git pull from a mercurial repository?
> 
> "Joachim Schmitz" <jojo@schmitz-digital.de> writes:
> 
> > 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...

Andreas Schwab· Sep 18, 2012, 12:56 UTC · re: Joachim Schmitz · lore

Re: Can git pull from a mercurial repository?

"Joachim Schmitz" <jojo@schmitz-digital.de> writes:
> Git can access cvs and svn repos, right?
It uses the facilities provided by cvs and svn, respectively.
> And without having cvs/scv on the machine...
Git does not reimplement either cvs nor svn.
Andreas.
-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

← back to recent threads