[Toybox] Github mirror

Jeremy Huntwork jhuntwork at lightcubesolutions.com
Fri Apr 5 08:50:53 PDT 2013


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.

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 =



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


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

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)


$ 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.

JH



 1365177053.0


More information about the Toybox mailing list