[Toybox] Github mirror

Rob Landley rob at landley.net
Sat Apr 6 22:57:36 PDT 2013


On 04/05/2013 10:50:53 AM, Jeremy Huntwork wrote:
> Hello,
> 
> After talking with Rob on IRC, I decided to experiment with setting  
> up a github
> mirror of the mercurial repository. The benefits, hopefully, would be  
> failover
> plus easy access for those that like/prefer git.

Cool!

> Here's how I set it up.
> 
> 1. Setup the hg-git plugin
> $ sudo easy_install hg-git
> 
> 2. Edit ~/.hgrc to contain the following:
> [extensions]
> hgext.bookmarks =
> hggit =

Ok, I pointed hggit = at my hg-git binary. I'm guessing that was the  
wrong thing to do.

> 2. Clone the mercurial repo
> $ hg clone http://landley.net/hg/toybox
> 
> 3. Create an empty repository on github called toybox
> 
> 4. In the mercurial working directory, make a bookmark of master for  
> default, so a ref gets created
> $ hg bookmark -r default master

What is a bookmark? I never understood that part...

> 5. Push the repo to the new github location
> $ hg push git+ssh://git@github.com:jhuntwork/toybox.git
> 
> You should obviously be able to see / checkout the repo from  
> https://github.com/jhuntwork/toybox

If you hg update and then re-push it updates the repo? (I've done one  
commit today, small bugfix for -- option parsing.)

> I haven't been able to test too much, but it seems that  
> pushing/pulling can go
> either direction, assuming appropriate permissions are in place. To  
> push changes
> from mercurial to github, it would essentially be:
> $ hg update
> $ hg push git+ssh://git@github.com:jhuntwork/toybox.git
> 
> To forward changes from github to mercurial, It should be able to  
> work like so:
> $ hg pull git+ssh://git@github.com:jhuntwork/toybox.git
> pulling from git+ssh://git@github.com:jhuntwork/toybox.git
> ["git-upload-pack 'jhuntwork/toybox.git'"]
> importing git objects into hg
> ["git-upload-pack 'jhuntwork/toybox.git'"]
> (run 'hg update' to get a working copy)

Hmm, I wonder if the conversion and hash generation is deterministic?  
(If two people convert the repository into separate git repos and one  
pulls from the other, it figures out which changes it already has? Or  
do they have to pull from clones of the same converted git repo?)

> $ hg update
> 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
> 
> 
> $ hg push
> pushing to http://landley.net/hg/toybox
> searching for changes
> remote: ssl required
> 
> 
> 
> I'm obviously using the wrong push scheme, plus I'm missing  
> authentication. :)
> But I think this illustrates the use case.

You got farther than I did, but I tend to ask the wrong questions and  
break stuff. (In this case, trying to actually put something after the  
= in the rc file because I asked "what should go there"...)

It's coming up on 1am, but I'll try this in the morning and see if I  
can actually put something in the old https://github.com/landley/toybox  
directory. :)

Thanks,

Rob
 1365314256.0


More information about the Toybox mailing list