"A human being should be able to change a diaper, plan an invasion, butcher a hog, conn a ship, design a building, write a sonnet, balance accounts, build a wall, set a bone, comfort the dying, take orders, give orders, cooperate, act alone, solve equations, analyze a new problem, pitch manure, program a computer, cook a tasty meal, fight efficiently, die gallantly. Specialization is for insects." (Robert A. Heinlein)

Wednesday, 31 July 2013

Mercurial and Mercurial-server : playing with DVCS (part 1)

Version control systems (VCS) are an indispensable tool when programming and sharing code even for small groups. Even while programming alone, but on different computers, a version control system could easily prove useful for securely sharing code between desktop and laptop computer. I use daily SVN, as version control while at work. For my homely experiments, instead, I decided to install something different: Mercurial, a distributed version control system (DVCS). Distributed version control systems, most famous are Git and Mercurial, do not rely on a central server to keep the code repository, in DVCS every developing computer keeps its own copy of the repository. What interested me in DVCS was the capability to do version control also when off-line and also, of course, the chance to learn something new.

Installing Mercurial (command-line and plugged-in)

Installing Mercurial command-line version it's quite trivial:
sudo apt-get install mercurial
Both Eclipse and Netbeans offers their plug-ins to interface with Mercurial. Netbeans plug-in is already provided with version 7.3.1 I have installed on the EEEPC. On Eclipse, desktop-side, installing the MercurialEclipse plug-in has been as simple as selecting it from the Eclipse Marketplace and following installation wizard.

Sharing the first project

Both plug-ins hide quite well the process of initializing a local repository and committing the code. From Eclipse after selecting “Team → Share Project” from the project contextual menu, selecting the Mercurial plug-in
the plug-in then asks for the local repository location.
the repository is placed, by default, in the same path of the project but another path can be selected.
Once the project has been connected to the local repository files must be committed by selecting “Team → Commit” from project contextual menu.
Sharing a project using Netbeans plug-in is somewhat similar, apart for the different terminology:
from the project contextual menu selecting the “Versioning → Initialize Mercurial Project” starts the repository initialization wizard, the only information requested is the repository path.
Then files can be committed by selecting “Mercurial → Add” from project menu. A dialog is shown, very similar to to its Eclipse equivalent
In my next post I'll try to Install and configure, on my desktop computer, mercurial-server a mercurial server implementation.

No comments :

Post a comment