Aug 29, 2010

Mercurial - A short tutorial

Why Mercurial?

Mercurial can boast of really unique set of properties that make it a particular good choice as a distributed revision control system.
1. Easy to learn and safe to use
2. Lightweight
3. Delightful extensions and customization
4. Scalable
Download and install the Windows shell extension for Mercurial (TortoiseHg) from here

Creating a Repository

hg init main
where
main is the repository name

Mercurial reads configuration data from several files, if they exist. On Windows, it normally looks for %USERPROFILE%/mercurial.ini file or %USERPROFILE%/.hgrc file and in Unix based machines it looks for $HOME/.hgrc file. For detailed information type hg help config in the command line window or the terminal
Configuring Mercurial

Open %USERPROFILE%/mercurial.ini or %USERPROFILE%/.hgrc file and add following lines to it.

[ui]
username = Firstname Lastname <firstname.lastname@example.net>

This sets the username for the mercurial and this information is for reading by other users

Mercurial has inbuilt lightweight HTTP server that can be used to share the repository.
Serving the Repository

hg serve -p 80 -d
where
-p is used to specify a different port (default port 8000)
-d is used to run the server in the background

Creating a local copy of the Repository

hg clone http://host-name/
This creates a clone of the repository on the local machine

No comments :

Post a Comment