Monday, June 3, 2013

Using Mercurial as a preferred Source Control

I needed a Source Control to track changes in my projects, I have been hearing good things about Mercurial and its integration into Visual Studio 2010 with the tools like TortoiseHg and VisualHg. Not to mention that Mercurial is an Open Source software and available for free download. Mercurial is a Distributed Version Source Control (DVCS) where each client has entire copy of the repository.

Got a jump start on Installing and integrating Mercurial with a great video here, which shows all the installing as well as configuration process.

Mercurial can be downloaded here.

Its fun to work with Mercurial using the Command line too, though the GUI does take care of your needs. Here's a neat list of commands to execute your changes:

http://searchco.de/lists/list-of-mercurial-commands

One of the important commands that I would like to remember is in below example, which fetches me the changeset along with the filename. I can also specify the range of the changeset. In the example shown, the command will fetch the changes between the changesets 1 and 10.

hg log --stat -r 1:10


I also would like to include the .hgignore file which is quite handy for committing the changes to the repository.

# use glob syntax
syntax: glob

*.obj
*.pdb
*.user
*.aps
*.pch
*.vspscc
*.vssscc
*_i.c
*_p.c
*.ncb
*.suo
*.tlb
*.tlh
*.bak
*.[Cc]ache
*.ilk
*.log
*.lib
*.sbr
*.scc
*.DotSettings
[Bb]in
[Dd]ebug*/**
obj/
[Rr]elease*/**
_ReSharper*/**
NDependOut/**
packages/**
[Tt]humbs.db
[Tt]est[Rr]esult*
[Bb]uild[Ll]og.*
*.[Pp]ublish.xml
*.resharper
*.ncrunch*
*.ndproj


Enjoy!