Re: How to update forked Github repros?

80 views
Skip to first unread message

Augie Fackler

unread,
Sep 13, 2012, 10:11:19 AM9/13/12
to hg-...@googlegroups.com
Edit [paths] in .hg/hgrc and add the path you want to push to with a name.

On Sep 13, 2012, at 9:05 AM, Zsolt Ero wrote:

> Can someone explain to me how can I update forked Github repros?
>
> Let's imaging the following very common situation:
> 1. I fork a project on Github
> 2. I clone my forked project from github using the git+ssh:// protocol into
> Mercurial.
> 3. Now the original project is updated
> 4. How can I update the forked repro? I've found some guide for it:
> http://bradlyfeeley.com/2008/09/03/update-a-github-fork-from-the-original-repo/
>
> but it mentions git remote add, what I have no idea how to do with hg-git:
>
> git remote add --track master mleung git://github.com/mleung/feather.git
> I think it must be a very common situation. How do you do this?
>
> Thanks,
> Zsolt
>
>
> --
> You received this message because you are subscribed to the Google Groups "hg-git" group.
> To view this discussion on the web visit https://groups.google.com/d/msg/hg-git/-/rBRGoUFrlZAJ.
> To post to this group, send email to hg-...@googlegroups.com.
> To unsubscribe from this group, send email to hg-git+un...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/hg-git?hl=en.
>

Augie Fackler

unread,
Sep 13, 2012, 10:16:24 AM9/13/12
to hg-...@googlegroups.com
hg help hgrc

In your clone, your hgrc will likely look like this:
[paths]
default = git://github.com/foo/bar

You want to add a line after the default = line like this:

zsolt = git+ssh://g...@github.com/zslolt/bar

Then you can push to 'zsolt'.

On Sep 13, 2012, at 9:14 AM, Zsolt Ero wrote:

> Sorry, I've just started this whole Mercurial - hg-git - Github combo
> yesterday. Can you tell me a bit more? Like step by step, starting from a
> working fored repro syncing with git+ssh://?
> I know .hgrc, but can you tell me a bit more about paths? What should I
> edit there? A read-only git:// url?
>
> Zsolt
>
>
>
>
> On Thursday, September 13, 2012 4:11:22 PM UTC+2, Augie wrote:
>>
>> Edit [paths] in .hg/hgrc and add the path you want to push to with a name.
>>
>> On Sep 13, 2012, at 9:05 AM, Zsolt Ero wrote:
>>
>>> Can someone explain to me how can I update forked Github repros?
>>>
>>> Let's imaging the following very common situation:
>>> 1. I fork a project on Github
>>> 2. I clone my forked project from github using the git+ssh:// protocol
>> into
>>> Mercurial.
>>> 3. Now the original project is updated
>>> 4. How can I update the forked repro? I've found some guide for it:
>>>
>> http://bradlyfeeley.com/2008/09/03/update-a-github-fork-from-the-original-repo/
>>>
>>> but it mentions git remote add, what I have no idea how to do with
>> hg-git:
>>>
>>> git remote add --track master mleung git://github.com/mleung/feather.git
>>> I think it must be a very common situation. How do you do this?
>>>
>>> Thanks,
>>> Zsolt
>>>
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>> Groups "hg-git" group.
>>> To view this discussion on the web visit
>> https://groups.google.com/d/msg/hg-git/-/rBRGoUFrlZAJ.
>>> To post to this group, send email to hg-...@googlegroups.com<javascript:>.
>>
>>> To unsubscribe from this group, send email to
>> hg-git+un...@googlegroups.com <javascript:>.
>>> For more options, visit this group at
>> http://groups.google.com/group/hg-git?hl=en.
>>>
>>
>>
>
> --
> You received this message because you are subscribed to the Google Groups "hg-git" group.
> To view this discussion on the web visit https://groups.google.com/d/msg/hg-git/-/w1VgSz3IB6EJ.

Zsolt Ero

unread,
Sep 13, 2012, 10:21:00 AM9/13/12
to hg-...@googlegroups.com
I'm confused about which clone is what.
Let's say I have a read-only clone with this hgrc:

[paths]
default = git://github.com/maxexcloo/Minstall.git

and a forked clone with this hgrc:

[paths]
default = git+ssh://g...@github.com/zsero/Minstall.git

Which one should I use? Naturally I'd like to use the forked one, and
enter a new pull url. What you are saying is the opposite, to use the
read-only repro and enter a push url. What should I do?

Zsolt

Augie Fackler

unread,
Sep 13, 2012, 10:24:21 AM9/13/12
to hg-...@googlegroups.com

On Sep 13, 2012, at 9:21 AM, Zsolt Ero wrote:

> I'm confused about which clone is what.
> Let's say I have a read-only clone with this hgrc:
>
> [paths]
> default = git://github.com/maxexcloo/Minstall.git
>
> and a forked clone with this hgrc:
>
> [paths]
> default = git+ssh://g...@github.com/zsero/Minstall.git
>
> Which one should I use? Naturally I'd like to use the forked one, and
> enter a new pull url. What you are saying is the opposite, to use the
> read-only repro and enter a push url. What should I do?

Just edit the hgrc on your clone of your fork, and add a path that'll let you pull from upstream's readonly URL.

Zsolt Ero

unread,
Sep 13, 2012, 10:34:04 AM9/13/12
to hg-...@googlegroups.com
Thank you I've got it working! Now it's just one repro and I just have
to pull from git and push to forked!

A small question: how can I remove patch-1, patch-2, etc. branches from Github?
I've tried the following:
1. merge all branches with local
2. backout to original version
3. remove bookmarks patch-1, patch-2, etc.
4. push to Github

