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.
Creating a repository
Section titled “Creating a repository”- Log in to your Ruachost account using SSH.
- Create a repository by typing:
hg init repositoryReplace 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 serveconfig = "/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, wsgicgiapplication = hgweb(config)wsgicgi.launch(application)Replace username with your Ruachost account username and repository with the path to your repository.
- Save the file and make it executable:
chmod 755 filenameReplace filename with the name of the file you created.
The repository is now available on the web at:
http://www.example.com/cgi-bin/filenameReplace 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/filenameMore information
Section titled “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