Mercurial > hgbook
annotate en/tour.tex @ 87:0995016342f8
More bumf.
| author | Bryan O'Sullivan <bos@serpentine.com> |
|---|---|
| date | Wed, 04 Oct 2006 17:11:53 -0700 |
| parents | b7c69a68b0cc |
| children | d351032c189c |
| rev | line source |
|---|---|
| 84 | 1 \chapter{A lightning tour of Mercurial} |
| 2 \label{chap:tour} | |
| 3 | |
| 4 \section{Installing Mercurial on your system} | |
| 5 \label{sec:tour:install} | |
| 6 | |
|
85
b7c69a68b0cc
A little progress on "lightning tour".
Bryan O'Sullivan <bos@serpentine.com>
parents:
84
diff
changeset
|
7 Prebuilt binary packages of Mercurial are available for every popular |
|
b7c69a68b0cc
A little progress on "lightning tour".
Bryan O'Sullivan <bos@serpentine.com>
parents:
84
diff
changeset
|
8 operating system. These make it easy to start using Mercurial on your |
|
b7c69a68b0cc
A little progress on "lightning tour".
Bryan O'Sullivan <bos@serpentine.com>
parents:
84
diff
changeset
|
9 computer immediately. |
|
b7c69a68b0cc
A little progress on "lightning tour".
Bryan O'Sullivan <bos@serpentine.com>
parents:
84
diff
changeset
|
10 |
| 84 | 11 \subsection{Linux} |
| 12 | |
| 13 Because each Linux distribution has its own packaging tools, policies, | |
| 14 and rate of development, it's difficult to give a comprehensive set of | |
|
85
b7c69a68b0cc
A little progress on "lightning tour".
Bryan O'Sullivan <bos@serpentine.com>
parents:
84
diff
changeset
|
15 instructions on how to install Mercurial binaries. The version of |
|
b7c69a68b0cc
A little progress on "lightning tour".
Bryan O'Sullivan <bos@serpentine.com>
parents:
84
diff
changeset
|
16 Mercurial that you will end up with can vary depending on how active |
|
b7c69a68b0cc
A little progress on "lightning tour".
Bryan O'Sullivan <bos@serpentine.com>
parents:
84
diff
changeset
|
17 the person is who maintains the package for your distribution. |
| 84 | 18 |
| 19 To keep things simple, I will focus on installing Mercurial from the | |
| 20 command line under the most popular Linux distributions. Most of | |
| 21 these distributions provide graphical package managers that will let | |
| 22 you install Mercurial with a single click; the package name to look | |
| 23 for is \texttt{mercurial}. | |
| 24 | |
|
85
b7c69a68b0cc
A little progress on "lightning tour".
Bryan O'Sullivan <bos@serpentine.com>
parents:
84
diff
changeset
|
25 \begin{itemize} |
|
b7c69a68b0cc
A little progress on "lightning tour".
Bryan O'Sullivan <bos@serpentine.com>
parents:
84
diff
changeset
|
26 \item[Debian] |
|
b7c69a68b0cc
A little progress on "lightning tour".
Bryan O'Sullivan <bos@serpentine.com>
parents:
84
diff
changeset
|
27 \begin{codesample4} |
|
b7c69a68b0cc
A little progress on "lightning tour".
Bryan O'Sullivan <bos@serpentine.com>
parents:
84
diff
changeset
|
28 apt-get install mercurial |
|
b7c69a68b0cc
A little progress on "lightning tour".
Bryan O'Sullivan <bos@serpentine.com>
parents:
84
diff
changeset
|
29 \end{codesample4} |
| 84 | 30 |
|
85
b7c69a68b0cc
A little progress on "lightning tour".
Bryan O'Sullivan <bos@serpentine.com>
parents:
84
diff
changeset
|
31 \item[Fedora Core] |
|
b7c69a68b0cc
A little progress on "lightning tour".
Bryan O'Sullivan <bos@serpentine.com>
parents:
84
diff
changeset
|
32 \begin{codesample4} |
|
b7c69a68b0cc
A little progress on "lightning tour".
Bryan O'Sullivan <bos@serpentine.com>
parents:
84
diff
changeset
|
33 yum install mercurial |
|
b7c69a68b0cc
A little progress on "lightning tour".
Bryan O'Sullivan <bos@serpentine.com>
parents:
84
diff
changeset
|
34 \end{codesample4} |
| 84 | 35 |
|
85
b7c69a68b0cc
A little progress on "lightning tour".
Bryan O'Sullivan <bos@serpentine.com>
parents:
84
diff
changeset
|
36 \item[Gentoo] |
|
b7c69a68b0cc
A little progress on "lightning tour".
Bryan O'Sullivan <bos@serpentine.com>
parents:
84
diff
changeset
|
37 \begin{codesample4} |
|
b7c69a68b0cc
A little progress on "lightning tour".
Bryan O'Sullivan <bos@serpentine.com>
parents:
84
diff
changeset
|
38 emerge mercurial |
|
b7c69a68b0cc
A little progress on "lightning tour".
Bryan O'Sullivan <bos@serpentine.com>
parents:
84
diff
changeset
|
39 \end{codesample4} |
| 84 | 40 |
|
85
b7c69a68b0cc
A little progress on "lightning tour".
Bryan O'Sullivan <bos@serpentine.com>
parents:
84
diff
changeset
|
41 \item[OpenSUSE] |
|
b7c69a68b0cc
A little progress on "lightning tour".
Bryan O'Sullivan <bos@serpentine.com>
parents:
84
diff
changeset
|
42 \begin{codesample4} |
|
b7c69a68b0cc
A little progress on "lightning tour".
Bryan O'Sullivan <bos@serpentine.com>
parents:
84
diff
changeset
|
43 yum install mercurial |
|
b7c69a68b0cc
A little progress on "lightning tour".
Bryan O'Sullivan <bos@serpentine.com>
parents:
84
diff
changeset
|
44 \end{codesample4} |
| 84 | 45 |
|
85
b7c69a68b0cc
A little progress on "lightning tour".
Bryan O'Sullivan <bos@serpentine.com>
parents:
84
diff
changeset
|
46 \item[Ubuntu] Ubuntu's Mercurial package is particularly old, and you |
|
b7c69a68b0cc
A little progress on "lightning tour".
Bryan O'Sullivan <bos@serpentine.com>
parents:
84
diff
changeset
|
47 should not use it. If you know how, you can rebuild and install the |
|
b7c69a68b0cc
A little progress on "lightning tour".
Bryan O'Sullivan <bos@serpentine.com>
parents:
84
diff
changeset
|
48 Debian package. It's probably easier to build Mercurial from source |
|
b7c69a68b0cc
A little progress on "lightning tour".
Bryan O'Sullivan <bos@serpentine.com>
parents:
84
diff
changeset
|
49 and simply run that; see section~\ref{sec:srcinstall:unixlike} for |
|
b7c69a68b0cc
A little progress on "lightning tour".
Bryan O'Sullivan <bos@serpentine.com>
parents:
84
diff
changeset
|
50 details. |
|
b7c69a68b0cc
A little progress on "lightning tour".
Bryan O'Sullivan <bos@serpentine.com>
parents:
84
diff
changeset
|
51 \end{itemize} |
| 84 | 52 |
| 53 \subsection{Mac OS X} | |
| 54 | |
| 55 Lee Cantey publishes an installer of Mercurial for Mac OS~X at | |
| 56 \url{http://mercurial.berkwood.com}. This package works on both | |
|
85
b7c69a68b0cc
A little progress on "lightning tour".
Bryan O'Sullivan <bos@serpentine.com>
parents:
84
diff
changeset
|
57 Intel-~and Power-based Macs. Before you can use it, you must install |
|
b7c69a68b0cc
A little progress on "lightning tour".
Bryan O'Sullivan <bos@serpentine.com>
parents:
84
diff
changeset
|
58 a compatible version of Universal MacPython~\cite{web:macpython}. This |
|
b7c69a68b0cc
A little progress on "lightning tour".
Bryan O'Sullivan <bos@serpentine.com>
parents:
84
diff
changeset
|
59 is easy to do; simply follow the instructions on Lee's site. |
| 84 | 60 |
| 61 \subsection{Solaris} | |
| 62 | |
| 63 XXX. | |
| 64 | |
| 65 \subsection{Windows} | |
| 66 | |
| 67 Lee Cantey publishes an installer of Mercurial for Windows at | |
| 68 \url{http://mercurial.berkwood.com}. This package has no external | |
| 69 dependencies; it ``just works''. | |
| 70 | |
| 71 \begin{note} | |
| 72 The Windows version of Mercurial does not automatically convert line | |
| 73 endings between Windows and Unix styles. If you want to share work | |
| 74 with Unix users, you must do a little additional configuration | |
| 75 work. XXX Flesh this out. | |
| 76 \end{note} | |
| 77 | |
| 87 | 78 \section{Getting started} |
| 79 | |
| 80 To begin, we'll use the \hgcmd{version} command to find out whether | |
| 81 Mercurial is actually installed properly. The actual version | |
| 82 information that it prints isn't so important; it's whether it prints | |
| 83 anything at all that we care about. | |
| 84 \interaction{tour.version} | |
| 85 | |
| 86 \subsection{Built-in help} | |
| 87 | |
| 88 Mercurial provides a built-in help system. This invaluable for those | |
| 89 times when you find yourself stuck trying to remember how to run a | |
| 90 command. If you are completely stuck, simply run \hgcmd{help}; it | |
| 91 will print a brief list of commands, along with a description of what | |
| 92 each does. If you ask for help on a specific command (as below), it | |
| 93 prints more detailed information. | |
| 94 \interaction{tour.help} | |
| 95 For a more impressive level of detail (which you won't usually need) | |
| 96 run \hgcmdargs{help}{\hggopt{-v}}. The \hggopt{-v} option is short | |
| 97 for \hggopt{--verbose}, and tells Mercurial to print more information | |
| 98 than it usually would. | |
| 99 | |
| 100 \section{Working with a repository} | |
| 101 | |
| 102 In Mercurial, everything happens inside a \emph{repository}. The | |
| 103 repository for a project contains all of the files that ``belong to'' | |
| 104 that project, along with a historical record of the project's files. | |
| 105 | |
| 106 There's nothing particularly magical about a repository; it is simply | |
| 107 a directory tree in your filesystem that Mercurial treats as special. | |
| 108 You can rename delete a repository any time you like, using either the | |
| 109 command line or your file browser. | |
| 110 | |
| 111 \subsection{Making a copy of a repository} | |
| 112 | |
| 113 \emph{Copying} a repository is just a little bit special. While you | |
| 114 could use a normal file copying command to make a copy of a | |
| 115 repository, it's best to use a built-in command that Mercurial | |
| 116 provides. This command is called \hgcmd{clone}, because it creates an | |
| 117 identical copy of an existing repository. | |
| 118 \interaction{tour.clone} | |
| 119 If our clone succeeded, we should now have a local directory called | |
| 120 \dirname{hello}. This directory will contain some files. | |
| 121 \interaction{tour.ls} | |
| 122 These files have the same contents and history in our repository as | |
| 123 they do in the repository we cloned. | |
| 124 | |
| 125 Every Mercurial repository is complete, self-contained, and | |
| 126 independent. It contains its own private copy of a project's files | |
| 127 and history. A cloned repository remembers the location of the | |
| 128 repository it was cloned from, but it does not communicate with that | |
| 129 repository, or any other, unless you tell it to. | |
| 130 | |
| 131 What this means for now is that we're free to experiment with our | |
| 132 repository, safe in the knowledge that it's a private ``sandbox'' that | |
| 133 won't affect anyone else. | |
|
85
b7c69a68b0cc
A little progress on "lightning tour".
Bryan O'Sullivan <bos@serpentine.com>
parents:
84
diff
changeset
|
134 |
| 84 | 135 %%% Local Variables: |
| 136 %%% mode: latex | |
| 137 %%% TeX-master: "00book" | |
| 138 %%% End: |
