Skip to content

Using the Mercurial version control system

Using the Mercurial version control system
Learn how to use the Mercurial version control system on Ruachost servers.

About Mercurial
Mercurial is a Python-based version control system installed on all Ruachost shared servers. Like other version control systems, Mercurial allows you to track multiple revisions of files and directories.

  1. Log in to your Ruachost account using SSH.
  2. Create a repository by typing:
hg init repository

Replace repository with the name of the directory where you want to create the repository. If the directory does not exist, hg init will create it.

Publishing a repository
You can make your Mercurial repositories accessible on the web. To do this:

  1. Log in using SSH.
  2. Navigate to the cgi-bin directory:
cd ~/public_html/cgi-bin
  1. Create a file that users will access to reach the repository. Paste the following text into the file:
#!/usr/bin/env python
#
# An example hgweb CGI script, edit as necessary
# See also http://mercurial.selenic.com/wiki/PublishingRepositories
# Path to repo or hgweb config to serve
config = "/home/username/repository"
# Uncomment and adjust if Mercurial is not installed system-wide:
# import sys; sys.path.insert(0, "/path/to/python/lib")
# Uncomment to send python tracebacks to the browser if an error occurs:
# import cgitb; cgitb.enable()
from mercurial import demandimport; demandimport.enable()
from mercurial.hgweb import hgweb, wsgicgi
application = hgweb(config)
wsgicgi.launch(application)

Replace username with your Ruachost account username and repository with the path to your repository.

  1. Save the file and make it executable:
chmod 755 filename

Replace filename with the name of the file you created.

The repository is now available on the web at:

http://www.example.com/cgi-bin/filename

Replace example.com with your domain name and filename with the file you created. To clone the repository, use:

hg clone http://www.example.com/cgi-bin/filename