Now if I pull, the bookmarks appear again. Why?

Is it possible to solve this without using git?

Zsolt

Augie Fackler

unread,
Sep 13, 2012, 10:35:45 AM9/13/12
to hg-...@googlegroups.com

On Sep 13, 2012, at 9:34 AM, Zsolt Ero wrote:

> Thank you I've got it working! Now it's just one repro and I just have
> to pull from git and push to forked!
>
> A small question: how can I remove patch-1, patch-2, etc. branches from Github?
> I've tried the following:
> 1. merge all branches with local
> 2. backout to original version
> 3. remove bookmarks patch-1, patch-2, etc.
> 4. push to Github
>
> Now if I pull, the bookmarks appear again. Why?

Because the bookmarks still exist on github.

>
> Is it possible to solve this without using git?

Sadly no. You need to do something like 'git push origin :patch-1' to delete the git branch.

Zsolt Ero

unread,
Sep 13, 2012, 11:36:59 AM9/13/12
to hg-...@googlegroups.com
All, good, fixed using git.

One thing is still not clear, now I've arrived in a situation when I
have two heads, and the master bookmark / "default/master" tag is
stuck on the older one. I'd like to push the tip revision to Github.
How can I do it? I tried moving the master bookmark to the tip, but
then there was an error:

abort: pushing refs/heads/master overwrites 4ef84782783a

Thanks

Augie Fackler

unread,
Sep 13, 2012, 11:51:17 AM9/13/12
to hg-...@googlegroups.com

On Sep 13, 2012, at 10:36 AM, Zsolt Ero wrote:

> All, good, fixed using git.
>
> One thing is still not clear, now I've arrived in a situation when I
> have two heads, and the master bookmark / "default/master" tag is
> stuck on the older one. I'd like to push the tip revision to Github.
> How can I do it? I tried moving the master bookmark to the tip, but
> then there was an error:
>
> abort: pushing refs/heads/master overwrites 4ef84782783a

I think you have to push with --force, if this is the cryptic message I think it is.

David M. Carr

unread,
Sep 13, 2012, 12:05:58 PM9/13/12
to hg-...@googlegroups.com
I've run into the desire to remove a remote branch a time or two
myself, and worked around it as you mentioned, using git. When
working with just Mercurial, my understanding is that the way to
delete a remove bookmark is to delete it locally first, then do a
"push -B deletedBookmarkName" to delete it from the server. Would you
be open to a patch to have "push -B deletedBookmarkName" to a git
repository delete the remote branch, or is there a specific reason
that this functionality doesn't exist in Hg-Git?

--
David M. Carr
davi...@gmail.com

Augie Fackler

unread,
Sep 13, 2012, 12:07:19 PM9/13/12
to hg-...@googlegroups.com

On Sep 13, 2012, at 11:05 AM, David M. Carr wrote:

> I've run into the desire to remove a remote branch a time or two
> myself, and worked around it as you mentioned, using git. When
> working with just Mercurial, my understanding is that the way to
> delete a remove bookmark is to delete it locally first, then do a
> "push -B deletedBookmarkName" to delete it from the server. Would you
> be open to a patch to have "push -B deletedBookmarkName" to a git
> repository delete the remote branch, or is there a specific reason
> that this functionality doesn't exist in Hg-Git?

Send me a patch - it does't work only out of sloth.

Zsolt Ero

unread,
Sep 13, 2012, 12:23:37 PM9/13/12
to hg-...@googlegroups.com
OK with --force it worked perfectly! However now that there are two
heads in Mercurial but only one branch in git, in this moment where is
the second head in git? Is it only present in the mercurial on my
local computer?

After I've created a bookmark for the second head, now it appeared as
a branch. But where was it before?

For removing bookmarks/branches, can you not make a hg hggit
removebookmark command? I mean it doesn't have to be compatible with
the Mercurial naming, just a simple command for deleting small Github
branches, like my patches.

Thanks for all the help!

Zsolt

Augie Fackler

unread,
Sep 13, 2012, 12:25:38 PM9/13/12
to hg-...@googlegroups.com

On Sep 13, 2012, at 11:23 AM, Zsolt Ero wrote:

> OK with --force it worked perfectly! However now that there are two
> heads in Mercurial but only one branch in git, in this moment where is
> the second head in git? Is it only present in the mercurial on my
> local computer?
>
> After I've created a bookmark for the second head, now it appeared as
> a branch. But where was it before?

Not there. Heads can only exist in git if there's a bookmark pointing to them, it's a limitation of git.

>
> For removing bookmarks/branches, can you not make a hg hggit
> removebookmark command? I mean it doesn't have to be compatible with
> the Mercurial naming, just a simple command for deleting small Github
> branches, like my patches.

David's suggestion is better - it'll make hg-git match hg's normal behavior.

Zsolt Ero

unread,
Sep 13, 2012, 12:41:22 PM9/13/12
to hg-...@googlegroups.com
I've just read about that command and it seems quite strange to me.
First you have to delete the local bookmark and then push the deleted
bookmark with -B. I think it makes sense for Mercurial, but for me git
branching it doesn't make sense. I'd actually prefer a removebranch
command that removes both local and remote 'bookmark' in one go, but
that's just my point.

David M. Carr

unread,
Sep 13, 2012, 1:18:41 PM9/13/12
to hg-...@googlegroups.com
Assuming we get the push -B support working, you should be able to
configure an alias that runs the two commands as a single operation.
Reply all
Reply to author
Forward
0 new messages