annotate en/tour.tex @ 88:d351032c189c

Progress with log coverage.
author Bryan O'Sullivan <bos@serpentine.com>
date Thu, 12 Oct 2006 10:33:03 -0700
parents 0995016342f8
children 7524d52d9577
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
84
43b9793b4e38 Begin tour chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
1 \chapter{A lightning tour of Mercurial}
43b9793b4e38 Begin tour chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
2 \label{chap:tour}
43b9793b4e38 Begin tour chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
3
43b9793b4e38 Begin tour chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
4 \section{Installing Mercurial on your system}
43b9793b4e38 Begin tour chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
5 \label{sec:tour:install}
43b9793b4e38 Begin tour chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
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
43b9793b4e38 Begin tour chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
11 \subsection{Linux}
43b9793b4e38 Begin tour chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
12
43b9793b4e38 Begin tour chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
13 Because each Linux distribution has its own packaging tools, policies,
43b9793b4e38 Begin tour chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
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
43b9793b4e38 Begin tour chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
18
43b9793b4e38 Begin tour chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
19 To keep things simple, I will focus on installing Mercurial from the
43b9793b4e38 Begin tour chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
20 command line under the most popular Linux distributions. Most of
43b9793b4e38 Begin tour chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
21 these distributions provide graphical package managers that will let
43b9793b4e38 Begin tour chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
22 you install Mercurial with a single click; the package name to look
43b9793b4e38 Begin tour chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
23 for is \texttt{mercurial}.
43b9793b4e38 Begin tour chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
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
43b9793b4e38 Begin tour chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
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
43b9793b4e38 Begin tour chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
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
43b9793b4e38 Begin tour chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
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
43b9793b4e38 Begin tour chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
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
43b9793b4e38 Begin tour chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
52
43b9793b4e38 Begin tour chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
53 \subsection{Mac OS X}
43b9793b4e38 Begin tour chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
54
43b9793b4e38 Begin tour chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
55 Lee Cantey publishes an installer of Mercurial for Mac OS~X at
43b9793b4e38 Begin tour chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
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
43b9793b4e38 Begin tour chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
60
43b9793b4e38 Begin tour chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
61 \subsection{Solaris}
43b9793b4e38 Begin tour chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
62
43b9793b4e38 Begin tour chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
63 XXX.
43b9793b4e38 Begin tour chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
64
43b9793b4e38 Begin tour chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
65 \subsection{Windows}
43b9793b4e38 Begin tour chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
66
43b9793b4e38 Begin tour chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
67 Lee Cantey publishes an installer of Mercurial for Windows at
43b9793b4e38 Begin tour chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
68 \url{http://mercurial.berkwood.com}. This package has no external
43b9793b4e38 Begin tour chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
69 dependencies; it ``just works''.
43b9793b4e38 Begin tour chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
70
43b9793b4e38 Begin tour chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
71 \begin{note}
43b9793b4e38 Begin tour chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
72 The Windows version of Mercurial does not automatically convert line
43b9793b4e38 Begin tour chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
73 endings between Windows and Unix styles. If you want to share work
43b9793b4e38 Begin tour chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
74 with Unix users, you must do a little additional configuration
43b9793b4e38 Begin tour chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
75 work. XXX Flesh this out.
43b9793b4e38 Begin tour chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
76 \end{note}
43b9793b4e38 Begin tour chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
77
87
0995016342f8 More bumf.
Bryan O'Sullivan <bos@serpentine.com>
parents: 85
diff changeset
78 \section{Getting started}
0995016342f8 More bumf.
Bryan O'Sullivan <bos@serpentine.com>
parents: 85
diff changeset
79
0995016342f8 More bumf.
Bryan O'Sullivan <bos@serpentine.com>
parents: 85
diff changeset
80 To begin, we'll use the \hgcmd{version} command to find out whether
0995016342f8 More bumf.
Bryan O'Sullivan <bos@serpentine.com>
parents: 85
diff changeset
81 Mercurial is actually installed properly. The actual version
0995016342f8 More bumf.
Bryan O'Sullivan <bos@serpentine.com>
parents: 85
diff changeset
82 information that it prints isn't so important; it's whether it prints
0995016342f8 More bumf.
Bryan O'Sullivan <bos@serpentine.com>
parents: 85
diff changeset
83 anything at all that we care about.
0995016342f8 More bumf.
Bryan O'Sullivan <bos@serpentine.com>
parents: 85
diff changeset
84 \interaction{tour.version}
0995016342f8 More bumf.
Bryan O'Sullivan <bos@serpentine.com>
parents: 85
diff changeset
85
0995016342f8 More bumf.
Bryan O'Sullivan <bos@serpentine.com>
parents: 85
diff changeset
86 \subsection{Built-in help}
0995016342f8 More bumf.
Bryan O'Sullivan <bos@serpentine.com>
parents: 85
diff changeset
87
0995016342f8 More bumf.
Bryan O'Sullivan <bos@serpentine.com>
parents: 85
diff changeset
88 Mercurial provides a built-in help system. This invaluable for those
0995016342f8 More bumf.
Bryan O'Sullivan <bos@serpentine.com>
parents: 85
diff changeset
89 times when you find yourself stuck trying to remember how to run a
0995016342f8 More bumf.
Bryan O'Sullivan <bos@serpentine.com>
parents: 85
diff changeset
90 command. If you are completely stuck, simply run \hgcmd{help}; it
0995016342f8 More bumf.
Bryan O'Sullivan <bos@serpentine.com>
parents: 85
diff changeset
91 will print a brief list of commands, along with a description of what
0995016342f8 More bumf.
Bryan O'Sullivan <bos@serpentine.com>
parents: 85
diff changeset
92 each does. If you ask for help on a specific command (as below), it
0995016342f8 More bumf.
Bryan O'Sullivan <bos@serpentine.com>
parents: 85
diff changeset
93 prints more detailed information.
0995016342f8 More bumf.
Bryan O'Sullivan <bos@serpentine.com>
parents: 85
diff changeset
94 \interaction{tour.help}
0995016342f8 More bumf.
Bryan O'Sullivan <bos@serpentine.com>
parents: 85
diff changeset
95 For a more impressive level of detail (which you won't usually need)
0995016342f8 More bumf.
Bryan O'Sullivan <bos@serpentine.com>
parents: 85
diff changeset
96 run \hgcmdargs{help}{\hggopt{-v}}. The \hggopt{-v} option is short
0995016342f8 More bumf.
Bryan O'Sullivan <bos@serpentine.com>
parents: 85
diff changeset
97 for \hggopt{--verbose}, and tells Mercurial to print more information
0995016342f8 More bumf.
Bryan O'Sullivan <bos@serpentine.com>
parents: 85
diff changeset
98 than it usually would.
0995016342f8 More bumf.
Bryan O'Sullivan <bos@serpentine.com>
parents: 85
diff changeset
99
0995016342f8 More bumf.
Bryan O'Sullivan <bos@serpentine.com>
parents: 85
diff changeset
100 \section{Working with a repository}
0995016342f8 More bumf.
Bryan O'Sullivan <bos@serpentine.com>
parents: 85
diff changeset
101
0995016342f8 More bumf.
Bryan O'Sullivan <bos@serpentine.com>
parents: 85
diff changeset
102 In Mercurial, everything happens inside a \emph{repository}. The
0995016342f8 More bumf.
Bryan O'Sullivan <bos@serpentine.com>
parents: 85
diff changeset
103 repository for a project contains all of the files that ``belong to''
0995016342f8 More bumf.
Bryan O'Sullivan <bos@serpentine.com>
parents: 85
diff changeset
104 that project, along with a historical record of the project's files.
0995016342f8 More bumf.
Bryan O'Sullivan <bos@serpentine.com>
parents: 85
diff changeset
105
0995016342f8 More bumf.
Bryan O'Sullivan <bos@serpentine.com>
parents: 85
diff changeset
106 There's nothing particularly magical about a repository; it is simply
0995016342f8 More bumf.
Bryan O'Sullivan <bos@serpentine.com>
parents: 85
diff changeset
107 a directory tree in your filesystem that Mercurial treats as special.
0995016342f8 More bumf.
Bryan O'Sullivan <bos@serpentine.com>
parents: 85
diff changeset
108 You can rename delete a repository any time you like, using either the
0995016342f8 More bumf.
Bryan O'Sullivan <bos@serpentine.com>
parents: 85
diff changeset
109 command line or your file browser.
0995016342f8 More bumf.
Bryan O'Sullivan <bos@serpentine.com>
parents: 85
diff changeset
110
88
d351032c189c Progress with log coverage.
Bryan O'Sullivan <bos@serpentine.com>
parents: 87
diff changeset
111 \subsection{Making a local copy of a repository}
87
0995016342f8 More bumf.
Bryan O'Sullivan <bos@serpentine.com>
parents: 85
diff changeset
112
0995016342f8 More bumf.
Bryan O'Sullivan <bos@serpentine.com>
parents: 85
diff changeset
113 \emph{Copying} a repository is just a little bit special. While you
0995016342f8 More bumf.
Bryan O'Sullivan <bos@serpentine.com>
parents: 85
diff changeset
114 could use a normal file copying command to make a copy of a
0995016342f8 More bumf.
Bryan O'Sullivan <bos@serpentine.com>
parents: 85
diff changeset
115 repository, it's best to use a built-in command that Mercurial
0995016342f8 More bumf.
Bryan O'Sullivan <bos@serpentine.com>
parents: 85
diff changeset
116 provides. This command is called \hgcmd{clone}, because it creates an
0995016342f8 More bumf.
Bryan O'Sullivan <bos@serpentine.com>
parents: 85
diff changeset
117 identical copy of an existing repository.
0995016342f8 More bumf.
Bryan O'Sullivan <bos@serpentine.com>
parents: 85
diff changeset
118 \interaction{tour.clone}
0995016342f8 More bumf.
Bryan O'Sullivan <bos@serpentine.com>
parents: 85
diff changeset
119 If our clone succeeded, we should now have a local directory called
0995016342f8 More bumf.
Bryan O'Sullivan <bos@serpentine.com>
parents: 85
diff changeset
120 \dirname{hello}. This directory will contain some files.
0995016342f8 More bumf.
Bryan O'Sullivan <bos@serpentine.com>
parents: 85
diff changeset
121 \interaction{tour.ls}
0995016342f8 More bumf.
Bryan O'Sullivan <bos@serpentine.com>
parents: 85
diff changeset
122 These files have the same contents and history in our repository as
0995016342f8 More bumf.
Bryan O'Sullivan <bos@serpentine.com>
parents: 85
diff changeset
123 they do in the repository we cloned.
0995016342f8 More bumf.
Bryan O'Sullivan <bos@serpentine.com>
parents: 85
diff changeset
124
0995016342f8 More bumf.
Bryan O'Sullivan <bos@serpentine.com>
parents: 85
diff changeset
125 Every Mercurial repository is complete, self-contained, and
0995016342f8 More bumf.
Bryan O'Sullivan <bos@serpentine.com>
parents: 85
diff changeset
126 independent. It contains its own private copy of a project's files
0995016342f8 More bumf.
Bryan O'Sullivan <bos@serpentine.com>
parents: 85
diff changeset
127 and history. A cloned repository remembers the location of the
0995016342f8 More bumf.
Bryan O'Sullivan <bos@serpentine.com>
parents: 85
diff changeset
128 repository it was cloned from, but it does not communicate with that
0995016342f8 More bumf.
Bryan O'Sullivan <bos@serpentine.com>
parents: 85
diff changeset
129 repository, or any other, unless you tell it to.
0995016342f8 More bumf.
Bryan O'Sullivan <bos@serpentine.com>
parents: 85
diff changeset
130
0995016342f8 More bumf.
Bryan O'Sullivan <bos@serpentine.com>
parents: 85
diff changeset
131 What this means for now is that we're free to experiment with our
0995016342f8 More bumf.
Bryan O'Sullivan <bos@serpentine.com>
parents: 85
diff changeset
132 repository, safe in the knowledge that it's a private ``sandbox'' that
0995016342f8 More bumf.
Bryan O'Sullivan <bos@serpentine.com>
parents: 85
diff changeset
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
88
d351032c189c Progress with log coverage.
Bryan O'Sullivan <bos@serpentine.com>
parents: 87
diff changeset
135 \subsection{What's in a repository?}
d351032c189c Progress with log coverage.
Bryan O'Sullivan <bos@serpentine.com>
parents: 87
diff changeset
136
d351032c189c Progress with log coverage.
Bryan O'Sullivan <bos@serpentine.com>
parents: 87
diff changeset
137 When we take a more detailed look inside a repository, we can see that
d351032c189c Progress with log coverage.
Bryan O'Sullivan <bos@serpentine.com>
parents: 87
diff changeset
138 it contains a directory named \dirname{.hg}. This is where Mercurial
d351032c189c Progress with log coverage.
Bryan O'Sullivan <bos@serpentine.com>
parents: 87
diff changeset
139 keeps all of its metadata for the repository.
d351032c189c Progress with log coverage.
Bryan O'Sullivan <bos@serpentine.com>
parents: 87
diff changeset
140 \interaction{tour.ls-a}
d351032c189c Progress with log coverage.
Bryan O'Sullivan <bos@serpentine.com>
parents: 87
diff changeset
141
d351032c189c Progress with log coverage.
Bryan O'Sullivan <bos@serpentine.com>
parents: 87
diff changeset
142 The contents of the \dirname{.hg} directory and its subdirectories are
d351032c189c Progress with log coverage.
Bryan O'Sullivan <bos@serpentine.com>
parents: 87
diff changeset
143 private to Mercurial. Every other file and directory in the
d351032c189c Progress with log coverage.
Bryan O'Sullivan <bos@serpentine.com>
parents: 87
diff changeset
144 repository is yours to do with as you please.
d351032c189c Progress with log coverage.
Bryan O'Sullivan <bos@serpentine.com>
parents: 87
diff changeset
145
d351032c189c Progress with log coverage.
Bryan O'Sullivan <bos@serpentine.com>
parents: 87
diff changeset
146 To introduce a little terminology, the \dirname{.hg} directory is the
d351032c189c Progress with log coverage.
Bryan O'Sullivan <bos@serpentine.com>
parents: 87
diff changeset
147 ``real'' repository, and all of the files and directories that coexist
d351032c189c Progress with log coverage.
Bryan O'Sullivan <bos@serpentine.com>
parents: 87
diff changeset
148 with it are said to live in the ``working directory''. An easy way to
d351032c189c Progress with log coverage.
Bryan O'Sullivan <bos@serpentine.com>
parents: 87
diff changeset
149 remember the distinction is that the \emph{repository} contains the
d351032c189c Progress with log coverage.
Bryan O'Sullivan <bos@serpentine.com>
parents: 87
diff changeset
150 \emph{history} of your project, while the \emph{working directory}
d351032c189c Progress with log coverage.
Bryan O'Sullivan <bos@serpentine.com>
parents: 87
diff changeset
151 contains a \emph{snapshot} of your project at a particular point in
d351032c189c Progress with log coverage.
Bryan O'Sullivan <bos@serpentine.com>
parents: 87
diff changeset
152 history.
d351032c189c Progress with log coverage.
Bryan O'Sullivan <bos@serpentine.com>
parents: 87
diff changeset
153
d351032c189c Progress with log coverage.
Bryan O'Sullivan <bos@serpentine.com>
parents: 87
diff changeset
154 \section{A tour through history}
d351032c189c Progress with log coverage.
Bryan O'Sullivan <bos@serpentine.com>
parents: 87
diff changeset
155
d351032c189c Progress with log coverage.
Bryan O'Sullivan <bos@serpentine.com>
parents: 87
diff changeset
156 One of the first things we might want to do with a new, unfamiliar
d351032c189c Progress with log coverage.
Bryan O'Sullivan <bos@serpentine.com>
parents: 87
diff changeset
157 repository is understand its history. The \hgcmd{log} command gives
d351032c189c Progress with log coverage.
Bryan O'Sullivan <bos@serpentine.com>
parents: 87
diff changeset
158 us a view of history.
d351032c189c Progress with log coverage.
Bryan O'Sullivan <bos@serpentine.com>
parents: 87
diff changeset
159 \interaction{tour.log}
d351032c189c Progress with log coverage.
Bryan O'Sullivan <bos@serpentine.com>
parents: 87
diff changeset
160 By default, this command prints a brief paragraph of output for each
d351032c189c Progress with log coverage.
Bryan O'Sullivan <bos@serpentine.com>
parents: 87
diff changeset
161 change to the project that was recorded. In Mercurial terminology, we
d351032c189c Progress with log coverage.
Bryan O'Sullivan <bos@serpentine.com>
parents: 87
diff changeset
162 call each of these recorded events a \emph{changeset}, because it can
d351032c189c Progress with log coverage.
Bryan O'Sullivan <bos@serpentine.com>
parents: 87
diff changeset
163 contain a record of changes to several files.
d351032c189c Progress with log coverage.
Bryan O'Sullivan <bos@serpentine.com>
parents: 87
diff changeset
164
d351032c189c Progress with log coverage.
Bryan O'Sullivan <bos@serpentine.com>
parents: 87
diff changeset
165 The fields in a record of output from \hgcmd{log} are as follows.
d351032c189c Progress with log coverage.
Bryan O'Sullivan <bos@serpentine.com>
parents: 87
diff changeset
166 \begin{itemize}
d351032c189c Progress with log coverage.
Bryan O'Sullivan <bos@serpentine.com>
parents: 87
diff changeset
167 \item[\texttt{changeset}] This field has the format of a number,
d351032c189c Progress with log coverage.
Bryan O'Sullivan <bos@serpentine.com>
parents: 87
diff changeset
168 followed by a colon, followed by a hexadecimal string. These are
d351032c189c Progress with log coverage.
Bryan O'Sullivan <bos@serpentine.com>
parents: 87
diff changeset
169 \emph{identifiers} for the changeset. There are two identifiers
d351032c189c Progress with log coverage.
Bryan O'Sullivan <bos@serpentine.com>
parents: 87
diff changeset
170 because the number is shorter and easier to type than the hex
d351032c189c Progress with log coverage.
Bryan O'Sullivan <bos@serpentine.com>
parents: 87
diff changeset
171 string.
d351032c189c Progress with log coverage.
Bryan O'Sullivan <bos@serpentine.com>
parents: 87
diff changeset
172 \item[\texttt{user}] The identity of the person who created the
d351032c189c Progress with log coverage.
Bryan O'Sullivan <bos@serpentine.com>
parents: 87
diff changeset
173 changeset. This is a free-form field, but it most often contains a
d351032c189c Progress with log coverage.
Bryan O'Sullivan <bos@serpentine.com>
parents: 87
diff changeset
174 person's name and email address.
d351032c189c Progress with log coverage.
Bryan O'Sullivan <bos@serpentine.com>
parents: 87
diff changeset
175 \item[\texttt{date}] The date and time on which the changeset was
d351032c189c Progress with log coverage.
Bryan O'Sullivan <bos@serpentine.com>
parents: 87
diff changeset
176 created, and the timezone in which it was created. (Thef date and
d351032c189c Progress with log coverage.
Bryan O'Sullivan <bos@serpentine.com>
parents: 87
diff changeset
177 time are local to that timezone; they display what time and date it
d351032c189c Progress with log coverage.
Bryan O'Sullivan <bos@serpentine.com>
parents: 87
diff changeset
178 was for the person who created the changeset.)
d351032c189c Progress with log coverage.
Bryan O'Sullivan <bos@serpentine.com>
parents: 87
diff changeset
179 \item[\texttt{summary}] The first line of the text message that the
d351032c189c Progress with log coverage.
Bryan O'Sullivan <bos@serpentine.com>
parents: 87
diff changeset
180 creator of the changeset entered to describe the changeset.
d351032c189c Progress with log coverage.
Bryan O'Sullivan <bos@serpentine.com>
parents: 87
diff changeset
181 \end{itemize}
d351032c189c Progress with log coverage.
Bryan O'Sullivan <bos@serpentine.com>
parents: 87
diff changeset
182 The default output printed by \hgcmd{log} is purely a summary; it is
d351032c189c Progress with log coverage.
Bryan O'Sullivan <bos@serpentine.com>
parents: 87
diff changeset
183 missing a lot of detail.
d351032c189c Progress with log coverage.
Bryan O'Sullivan <bos@serpentine.com>
parents: 87
diff changeset
184
d351032c189c Progress with log coverage.
Bryan O'Sullivan <bos@serpentine.com>
parents: 87
diff changeset
185 \subsection{Changesets, revisions, and identification}
d351032c189c Progress with log coverage.
Bryan O'Sullivan <bos@serpentine.com>
parents: 87
diff changeset
186
d351032c189c Progress with log coverage.
Bryan O'Sullivan <bos@serpentine.com>
parents: 87
diff changeset
187 English being a notoriously sloppy language, we have a variety of
d351032c189c Progress with log coverage.
Bryan O'Sullivan <bos@serpentine.com>
parents: 87
diff changeset
188 terms that have the same meaning. If you are talking about Mercurial
d351032c189c Progress with log coverage.
Bryan O'Sullivan <bos@serpentine.com>
parents: 87
diff changeset
189 history with other people, you will find that the word ``changeset''
d351032c189c Progress with log coverage.
Bryan O'Sullivan <bos@serpentine.com>
parents: 87
diff changeset
190 is often compressed to ``change'' or ``cset'', and sometimes a
d351032c189c Progress with log coverage.
Bryan O'Sullivan <bos@serpentine.com>
parents: 87
diff changeset
191 changeset is referred to as a ``revision'' or a ``rev''.
d351032c189c Progress with log coverage.
Bryan O'Sullivan <bos@serpentine.com>
parents: 87
diff changeset
192
d351032c189c Progress with log coverage.
Bryan O'Sullivan <bos@serpentine.com>
parents: 87
diff changeset
193 While it doesn't matter what \emph{word} you use to refer to the
d351032c189c Progress with log coverage.
Bryan O'Sullivan <bos@serpentine.com>
parents: 87
diff changeset
194 concept of ``a~changeset'', the \emph{identifier} that you use to
d351032c189c Progress with log coverage.
Bryan O'Sullivan <bos@serpentine.com>
parents: 87
diff changeset
195 refer to ``a~\emph{specific} changeset'' is of great importance.
d351032c189c Progress with log coverage.
Bryan O'Sullivan <bos@serpentine.com>
parents: 87
diff changeset
196 Recall that the \texttt{changeset} field in the output from
d351032c189c Progress with log coverage.
Bryan O'Sullivan <bos@serpentine.com>
parents: 87
diff changeset
197 \hgcmd{log} identifies a changeset using both a number and a
d351032c189c Progress with log coverage.
Bryan O'Sullivan <bos@serpentine.com>
parents: 87
diff changeset
198 hexadecimal string. The number is \emph{only valid in that
d351032c189c Progress with log coverage.
Bryan O'Sullivan <bos@serpentine.com>
parents: 87
diff changeset
199 repository}, while the hex string is the \emph{permanent, unchanging
d351032c189c Progress with log coverage.
Bryan O'Sullivan <bos@serpentine.com>
parents: 87
diff changeset
200 identifier} that will always identify that changeset in every copy
d351032c189c Progress with log coverage.
Bryan O'Sullivan <bos@serpentine.com>
parents: 87
diff changeset
201 of the repository.
d351032c189c Progress with log coverage.
Bryan O'Sullivan <bos@serpentine.com>
parents: 87
diff changeset
202
d351032c189c Progress with log coverage.
Bryan O'Sullivan <bos@serpentine.com>
parents: 87
diff changeset
203 This distinction is important. If you send someone an email talking
d351032c189c Progress with log coverage.
Bryan O'Sullivan <bos@serpentine.com>
parents: 87
diff changeset
204 about ``revision~33'', there's a high likelihood that their
d351032c189c Progress with log coverage.
Bryan O'Sullivan <bos@serpentine.com>
parents: 87
diff changeset
205 revision~33 will \emph{not be the same} as yours. The reason for this
d351032c189c Progress with log coverage.
Bryan O'Sullivan <bos@serpentine.com>
parents: 87
diff changeset
206 is that a revision number depends on the order in which changes
d351032c189c Progress with log coverage.
Bryan O'Sullivan <bos@serpentine.com>
parents: 87
diff changeset
207 arrived in a repository, and there is no guarantee that the same
d351032c189c Progress with log coverage.
Bryan O'Sullivan <bos@serpentine.com>
parents: 87
diff changeset
208 changes will happen in the same order in different repositories.
d351032c189c Progress with log coverage.
Bryan O'Sullivan <bos@serpentine.com>
parents: 87
diff changeset
209 Three changes $a,b,c$ can easily appear in one repository as $0,1,2$,
d351032c189c Progress with log coverage.
Bryan O'Sullivan <bos@serpentine.com>
parents: 87
diff changeset
210 while in another as $1,0,2$.
d351032c189c Progress with log coverage.
Bryan O'Sullivan <bos@serpentine.com>
parents: 87
diff changeset
211
d351032c189c Progress with log coverage.
Bryan O'Sullivan <bos@serpentine.com>
parents: 87
diff changeset
212 Mercurial uses revision numbers purely as a convenient shorthand. If
d351032c189c Progress with log coverage.
Bryan O'Sullivan <bos@serpentine.com>
parents: 87
diff changeset
213 you need to discuss a changeset with someone, or make a record of a
d351032c189c Progress with log coverage.
Bryan O'Sullivan <bos@serpentine.com>
parents: 87
diff changeset
214 changeset for some other reason (for example, in a bug report), use
d351032c189c Progress with log coverage.
Bryan O'Sullivan <bos@serpentine.com>
parents: 87
diff changeset
215 the hexadecimal identifier.
d351032c189c Progress with log coverage.
Bryan O'Sullivan <bos@serpentine.com>
parents: 87
diff changeset
216
d351032c189c Progress with log coverage.
Bryan O'Sullivan <bos@serpentine.com>
parents: 87
diff changeset
217 \subsection{Viewing specific revisions}
d351032c189c Progress with log coverage.
Bryan O'Sullivan <bos@serpentine.com>
parents: 87
diff changeset
218
d351032c189c Progress with log coverage.
Bryan O'Sullivan <bos@serpentine.com>
parents: 87
diff changeset
219 To narrow the output of \hgcmd{log} down to a single revision, use the
d351032c189c Progress with log coverage.
Bryan O'Sullivan <bos@serpentine.com>
parents: 87
diff changeset
220 \hgopt{log}{-r} option. You can use either a revision number or a
d351032c189c Progress with log coverage.
Bryan O'Sullivan <bos@serpentine.com>
parents: 87
diff changeset
221 long-form changeset identifier, and you can provide as many revisions
d351032c189c Progress with log coverage.
Bryan O'Sullivan <bos@serpentine.com>
parents: 87
diff changeset
222 as you want.
d351032c189c Progress with log coverage.
Bryan O'Sullivan <bos@serpentine.com>
parents: 87
diff changeset
223 \interaction{tour.log-r}
d351032c189c Progress with log coverage.
Bryan O'Sullivan <bos@serpentine.com>
parents: 87
diff changeset
224
d351032c189c Progress with log coverage.
Bryan O'Sullivan <bos@serpentine.com>
parents: 87
diff changeset
225 If you want to see the history of several revisions without having to
d351032c189c Progress with log coverage.
Bryan O'Sullivan <bos@serpentine.com>
parents: 87
diff changeset
226 list each one, you can use \emph{range notation}; this lets you
d351032c189c Progress with log coverage.
Bryan O'Sullivan <bos@serpentine.com>
parents: 87
diff changeset
227 express the idea ``I want all revisions between $a$ and $b$,
d351032c189c Progress with log coverage.
Bryan O'Sullivan <bos@serpentine.com>
parents: 87
diff changeset
228 inclusive''.
d351032c189c Progress with log coverage.
Bryan O'Sullivan <bos@serpentine.com>
parents: 87
diff changeset
229 \interaction{tour.log.range}
d351032c189c Progress with log coverage.
Bryan O'Sullivan <bos@serpentine.com>
parents: 87
diff changeset
230 Mercurial also honours the order in which you specify revisions, so
d351032c189c Progress with log coverage.
Bryan O'Sullivan <bos@serpentine.com>
parents: 87
diff changeset
231 \hgcmdargs{log}{-r 2:4} prints $2,3,4$ while \hgcmdargs{log}{-r 4:2}
d351032c189c Progress with log coverage.
Bryan O'Sullivan <bos@serpentine.com>
parents: 87
diff changeset
232 prints $4,3,2$.
d351032c189c Progress with log coverage.
Bryan O'Sullivan <bos@serpentine.com>
parents: 87
diff changeset
233
84
43b9793b4e38 Begin tour chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
234 %%% Local Variables:
43b9793b4e38 Begin tour chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
235 %%% mode: latex
43b9793b4e38 Begin tour chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
236 %%% TeX-master: "00book"
43b9793b4e38 Begin tour chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
237 %%% End: