Moving to Github

Warning: I will move all the sources I maintained on my own mercurial web instance in hg.colas.nahaboo.net to my GitHub repositories: https://github.com/ColasNahaboo/

I have thus redirected the non-functional hg.colas.nahaboo.net to this page.

The move will be gradual, I started with rsync-incr, and I hope to have finished before the end of 2021. Please ask me is you do not see yet your favorite source there.

The reason is that Debian has phased out most of what the web tools for mercurial rely on (python2, wsgi, ...), and thus my web hg repository was broken. And since I wanted anyways to move it to GitHub, it is not worth repairing it.

How to move mercurial (hg) directories to GitHub

As my hg repositories were very simple (no branches, I tend to use cloned repos than branches), what I do to migrate a repository foo to github:

  • I used hg-fast-export
  • I converted the hg repo of foo to a local git repository of the same name, with the main hg branch mapped to github default main instead of the script default of master
  • I created an empty repository foo on github (no files such as README.md, LICENSE, ...)
  • I added it as origin to my local git repo
  • I deleted my hg repo, and git-pushed my local git repo (which became my working repo) to github. Plus I redirected the old hgweb repo urls to the new github repo adress.

I.e. as actual bash commands:

repo=foo                        # the name of the repo to convert
hg=~/hg                         # where are my local hg repos
git=~/git                       # where are my local git repos
hfe=/opt/fast-export            # where is my copy of hg-fast-export.sh
ghn=ColasNahaboo                # my name on github

mkdir $git/$repo
cd $git/$repo
git init
$hfe/hg-fast-export.sh -r "$hg/$repo" -M main -n "$git/$repo"
git branch -M main
git checkout main
git remote add origin git@github.com:$ghn/$repo.git

# Warning: for this last step, the github repo must exist and be empty
git push -u origin main