Mercurial_ The Definitive Guide - Bryan O'Sullivan [12]
Mercurial began life in 2005. While a few aspects of its design are influenced by Monotone, Mercurial focuses on ease of use, high performance, and scalability to very large projects.
Chapter 2. A Tour of Mercurial: The Basics
Installing Mercurial on Your System
Prebuilt binary packages of Mercurial are available for every popular operating system. These make it easy to start using Mercurial on your computer immediately.
Windows
The best version of Mercurial for Windows is TortoiseHg, which can be found at http://bitbucket.org/tortoisehg/stable/wiki/Home. This package has no external dependencies; it “just works.” It provides both command-line and graphical user interfaces.
Mac OS X
Lee Cantey publishes an installer of Mercurial for Mac OS X at http://mercurial.berkwood.com.
Linux
Because each Linux distribution has its own packaging tools, policies, and rate of development, it’s difficult to give a comprehensive set of instructions on how to install Mercurial binaries. The version of Mercurial that you will end up with can vary depending on how active the person is who maintains the package for your distribution.
To keep things simple, I will focus on installing Mercurial from the command line under the most popular Linux distributions. Most of these distributions provide graphical package managers that will let you install Mercurial with a single click; the package name to look for is mercurial.
Ubuntu and Debian:apt-get install mercurial
Fedora:yum install mercurial
OpenSUSE:zypper install mercurial
Gentoo:emerge mercurial
Solaris
SunFreeWare, at http://www.sunfreeware.com, provides prebuilt packages of Mercurial.
Getting Started
To begin, we’ll use the hg version command to find out whether Mercurial is installed properly. The actual version information that it prints isn’t so important; we simply care whether the command runs and prints anything at all.
$ hg version
Mercurial Distributed SCM (version 5d25b2f59ade)
Copyright (C) 2005-2008 Matt Mackall This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Built-In Help Mercurial provides a built-in help system. This is invaluable for those times when you find yourself stuck trying to remember how to run a command. If you are completely stuck, simply run hg help; it will print a brief list of commands, along with a description of what each does. If you ask for help on a specific command (as below), it prints more detailed information. $ hg help init hg init [-e CMD] [--remotecmd CMD] [DEST] create a new repository in the given directory Initialize a new repository in the given directory. If the given directory does not exist, it is created. If no directory is given, the current directory is used. It is possible to specify an ssh:// URL as the destination. See 'hg help urls' for more information. options: -e --ssh specify ssh command to use --remotecmd specify hg command to run on the remote side use "hg -v help init" to show global options For a more impressive level of detail (which you won’t usually need) run hg help -v. The -v option is short for --verbose, and tells Mercurial to print more information than it usually would. Working with a Repository In Mercurial, everything happens inside a repository. The repository for a project contains all of the files that “belong to” that project, along with a historical record of the project’s files. There’s nothing particularly magical about a repository; it is simply