Transfer from Mercurial

Copied all code from mercurial repo to git for publishing purposes