If only I were

Building Great Software

Archive for February 2010

Getting started with Mercurial on Windows

with one comment

Microsoft made a big move recently by supporting Mercurial on Codeplex. The company I was working for in 2009 was contemplating moving to a DVCS (Distributed Version Control System) and had we made the move, we would have gone to Mercurial. So I’ve been using Mercurial off and on for the last 8 months and have been pleased with the ease of use and the clean command set.

First get and install TortoiseHg – http://tortoisehg.bitbucket.org/

If you are just starting with Mercurial here are some basic commands that will get you going. For the sake of this article, I’m going to use Orchard as the example repository.

-Orchard source url: https://hg01.codeplex.com/orchard

-Clone repository: hg clone https://hg01.codeplex.com/orchard

-Clone repository (named working directory): hg clone https://hg01.codeplex.com/orchard my_dir

-Pull source from remote: hg pull -u

**Note: ‘-u’ is important since it updates your local working copy after pulling the latest

-Local commit: hg ci -m “some message”

**Note: Remember that you are committing to you local repository, you still need to ‘push’ to your remote repository.

-Push commits to remote: hg push

**Note: this command will likely request your credentials

-Check status of local files: hg status

-View the commit log: hg log

-View the most recent commit: hg tip

If you prefer to use visual tools then just type ‘hgtk’ at your command line and you will see all of the commands that will launch visual Mercurial tools. The following is an example for the visual log.

-View visual log of commits: hgtk log

If you have been using git or bazaar, then switching to Mercurial should be trivial.

What I’ve shown here is just the very beginning set of commands for Mercurial. If you want to dig deeper, then you’ll want to read the Hg Book.

Written by Chris Sutton

February 24, 2010 at 9:56 pm

Posted in Technology

Follow

Get every new post delivered to your Inbox.