Using the Mercurial version control system
Learn how to use the Mercurial version control system on hosting.com servers.
About Mercurial
Mercurial is a Python-based version control system installed on all hosting.com shared servers. Like other version control systems, Mercurial allows you to track multiple revisions of files and directories.
Creating a repository
-
Log in to your hosting.com account using SSH.
-
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:
-
Log in using SSH.
-
Navigate to the
cgi-bindirectory:
cd ~/public_html/cgi-bin
-
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 hosting.com account username and repository with the path to your repository.
-
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
More information
-
Official Mercurial website: http://mercurial.selenic.com
-
Complete online tutorial: http://hginit.com
-
Free online book about Mercurial: http://hgbook.red-bean.com/read