annotate en/tour-basic.tex @ 556:6ad83df399b7

corrected a problem that was breaking teh build
author Javier Rojas <jerojasro@devnull.li>
date Sun, 21 Dec 2008 12:01:08 -0500
parents 1d277d6aa187
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
95
47ea206351d5 Split tour into two sections.
Bryan O'Sullivan <bos@serpentine.com>
parents: 94
diff changeset
1 \chapter{A tour of Mercurial: the basics}
47ea206351d5 Split tour into two sections.
Bryan O'Sullivan <bos@serpentine.com>
parents: 94
diff changeset
2 \label{chap:tour-basic}
84
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
262
6a847f7902a7 Update description of Ubuntu package.
Bryan O'Sullivan <bos@serpentine.com>
parents: 174
diff changeset
46 \item[Ubuntu] Ubuntu's Mercurial package is based on Debian's. To
6a847f7902a7 Update description of Ubuntu package.
Bryan O'Sullivan <bos@serpentine.com>
parents: 174
diff changeset
47 install it, run the following command.
6a847f7902a7 Update description of Ubuntu package.
Bryan O'Sullivan <bos@serpentine.com>
parents: 174
diff changeset
48 \begin{codesample4}
6a847f7902a7 Update description of Ubuntu package.
Bryan O'Sullivan <bos@serpentine.com>
parents: 174
diff changeset
49 apt-get install mercurial
6a847f7902a7 Update description of Ubuntu package.
Bryan O'Sullivan <bos@serpentine.com>
parents: 174
diff changeset
50 \end{codesample4}
6a847f7902a7 Update description of Ubuntu package.
Bryan O'Sullivan <bos@serpentine.com>
parents: 174
diff changeset
51 The Ubuntu package for Mercurial tends to lag behind the Debian
6a847f7902a7 Update description of Ubuntu package.
Bryan O'Sullivan <bos@serpentine.com>
parents: 174
diff changeset
52 version by a considerable time margin (at the time of writing, seven
6a847f7902a7 Update description of Ubuntu package.
Bryan O'Sullivan <bos@serpentine.com>
parents: 174
diff changeset
53 months), which in some cases will mean that on Ubuntu, you may run
6a847f7902a7 Update description of Ubuntu package.
Bryan O'Sullivan <bos@serpentine.com>
parents: 174
diff changeset
54 into problems that have since been fixed in the Debian package.
85
b7c69a68b0cc A little progress on "lightning tour".
Bryan O'Sullivan <bos@serpentine.com>
parents: 84
diff changeset
55 \end{itemize}
84
43b9793b4e38 Begin tour chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
56
264
f8a2fe77908d 3 small typos
arne@fluss.krababnet
parents: 262
diff changeset
57 \subsection{Solaris}
f8a2fe77908d 3 small typos
arne@fluss.krababnet
parents: 262
diff changeset
58
416
cd595464fea9 Added a source for Solaris Mercurial binaries
Sean Russell <ser@ser1.net>
parents: 264
diff changeset
59 SunFreeWare, at \url{http://www.sunfreeware.com}, is a good source for a
cd595464fea9 Added a source for Solaris Mercurial binaries
Sean Russell <ser@ser1.net>
parents: 264
diff changeset
60 large number of pre-built Solaris packages for 32 and 64 bit Intel and
cd595464fea9 Added a source for Solaris Mercurial binaries
Sean Russell <ser@ser1.net>
parents: 264
diff changeset
61 Sparc architectures, including current versions of Mercurial.
264
f8a2fe77908d 3 small typos
arne@fluss.krababnet
parents: 262
diff changeset
62
84
43b9793b4e38 Begin tour chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
63 \subsection{Mac OS X}
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 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
66 \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
67 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
68 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
69 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
70
412
a168daed199b Fix typos
Simon Ruderich <simon@ruderich.org>
parents: 264
diff changeset
71 It's also possible to install Mercurial using Fink or MacPorts,
a168daed199b Fix typos
Simon Ruderich <simon@ruderich.org>
parents: 264
diff changeset
72 two popular free package managers for Mac OS X. If you have Fink,
a168daed199b Fix typos
Simon Ruderich <simon@ruderich.org>
parents: 264
diff changeset
73 use \command{sudo apt-get install mercurial-py25}. If MacPorts,
a168daed199b Fix typos
Simon Ruderich <simon@ruderich.org>
parents: 264
diff changeset
74 \command{sudo port install mercurial}.
a168daed199b Fix typos
Simon Ruderich <simon@ruderich.org>
parents: 264
diff changeset
75
84
43b9793b4e38 Begin tour chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
76 \subsection{Windows}
43b9793b4e38 Begin tour chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
77
412
a168daed199b Fix typos
Simon Ruderich <simon@ruderich.org>
parents: 264
diff changeset
78 Lee Cantey publishes an installer of Mercurial for Windows at
84
43b9793b4e38 Begin tour chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
79 \url{http://mercurial.berkwood.com}. This package has no external
43b9793b4e38 Begin tour chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
80 dependencies; it ``just works''.
43b9793b4e38 Begin tour chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
81
43b9793b4e38 Begin tour chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
82 \begin{note}
43b9793b4e38 Begin tour chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
83 The Windows version of Mercurial does not automatically convert line
43b9793b4e38 Begin tour chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
84 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
85 with Unix users, you must do a little additional configuration
43b9793b4e38 Begin tour chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
86 work. XXX Flesh this out.
43b9793b4e38 Begin tour chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
87 \end{note}
43b9793b4e38 Begin tour chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
88
87
0995016342f8 More bumf.
Bryan O'Sullivan <bos@serpentine.com>
parents: 85
diff changeset
89 \section{Getting started}
0995016342f8 More bumf.
Bryan O'Sullivan <bos@serpentine.com>
parents: 85
diff changeset
90
0995016342f8 More bumf.
Bryan O'Sullivan <bos@serpentine.com>
parents: 85
diff changeset
91 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
92 Mercurial is actually installed properly. The actual version
0995016342f8 More bumf.
Bryan O'Sullivan <bos@serpentine.com>
parents: 85
diff changeset
93 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
94 anything at all that we care about.
0995016342f8 More bumf.
Bryan O'Sullivan <bos@serpentine.com>
parents: 85
diff changeset
95 \interaction{tour.version}
0995016342f8 More bumf.
Bryan O'Sullivan <bos@serpentine.com>
parents: 85
diff changeset
96
0995016342f8 More bumf.
Bryan O'Sullivan <bos@serpentine.com>
parents: 85
diff changeset
97 \subsection{Built-in help}
0995016342f8 More bumf.
Bryan O'Sullivan <bos@serpentine.com>
parents: 85
diff changeset
98
158
d3f8aec5beff Fix typos in chapter 2.
Steve Guidon <steve.guidon@gmail.com>
parents: 102
diff changeset
99 Mercurial provides a built-in help system. This is invaluable for those
87
0995016342f8 More bumf.
Bryan O'Sullivan <bos@serpentine.com>
parents: 85
diff changeset
100 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
101 command. If you are completely stuck, simply run \hgcmd{help}; it
0995016342f8 More bumf.
Bryan O'Sullivan <bos@serpentine.com>
parents: 85
diff changeset
102 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
103 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
104 prints more detailed information.
0995016342f8 More bumf.
Bryan O'Sullivan <bos@serpentine.com>
parents: 85
diff changeset
105 \interaction{tour.help}
0995016342f8 More bumf.
Bryan O'Sullivan <bos@serpentine.com>
parents: 85
diff changeset
106 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
107 run \hgcmdargs{help}{\hggopt{-v}}. The \hggopt{-v} option is short
0995016342f8 More bumf.
Bryan O'Sullivan <bos@serpentine.com>
parents: 85
diff changeset
108 for \hggopt{--verbose}, and tells Mercurial to print more information
0995016342f8 More bumf.
Bryan O'Sullivan <bos@serpentine.com>
parents: 85
diff changeset
109 than it usually would.
0995016342f8 More bumf.
Bryan O'Sullivan <bos@serpentine.com>
parents: 85
diff changeset
110
0995016342f8 More bumf.
Bryan O'Sullivan <bos@serpentine.com>
parents: 85
diff changeset
111 \section{Working with a repository}
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 In Mercurial, everything happens inside a \emph{repository}. The
0995016342f8 More bumf.
Bryan O'Sullivan <bos@serpentine.com>
parents: 85
diff changeset
114 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
115 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
116
0995016342f8 More bumf.
Bryan O'Sullivan <bos@serpentine.com>
parents: 85
diff changeset
117 There's nothing particularly magical about a repository; it is simply
0995016342f8 More bumf.
Bryan O'Sullivan <bos@serpentine.com>
parents: 85
diff changeset
118 a directory tree in your filesystem that Mercurial treats as special.
158
d3f8aec5beff Fix typos in chapter 2.
Steve Guidon <steve.guidon@gmail.com>
parents: 102
diff changeset
119 You can rename or delete a repository any time you like, using either the
87
0995016342f8 More bumf.
Bryan O'Sullivan <bos@serpentine.com>
parents: 85
diff changeset
120 command line or your file browser.
0995016342f8 More bumf.
Bryan O'Sullivan <bos@serpentine.com>
parents: 85
diff changeset
121
88
d351032c189c Progress with log coverage.
Bryan O'Sullivan <bos@serpentine.com>
parents: 87
diff changeset
122 \subsection{Making a local copy of a repository}
87
0995016342f8 More bumf.
Bryan O'Sullivan <bos@serpentine.com>
parents: 85
diff changeset
123
0995016342f8 More bumf.
Bryan O'Sullivan <bos@serpentine.com>
parents: 85
diff changeset
124 \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
125 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
126 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
127 provides. This command is called \hgcmd{clone}, because it creates an
0995016342f8 More bumf.
Bryan O'Sullivan <bos@serpentine.com>
parents: 85
diff changeset
128 identical copy of an existing repository.
0995016342f8 More bumf.
Bryan O'Sullivan <bos@serpentine.com>
parents: 85
diff changeset
129 \interaction{tour.clone}
0995016342f8 More bumf.
Bryan O'Sullivan <bos@serpentine.com>
parents: 85
diff changeset
130 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
131 \dirname{hello}. This directory will contain some files.
0995016342f8 More bumf.
Bryan O'Sullivan <bos@serpentine.com>
parents: 85
diff changeset
132 \interaction{tour.ls}
0995016342f8 More bumf.
Bryan O'Sullivan <bos@serpentine.com>
parents: 85
diff changeset
133 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
134 they do in the repository we cloned.
0995016342f8 More bumf.
Bryan O'Sullivan <bos@serpentine.com>
parents: 85
diff changeset
135
0995016342f8 More bumf.
Bryan O'Sullivan <bos@serpentine.com>
parents: 85
diff changeset
136 Every Mercurial repository is complete, self-contained, and
0995016342f8 More bumf.
Bryan O'Sullivan <bos@serpentine.com>
parents: 85
diff changeset
137 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
138 and history. A cloned repository remembers the location of the
0995016342f8 More bumf.
Bryan O'Sullivan <bos@serpentine.com>
parents: 85
diff changeset
139 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
140 repository, or any other, unless you tell it to.
0995016342f8 More bumf.
Bryan O'Sullivan <bos@serpentine.com>
parents: 85
diff changeset
141
0995016342f8 More bumf.
Bryan O'Sullivan <bos@serpentine.com>
parents: 85
diff changeset
142 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
143 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
144 won't affect anyone else.
85
b7c69a68b0cc A little progress on "lightning tour".
Bryan O'Sullivan <bos@serpentine.com>
parents: 84
diff changeset
145
88
d351032c189c Progress with log coverage.
Bryan O'Sullivan <bos@serpentine.com>
parents: 87
diff changeset
146 \subsection{What's in a repository?}
d351032c189c Progress with log coverage.
Bryan O'Sullivan <bos@serpentine.com>
parents: 87
diff changeset
147
d351032c189c Progress with log coverage.
Bryan O'Sullivan <bos@serpentine.com>
parents: 87
diff changeset
148 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
149 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
150 keeps all of its metadata for the repository.
d351032c189c Progress with log coverage.
Bryan O'Sullivan <bos@serpentine.com>
parents: 87
diff changeset
151 \interaction{tour.ls-a}
d351032c189c Progress with log coverage.
Bryan O'Sullivan <bos@serpentine.com>
parents: 87
diff changeset
152
d351032c189c Progress with log coverage.
Bryan O'Sullivan <bos@serpentine.com>
parents: 87
diff changeset
153 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
154 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
155 repository is yours to do with as you please.
d351032c189c Progress with log coverage.
Bryan O'Sullivan <bos@serpentine.com>
parents: 87
diff changeset
156
d351032c189c Progress with log coverage.
Bryan O'Sullivan <bos@serpentine.com>
parents: 87
diff changeset
157 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
158 ``real'' repository, and all of the files and directories that coexist
91
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
159 with it are said to live in the \emph{working directory}. An easy way
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
160 to remember the distinction is that the \emph{repository} contains the
88
d351032c189c Progress with log coverage.
Bryan O'Sullivan <bos@serpentine.com>
parents: 87
diff changeset
161 \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
162 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
163 history.
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 \section{A tour through history}
d351032c189c Progress with log coverage.
Bryan O'Sullivan <bos@serpentine.com>
parents: 87
diff changeset
166
d351032c189c Progress with log coverage.
Bryan O'Sullivan <bos@serpentine.com>
parents: 87
diff changeset
167 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
168 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
169 us a view of history.
d351032c189c Progress with log coverage.
Bryan O'Sullivan <bos@serpentine.com>
parents: 87
diff changeset
170 \interaction{tour.log}
d351032c189c Progress with log coverage.
Bryan O'Sullivan <bos@serpentine.com>
parents: 87
diff changeset
171 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
172 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
173 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
174 contain a record of changes to several files.
d351032c189c Progress with log coverage.
Bryan O'Sullivan <bos@serpentine.com>
parents: 87
diff changeset
175
d351032c189c Progress with log coverage.
Bryan O'Sullivan <bos@serpentine.com>
parents: 87
diff changeset
176 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
177 \begin{itemize}
d351032c189c Progress with log coverage.
Bryan O'Sullivan <bos@serpentine.com>
parents: 87
diff changeset
178 \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
179 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
180 \emph{identifiers} for the changeset. There are two identifiers
d351032c189c Progress with log coverage.
Bryan O'Sullivan <bos@serpentine.com>
parents: 87
diff changeset
181 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
182 string.
d351032c189c Progress with log coverage.
Bryan O'Sullivan <bos@serpentine.com>
parents: 87
diff changeset
183 \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
184 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
185 person's name and email address.
d351032c189c Progress with log coverage.
Bryan O'Sullivan <bos@serpentine.com>
parents: 87
diff changeset
186 \item[\texttt{date}] The date and time on which the changeset was
158
d3f8aec5beff Fix typos in chapter 2.
Steve Guidon <steve.guidon@gmail.com>
parents: 102
diff changeset
187 created, and the timezone in which it was created. (The date and
88
d351032c189c Progress with log coverage.
Bryan O'Sullivan <bos@serpentine.com>
parents: 87
diff changeset
188 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
189 was for the person who created the changeset.)
d351032c189c Progress with log coverage.
Bryan O'Sullivan <bos@serpentine.com>
parents: 87
diff changeset
190 \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
191 creator of the changeset entered to describe the changeset.
d351032c189c Progress with log coverage.
Bryan O'Sullivan <bos@serpentine.com>
parents: 87
diff changeset
192 \end{itemize}
d351032c189c Progress with log coverage.
Bryan O'Sullivan <bos@serpentine.com>
parents: 87
diff changeset
193 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
194 missing a lot of detail.
d351032c189c Progress with log coverage.
Bryan O'Sullivan <bos@serpentine.com>
parents: 87
diff changeset
195
99
06383f9e46e4 More graphics.
Bryan O'Sullivan <bos@serpentine.com>
parents: 97
diff changeset
196 Figure~\ref{fig:tour-basic:history} provides a graphical representation of
97
659fa1a2c628 More text.
Bryan O'Sullivan <bos@serpentine.com>
parents: 96
diff changeset
197 the history of the \dirname{hello} repository, to make it a little
659fa1a2c628 More text.
Bryan O'Sullivan <bos@serpentine.com>
parents: 96
diff changeset
198 easier to see which direction history is ``flowing'' in. We'll be
659fa1a2c628 More text.
Bryan O'Sullivan <bos@serpentine.com>
parents: 96
diff changeset
199 returning to this figure several times in this chapter and the chapter
659fa1a2c628 More text.
Bryan O'Sullivan <bos@serpentine.com>
parents: 96
diff changeset
200 that follows.
659fa1a2c628 More text.
Bryan O'Sullivan <bos@serpentine.com>
parents: 96
diff changeset
201
96
7d7ddc3a57af Split tour into two chapters.
Bryan O'Sullivan <bos@serpentine.com>
parents: 95
diff changeset
202 \begin{figure}[ht]
7d7ddc3a57af Split tour into two chapters.
Bryan O'Sullivan <bos@serpentine.com>
parents: 95
diff changeset
203 \centering
7d7ddc3a57af Split tour into two chapters.
Bryan O'Sullivan <bos@serpentine.com>
parents: 95
diff changeset
204 \grafix{tour-history}
7d7ddc3a57af Split tour into two chapters.
Bryan O'Sullivan <bos@serpentine.com>
parents: 95
diff changeset
205 \caption{Graphical history of the \dirname{hello} repository}
99
06383f9e46e4 More graphics.
Bryan O'Sullivan <bos@serpentine.com>
parents: 97
diff changeset
206 \label{fig:tour-basic:history}
96
7d7ddc3a57af Split tour into two chapters.
Bryan O'Sullivan <bos@serpentine.com>
parents: 95
diff changeset
207 \end{figure}
7d7ddc3a57af Split tour into two chapters.
Bryan O'Sullivan <bos@serpentine.com>
parents: 95
diff changeset
208
97
659fa1a2c628 More text.
Bryan O'Sullivan <bos@serpentine.com>
parents: 96
diff changeset
209 \subsection{Changesets, revisions, and talking to other
659fa1a2c628 More text.
Bryan O'Sullivan <bos@serpentine.com>
parents: 96
diff changeset
210 people}
88
d351032c189c Progress with log coverage.
Bryan O'Sullivan <bos@serpentine.com>
parents: 87
diff changeset
211
97
659fa1a2c628 More text.
Bryan O'Sullivan <bos@serpentine.com>
parents: 96
diff changeset
212 As English is a notoriously sloppy language, and computer science has
99
06383f9e46e4 More graphics.
Bryan O'Sullivan <bos@serpentine.com>
parents: 97
diff changeset
213 a hallowed history of terminological confusion (why use one term when
06383f9e46e4 More graphics.
Bryan O'Sullivan <bos@serpentine.com>
parents: 97
diff changeset
214 four will do?), revision control has a variety of words and phrases
06383f9e46e4 More graphics.
Bryan O'Sullivan <bos@serpentine.com>
parents: 97
diff changeset
215 that mean the same thing. If you are talking about Mercurial history
06383f9e46e4 More graphics.
Bryan O'Sullivan <bos@serpentine.com>
parents: 97
diff changeset
216 with other people, you will find that the word ``changeset'' is often
06383f9e46e4 More graphics.
Bryan O'Sullivan <bos@serpentine.com>
parents: 97
diff changeset
217 compressed to ``change'' or (when written) ``cset'', and sometimes a
06383f9e46e4 More graphics.
Bryan O'Sullivan <bos@serpentine.com>
parents: 97
diff changeset
218 changeset is referred to as a ``revision'' or a ``rev''.
88
d351032c189c Progress with log coverage.
Bryan O'Sullivan <bos@serpentine.com>
parents: 87
diff changeset
219
d351032c189c Progress with log coverage.
Bryan O'Sullivan <bos@serpentine.com>
parents: 87
diff changeset
220 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
221 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
222 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
223 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
224 \hgcmd{log} identifies a changeset using both a number and a
97
659fa1a2c628 More text.
Bryan O'Sullivan <bos@serpentine.com>
parents: 96
diff changeset
225 hexadecimal string.
659fa1a2c628 More text.
Bryan O'Sullivan <bos@serpentine.com>
parents: 96
diff changeset
226 \begin{itemize}
659fa1a2c628 More text.
Bryan O'Sullivan <bos@serpentine.com>
parents: 96
diff changeset
227 \item The revision number is \emph{only valid in that repository},
659fa1a2c628 More text.
Bryan O'Sullivan <bos@serpentine.com>
parents: 96
diff changeset
228 \item while the hex string is the \emph{permanent, unchanging
659fa1a2c628 More text.
Bryan O'Sullivan <bos@serpentine.com>
parents: 96
diff changeset
229 identifier} that will always identify that exact changeset in
659fa1a2c628 More text.
Bryan O'Sullivan <bos@serpentine.com>
parents: 96
diff changeset
230 \emph{every} copy of the repository.
659fa1a2c628 More text.
Bryan O'Sullivan <bos@serpentine.com>
parents: 96
diff changeset
231 \end{itemize}
88
d351032c189c Progress with log coverage.
Bryan O'Sullivan <bos@serpentine.com>
parents: 87
diff changeset
232 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
233 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
234 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
235 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
236 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
237 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
238 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
239 while in another as $1,0,2$.
d351032c189c Progress with log coverage.
Bryan O'Sullivan <bos@serpentine.com>
parents: 87
diff changeset
240
d351032c189c Progress with log coverage.
Bryan O'Sullivan <bos@serpentine.com>
parents: 87
diff changeset
241 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
242 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
243 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
244 the hexadecimal identifier.
d351032c189c Progress with log coverage.
Bryan O'Sullivan <bos@serpentine.com>
parents: 87
diff changeset
245
d351032c189c Progress with log coverage.
Bryan O'Sullivan <bos@serpentine.com>
parents: 87
diff changeset
246 \subsection{Viewing specific revisions}
d351032c189c Progress with log coverage.
Bryan O'Sullivan <bos@serpentine.com>
parents: 87
diff changeset
247
d351032c189c Progress with log coverage.
Bryan O'Sullivan <bos@serpentine.com>
parents: 87
diff changeset
248 To narrow the output of \hgcmd{log} down to a single revision, use the
91
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
249 \hgopt{log}{-r} (or \hgopt{log}{--rev}) option. You can use either a
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
250 revision number or a long-form changeset identifier, and you can
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
251 provide as many revisions as you want. \interaction{tour.log-r}
88
d351032c189c Progress with log coverage.
Bryan O'Sullivan <bos@serpentine.com>
parents: 87
diff changeset
252
d351032c189c Progress with log coverage.
Bryan O'Sullivan <bos@serpentine.com>
parents: 87
diff changeset
253 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
254 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
255 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
256 inclusive''.
d351032c189c Progress with log coverage.
Bryan O'Sullivan <bos@serpentine.com>
parents: 87
diff changeset
257 \interaction{tour.log.range}
d351032c189c Progress with log coverage.
Bryan O'Sullivan <bos@serpentine.com>
parents: 87
diff changeset
258 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
259 \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
260 prints $4,3,2$.
d351032c189c Progress with log coverage.
Bryan O'Sullivan <bos@serpentine.com>
parents: 87
diff changeset
261
91
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
262 \subsection{More detailed information}
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
263
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
264 While the summary information printed by \hgcmd{log} is useful if you
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
265 already know what you're looking for, you may need to see a complete
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
266 description of the change, or a list of the files changed, if you're
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
267 trying to decide whether a changeset is the one you're looking for.
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
268 The \hgcmd{log} command's \hggopt{-v} (or \hggopt{--verbose})
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
269 option gives you this extra detail.
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
270 \interaction{tour.log-v}
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
271
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
272 If you want to see both the description and content of a change, add
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
273 the \hgopt{log}{-p} (or \hgopt{log}{--patch}) option. This displays
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
274 the content of a change as a \emph{unified diff} (if you've never seen
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
275 a unified diff before, see section~\ref{sec:mq:patch} for an overview).
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
276 \interaction{tour.log-vp}
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
277
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
278 \section{All about command options}
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
279
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
280 Let's take a brief break from exploring Mercurial commands to discuss
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
281 a pattern in the way that they work; you may find this useful to keep
158
d3f8aec5beff Fix typos in chapter 2.
Steve Guidon <steve.guidon@gmail.com>
parents: 102
diff changeset
282 in mind as we continue our tour.
91
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
283
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
284 Mercurial has a consistent and straightforward approach to dealing
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
285 with the options that you can pass to commands. It follows the
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
286 conventions for options that are common to modern Linux and Unix
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
287 systems.
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
288 \begin{itemize}
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
289 \item Every option has a long name. For example, as we've already
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
290 seen, the \hgcmd{log} command accepts a \hgopt{log}{--rev} option.
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
291 \item Most options have short names, too. Instead of
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
292 \hgopt{log}{--rev}, we can use \hgopt{log}{-r}. (The reason that
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
293 some options don't have short names is that the options in question
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
294 are rarely used.)
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
295 \item Long options start with two dashes (e.g.~\hgopt{log}{--rev}),
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
296 while short options start with one (e.g.~\hgopt{log}{-r}).
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
297 \item Option naming and usage is consistent across commands. For
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
298 example, every command that lets you specify a changeset~ID or
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
299 revision number accepts both \hgopt{log}{-r} and \hgopt{log}{--rev}
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
300 arguments.
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
301 \end{itemize}
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
302 In the examples throughout this book, I use short options instead of
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
303 long. This just reflects my own preference, so don't read anything
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
304 significant into it.
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
305
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
306 Most commands that print output of some kind will print more output
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
307 when passed a \hggopt{-v} (or \hggopt{--verbose}) option, and less
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
308 when passed \hggopt{-q} (or \hggopt{--quiet}).
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
309
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
310 \section{Making and reviewing changes}
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
311
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
312 Now that we have a grasp of viewing history in Mercurial, let's take a
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
313 look at making some changes and examining them.
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
314
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
315 The first thing we'll do is isolate our experiment in a repository of
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
316 its own. We use the \hgcmd{clone} command, but we don't need to
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
317 clone a copy of the remote repository. Since we already have a copy
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
318 of it locally, we can just clone that instead. This is much faster
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
319 than cloning over the network, and cloning a local repository uses
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
320 less disk space in most cases, too.
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
321 \interaction{tour.reclone}
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
322 As an aside, it's often good practice to keep a ``pristine'' copy of a
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
323 remote repository around, which you can then make temporary clones of
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
324 to create sandboxes for each task you want to work on. This lets you
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
325 work on multiple tasks in parallel, each isolated from the others
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
326 until it's complete and you're ready to integrate it back. Because
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
327 local clones are so cheap, there's almost no overhead to cloning and
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
328 destroying repositories whenever you want.
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
329
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
330 In our \dirname{my-hello} repository, we have a file
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
331 \filename{hello.c} that contains the classic ``hello, world'' program.
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
332 Let's use the ancient and venerable \command{sed} command to edit this
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
333 file so that it prints a second line of output. (I'm only using
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
334 \command{sed} to do this because it's easy to write a scripted example
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
335 this way. Since you're not under the same constraint, you probably
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
336 won't want to use \command{sed}; simply use your preferred text editor to
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
337 do the same thing.)
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
338 \interaction{tour.sed}
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
339
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
340 Mercurial's \hgcmd{status} command will tell us what Mercurial knows
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
341 about the files in the repository.
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
342 \interaction{tour.status}
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
343 The \hgcmd{status} command prints no output for some files, but a line
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
344 starting with ``\texttt{M}'' for \filename{hello.c}. Unless you tell
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
345 it to, \hgcmd{status} will not print any output for files that have
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
346 not been modified.
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
347
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
348 The ``\texttt{M}'' indicates that Mercurial has noticed that we
97
659fa1a2c628 More text.
Bryan O'Sullivan <bos@serpentine.com>
parents: 96
diff changeset
349 modified \filename{hello.c}. We didn't need to \emph{inform}
659fa1a2c628 More text.
Bryan O'Sullivan <bos@serpentine.com>
parents: 96
diff changeset
350 Mercurial that we were going to modify the file before we started, or
659fa1a2c628 More text.
Bryan O'Sullivan <bos@serpentine.com>
parents: 96
diff changeset
351 that we had modified the file after we were done; it was able to
659fa1a2c628 More text.
Bryan O'Sullivan <bos@serpentine.com>
parents: 96
diff changeset
352 figure this out itself.
91
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
353
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
354 It's a little bit helpful to know that we've modified
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
355 \filename{hello.c}, but we might prefer to know exactly \emph{what}
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
356 changes we've made to it. To do this, we use the \hgcmd{diff}
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
357 command.
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
358 \interaction{tour.diff}
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
359
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
360 \section{Recording changes in a new changeset}
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
361
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
362 We can modify files, build and test our changes, and use
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
363 \hgcmd{status} and \hgcmd{diff} to review our changes, until we're
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
364 satisfied with what we've done and arrive at a natural stopping point
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
365 where we want to record our work in a new changeset.
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
366
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
367 The \hgcmd{commit} command lets us create a new changeset; we'll
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
368 usually refer to this as ``making a commit'' or ``committing''.
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
369
102
ff9dc8bc2a8b More. Merge. Stuff.
Bryan O'Sullivan <bos@serpentine.com>
parents: 101
diff changeset
370 \subsection{Setting up a username}
ff9dc8bc2a8b More. Merge. Stuff.
Bryan O'Sullivan <bos@serpentine.com>
parents: 101
diff changeset
371
174
ef6a1427d0af Update tour info more usefully.
Bryan O'Sullivan <bos@serpentine.com>
parents: 158
diff changeset
372 When you try to run \hgcmd{commit} for the first time, it is not
ef6a1427d0af Update tour info more usefully.
Bryan O'Sullivan <bos@serpentine.com>
parents: 158
diff changeset
373 guaranteed to succeed. Mercurial records your name and address with
ef6a1427d0af Update tour info more usefully.
Bryan O'Sullivan <bos@serpentine.com>
parents: 158
diff changeset
374 each change that you commit, so that you and others will later be able
ef6a1427d0af Update tour info more usefully.
Bryan O'Sullivan <bos@serpentine.com>
parents: 158
diff changeset
375 to tell who made each change. Mercurial tries to automatically figure
ef6a1427d0af Update tour info more usefully.
Bryan O'Sullivan <bos@serpentine.com>
parents: 158
diff changeset
376 out a sensible username to commit the change with. It will attempt
ef6a1427d0af Update tour info more usefully.
Bryan O'Sullivan <bos@serpentine.com>
parents: 158
diff changeset
377 each of the following methods, in order:
ef6a1427d0af Update tour info more usefully.
Bryan O'Sullivan <bos@serpentine.com>
parents: 158
diff changeset
378 \begin{enumerate}
ef6a1427d0af Update tour info more usefully.
Bryan O'Sullivan <bos@serpentine.com>
parents: 158
diff changeset
379 \item If you specify a \hgopt{commit}{-u} option to the \hgcmd{commit}
ef6a1427d0af Update tour info more usefully.
Bryan O'Sullivan <bos@serpentine.com>
parents: 158
diff changeset
380 command on the command line, followed by a username, this is always
ef6a1427d0af Update tour info more usefully.
Bryan O'Sullivan <bos@serpentine.com>
parents: 158
diff changeset
381 given the highest precedence.
ef6a1427d0af Update tour info more usefully.
Bryan O'Sullivan <bos@serpentine.com>
parents: 158
diff changeset
382 \item If you have set the \envar{HGUSER} environment variable, this is
ef6a1427d0af Update tour info more usefully.
Bryan O'Sullivan <bos@serpentine.com>
parents: 158
diff changeset
383 checked next.
ef6a1427d0af Update tour info more usefully.
Bryan O'Sullivan <bos@serpentine.com>
parents: 158
diff changeset
384 \item If you create a file in your home directory called
ef6a1427d0af Update tour info more usefully.
Bryan O'Sullivan <bos@serpentine.com>
parents: 158
diff changeset
385 \sfilename{.hgrc}, with a \rcitem{ui}{username} entry, that will be
ef6a1427d0af Update tour info more usefully.
Bryan O'Sullivan <bos@serpentine.com>
parents: 158
diff changeset
386 used next. To see what the contents of this file should look like,
ef6a1427d0af Update tour info more usefully.
Bryan O'Sullivan <bos@serpentine.com>
parents: 158
diff changeset
387 refer to section~\ref{sec:tour-basic:username} below.
ef6a1427d0af Update tour info more usefully.
Bryan O'Sullivan <bos@serpentine.com>
parents: 158
diff changeset
388 \item If you have set the \envar{EMAIL} environment variable, this
ef6a1427d0af Update tour info more usefully.
Bryan O'Sullivan <bos@serpentine.com>
parents: 158
diff changeset
389 will be used next.
ef6a1427d0af Update tour info more usefully.
Bryan O'Sullivan <bos@serpentine.com>
parents: 158
diff changeset
390 \item Mercurial will query your system to find out your local user
ef6a1427d0af Update tour info more usefully.
Bryan O'Sullivan <bos@serpentine.com>
parents: 158
diff changeset
391 name and host name, and construct a username from these components.
ef6a1427d0af Update tour info more usefully.
Bryan O'Sullivan <bos@serpentine.com>
parents: 158
diff changeset
392 Since this often results in a username that is not very useful, it
ef6a1427d0af Update tour info more usefully.
Bryan O'Sullivan <bos@serpentine.com>
parents: 158
diff changeset
393 will print a warning if it has to do this.
ef6a1427d0af Update tour info more usefully.
Bryan O'Sullivan <bos@serpentine.com>
parents: 158
diff changeset
394 \end{enumerate}
ef6a1427d0af Update tour info more usefully.
Bryan O'Sullivan <bos@serpentine.com>
parents: 158
diff changeset
395 If all of these mechanisms fail, Mercurial will fail, printing an
ef6a1427d0af Update tour info more usefully.
Bryan O'Sullivan <bos@serpentine.com>
parents: 158
diff changeset
396 error message. In this case, it will not let you commit until you set
ef6a1427d0af Update tour info more usefully.
Bryan O'Sullivan <bos@serpentine.com>
parents: 158
diff changeset
397 up a username.
102
ff9dc8bc2a8b More. Merge. Stuff.
Bryan O'Sullivan <bos@serpentine.com>
parents: 101
diff changeset
398
174
ef6a1427d0af Update tour info more usefully.
Bryan O'Sullivan <bos@serpentine.com>
parents: 158
diff changeset
399 You should think of the \envar{HGUSER} environment variable and the
ef6a1427d0af Update tour info more usefully.
Bryan O'Sullivan <bos@serpentine.com>
parents: 158
diff changeset
400 \hgopt{commit}{-u} option to the \hgcmd{commit} command as ways to
ef6a1427d0af Update tour info more usefully.
Bryan O'Sullivan <bos@serpentine.com>
parents: 158
diff changeset
401 \emph{override} Mercurial's default selection of username. For normal
ef6a1427d0af Update tour info more usefully.
Bryan O'Sullivan <bos@serpentine.com>
parents: 158
diff changeset
402 use, the simplest and most robust way to set a username for yourself
ef6a1427d0af Update tour info more usefully.
Bryan O'Sullivan <bos@serpentine.com>
parents: 158
diff changeset
403 is by creating a \sfilename{.hgrc} file; see below for details.
102
ff9dc8bc2a8b More. Merge. Stuff.
Bryan O'Sullivan <bos@serpentine.com>
parents: 101
diff changeset
404
ff9dc8bc2a8b More. Merge. Stuff.
Bryan O'Sullivan <bos@serpentine.com>
parents: 101
diff changeset
405 \subsubsection{Creating a Mercurial configuration file}
174
ef6a1427d0af Update tour info more usefully.
Bryan O'Sullivan <bos@serpentine.com>
parents: 158
diff changeset
406 \label{sec:tour-basic:username}
102
ff9dc8bc2a8b More. Merge. Stuff.
Bryan O'Sullivan <bos@serpentine.com>
parents: 101
diff changeset
407
ff9dc8bc2a8b More. Merge. Stuff.
Bryan O'Sullivan <bos@serpentine.com>
parents: 101
diff changeset
408 To set a user name, use your favourite editor to create a file called
ff9dc8bc2a8b More. Merge. Stuff.
Bryan O'Sullivan <bos@serpentine.com>
parents: 101
diff changeset
409 \sfilename{.hgrc} in your home directory. Mercurial will use this
ff9dc8bc2a8b More. Merge. Stuff.
Bryan O'Sullivan <bos@serpentine.com>
parents: 101
diff changeset
410 file to look up your personalised configuration settings. The initial
ff9dc8bc2a8b More. Merge. Stuff.
Bryan O'Sullivan <bos@serpentine.com>
parents: 101
diff changeset
411 contents of your \sfilename{.hgrc} should look like this.
ff9dc8bc2a8b More. Merge. Stuff.
Bryan O'Sullivan <bos@serpentine.com>
parents: 101
diff changeset
412 \begin{codesample2}
ff9dc8bc2a8b More. Merge. Stuff.
Bryan O'Sullivan <bos@serpentine.com>
parents: 101
diff changeset
413 # This is a Mercurial configuration file.
ff9dc8bc2a8b More. Merge. Stuff.
Bryan O'Sullivan <bos@serpentine.com>
parents: 101
diff changeset
414 [ui]
ff9dc8bc2a8b More. Merge. Stuff.
Bryan O'Sullivan <bos@serpentine.com>
parents: 101
diff changeset
415 username = Firstname Lastname <email.address@domain.net>
ff9dc8bc2a8b More. Merge. Stuff.
Bryan O'Sullivan <bos@serpentine.com>
parents: 101
diff changeset
416 \end{codesample2}
ff9dc8bc2a8b More. Merge. Stuff.
Bryan O'Sullivan <bos@serpentine.com>
parents: 101
diff changeset
417 The ``\texttt{[ui]}'' line begins a \emph{section} of the config file,
ff9dc8bc2a8b More. Merge. Stuff.
Bryan O'Sullivan <bos@serpentine.com>
parents: 101
diff changeset
418 so you can read the ``\texttt{username = ...}'' line as meaning ``set
ff9dc8bc2a8b More. Merge. Stuff.
Bryan O'Sullivan <bos@serpentine.com>
parents: 101
diff changeset
419 the value of the \texttt{username} item in the \texttt{ui} section''.
ff9dc8bc2a8b More. Merge. Stuff.
Bryan O'Sullivan <bos@serpentine.com>
parents: 101
diff changeset
420 A section continues until a new section begins, or the end of the
ff9dc8bc2a8b More. Merge. Stuff.
Bryan O'Sullivan <bos@serpentine.com>
parents: 101
diff changeset
421 file. Mercurial ignores empty lines and treats any text from
ff9dc8bc2a8b More. Merge. Stuff.
Bryan O'Sullivan <bos@serpentine.com>
parents: 101
diff changeset
422 ``\texttt{\#}'' to the end of a line as a comment.
ff9dc8bc2a8b More. Merge. Stuff.
Bryan O'Sullivan <bos@serpentine.com>
parents: 101
diff changeset
423
ff9dc8bc2a8b More. Merge. Stuff.
Bryan O'Sullivan <bos@serpentine.com>
parents: 101
diff changeset
424 \subsubsection{Choosing a user name}
ff9dc8bc2a8b More. Merge. Stuff.
Bryan O'Sullivan <bos@serpentine.com>
parents: 101
diff changeset
425
ff9dc8bc2a8b More. Merge. Stuff.
Bryan O'Sullivan <bos@serpentine.com>
parents: 101
diff changeset
426 You can use any text you like as the value of the \texttt{username}
ff9dc8bc2a8b More. Merge. Stuff.
Bryan O'Sullivan <bos@serpentine.com>
parents: 101
diff changeset
427 config item, since this information is for reading by other people,
ff9dc8bc2a8b More. Merge. Stuff.
Bryan O'Sullivan <bos@serpentine.com>
parents: 101
diff changeset
428 but for interpreting by Mercurial. The convention that most people
ff9dc8bc2a8b More. Merge. Stuff.
Bryan O'Sullivan <bos@serpentine.com>
parents: 101
diff changeset
429 follow is to use their name and email address, as in the example
ff9dc8bc2a8b More. Merge. Stuff.
Bryan O'Sullivan <bos@serpentine.com>
parents: 101
diff changeset
430 above.
ff9dc8bc2a8b More. Merge. Stuff.
Bryan O'Sullivan <bos@serpentine.com>
parents: 101
diff changeset
431
ff9dc8bc2a8b More. Merge. Stuff.
Bryan O'Sullivan <bos@serpentine.com>
parents: 101
diff changeset
432 \begin{note}
ff9dc8bc2a8b More. Merge. Stuff.
Bryan O'Sullivan <bos@serpentine.com>
parents: 101
diff changeset
433 Mercurial's built-in web server obfuscates email addresses, to make
ff9dc8bc2a8b More. Merge. Stuff.
Bryan O'Sullivan <bos@serpentine.com>
parents: 101
diff changeset
434 it more difficult for the email harvesting tools that spammers use.
ff9dc8bc2a8b More. Merge. Stuff.
Bryan O'Sullivan <bos@serpentine.com>
parents: 101
diff changeset
435 This reduces the likelihood that you'll start receiving more junk
ff9dc8bc2a8b More. Merge. Stuff.
Bryan O'Sullivan <bos@serpentine.com>
parents: 101
diff changeset
436 email if you publish a Mercurial repository on the web.
ff9dc8bc2a8b More. Merge. Stuff.
Bryan O'Sullivan <bos@serpentine.com>
parents: 101
diff changeset
437 \end{note}
ff9dc8bc2a8b More. Merge. Stuff.
Bryan O'Sullivan <bos@serpentine.com>
parents: 101
diff changeset
438
91
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
439 \subsection{Writing a commit message}
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
440
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
441 When we commit a change, Mercurial drops us into a text editor, to
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
442 enter a message that will describe the modifications we've made in
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
443 this changeset. This is called the \emph{commit message}. It will be
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
444 a record for readers of what we did and why, and it will be printed by
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
445 \hgcmd{log} after we've finished committing.
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
446 \interaction{tour.commit}
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
447
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
448 The editor that the \hgcmd{commit} command drops us into will contain
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
449 an empty line, followed by a number of lines starting with
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
450 ``\texttt{HG:}''.
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
451 \begin{codesample2}
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
452 \emph{empty line}
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
453 HG: changed hello.c
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
454 \end{codesample2}
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
455 Mercurial ignores the lines that start with ``\texttt{HG:}''; it uses
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
456 them only to tell us which files it's recording changes to. Modifying
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
457 or deleting these lines has no effect.
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
458
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
459 \subsection{Writing a good commit message}
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
460
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
461 Since \hgcmd{log} only prints the first line of a commit message by
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
462 default, it's best to write a commit message whose first line stands
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
463 alone. Here's a real example of a commit message that \emph{doesn't}
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
464 follow this guideline, and hence has a summary that is not readable.
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
465 \begin{codesample2}
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
466 changeset: 73:584af0e231be
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
467 user: Censored Person <censored.person@example.org>
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
468 date: Tue Sep 26 21:37:07 2006 -0700
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
469 summary: include buildmeister/commondefs. Add an exports and install
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
470 \end{codesample2}
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
471
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
472 As far as the remainder of the contents of the commit message are
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
473 concerned, there are no hard-and-fast rules. Mercurial itself doesn't
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
474 interpret or care about the contents of the commit message, though
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
475 your project may have policies that dictate a certain kind of
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
476 formatting.
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
477
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
478 My personal preference is for short, but informative, commit messages
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
479 that tell me something that I can't figure out with a quick glance at
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
480 the output of \hgcmdargs{log}{--patch}.
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
481
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
482 \subsection{Aborting a commit}
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
483
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
484 If you decide that you don't want to commit while in the middle of
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
485 editing a commit message, simply exit from your editor without saving
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
486 the file that it's editing. This will cause nothing to happen to
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
487 either the repository or the working directory.
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
488
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
489 If we run the \hgcmd{commit} command without any arguments, it records
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
490 all of the changes we've made, as reported by \hgcmd{status} and
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
491 \hgcmd{diff}.
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
492
102
ff9dc8bc2a8b More. Merge. Stuff.
Bryan O'Sullivan <bos@serpentine.com>
parents: 101
diff changeset
493 \subsection{Admiring our new handiwork}
91
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
494
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
495 Once we've finished the commit, we can use the \hgcmd{tip} command to
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
496 display the changeset we just created. This command produces output
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
497 that is identical to \hgcmd{log}, but it only displays the newest
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
498 revision in the repository.
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
499 \interaction{tour.tip}
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
500 We refer to the newest revision in the repository as the tip revision,
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
501 or simply the tip.
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
502
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
503 \section{Sharing changes}
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
504
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
505 We mentioned earlier that repositories in Mercurial are
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
506 self-contained. This means that the changeset we just created exists
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
507 only in our \dirname{my-hello} repository. Let's look at a few ways
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
508 that we can propagate this change into other repositories.
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
509
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
510 \subsection{Pulling changes from another repository}
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
511 \label{sec:tour:pull}
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
512
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
513 To get started, let's clone our original \dirname{hello} repository,
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
514 which does not contain the change we just committed. We'll call our
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
515 temporary repository \dirname{hello-pull}.
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
516 \interaction{tour.clone-pull}
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
517
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
518 We'll use the \hgcmd{pull} command to bring changes from
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
519 \dirname{my-hello} into \dirname{hello-pull}. However, blindly
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
520 pulling unknown changes into a repository is a somewhat scary
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
521 prospect. Mercurial provides the \hgcmd{incoming} command to tell us
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
522 what changes the \hgcmd{pull} command \emph{would} pull into the
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
523 repository, without actually pulling the changes in.
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
524 \interaction{tour.incoming}
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
525 (Of course, someone could cause more changesets to appear in the
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
526 repository that we ran \hgcmd{incoming} in, before we get a chance to
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
527 \hgcmd{pull} the changes, so that we could end up pulling changes that we
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
528 didn't expect.)
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
529
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
530 Bringing changes into a repository is a simple matter of running the
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
531 \hgcmd{pull} command, and telling it which repository to pull from.
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
532 \interaction{tour.pull}
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
533 As you can see from the before-and-after output of \hgcmd{tip}, we
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
534 have successfully pulled changes into our repository. There remains
92
72d207927dc4 Tour: push.
Bryan O'Sullivan <bos@serpentine.com>
parents: 91
diff changeset
535 one step before we can see these changes in the working directory.
91
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
536
92
72d207927dc4 Tour: push.
Bryan O'Sullivan <bos@serpentine.com>
parents: 91
diff changeset
537 \subsection{Updating the working directory}
91
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
538
92
72d207927dc4 Tour: push.
Bryan O'Sullivan <bos@serpentine.com>
parents: 91
diff changeset
539 We have so far glossed over the relationship between a repository and
91
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
540 its working directory. The \hgcmd{pull} command that we ran in
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
541 section~\ref{sec:tour:pull} brought changes into the repository, but
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
542 if we check, there's no sign of those changes in the working
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
543 directory. This is because \hgcmd{pull} does not (by default) touch
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
544 the working directory. Instead, we use the \hgcmd{update} command to
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
545 do this.
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
546 \interaction{tour.update}
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
547
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
548 It might seem a bit strange that \hgcmd{pull} doesn't update the
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
549 working directory automatically. There's actually a good reason for
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
550 this: you can use \hgcmd{update} to update the working directory to
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
551 the state it was in at \emph{any revision} in the history of the
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
552 repository. If you had the working directory updated to an old
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
553 revision---to hunt down the origin of a bug, say---and ran a
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
554 \hgcmd{pull} which automatically updated the working directory to a
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
555 new revision, you might not be terribly happy.
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
556
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
557 However, since pull-then-update is such a common thing to do,
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
558 Mercurial lets you combine the two by passing the \hgopt{pull}{-u}
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
559 option to \hgcmd{pull}.
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
560 \begin{codesample2}
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
561 hg pull -u
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
562 \end{codesample2}
92
72d207927dc4 Tour: push.
Bryan O'Sullivan <bos@serpentine.com>
parents: 91
diff changeset
563 If you look back at the output of \hgcmd{pull} in
72d207927dc4 Tour: push.
Bryan O'Sullivan <bos@serpentine.com>
parents: 91
diff changeset
564 section~\ref{sec:tour:pull} when we ran it without \hgopt{pull}{-u},
72d207927dc4 Tour: push.
Bryan O'Sullivan <bos@serpentine.com>
parents: 91
diff changeset
565 you can see that it printed a helpful reminder that we'd have to take
72d207927dc4 Tour: push.
Bryan O'Sullivan <bos@serpentine.com>
parents: 91
diff changeset
566 an explicit step to update the working directory:
72d207927dc4 Tour: push.
Bryan O'Sullivan <bos@serpentine.com>
parents: 91
diff changeset
567 \begin{codesample2}
72d207927dc4 Tour: push.
Bryan O'Sullivan <bos@serpentine.com>
parents: 91
diff changeset
568 (run 'hg update' to get a working copy)
72d207927dc4 Tour: push.
Bryan O'Sullivan <bos@serpentine.com>
parents: 91
diff changeset
569 \end{codesample2}
91
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
570
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
571 To find out what revision the working directory is at, use the
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
572 \hgcmd{parents} command.
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
573 \interaction{tour.parents}
101
321732566ac1 A few bits of terminological clarification.
Bryan O'Sullivan <bos@serpentine.com>
parents: 99
diff changeset
574 If you look back at figure~\ref{fig:tour-basic:history}, you'll see
321732566ac1 A few bits of terminological clarification.
Bryan O'Sullivan <bos@serpentine.com>
parents: 99
diff changeset
575 arrows connecting each changeset. The node that the arrow leads
321732566ac1 A few bits of terminological clarification.
Bryan O'Sullivan <bos@serpentine.com>
parents: 99
diff changeset
576 \emph{from} in each case is a parent, and the node that the arrow
321732566ac1 A few bits of terminological clarification.
Bryan O'Sullivan <bos@serpentine.com>
parents: 99
diff changeset
577 leads \emph{to} is its child. The working directory has a parent in
321732566ac1 A few bits of terminological clarification.
Bryan O'Sullivan <bos@serpentine.com>
parents: 99
diff changeset
578 just the same way; this is the changeset that the working directory
321732566ac1 A few bits of terminological clarification.
Bryan O'Sullivan <bos@serpentine.com>
parents: 99
diff changeset
579 currently contains.
321732566ac1 A few bits of terminological clarification.
Bryan O'Sullivan <bos@serpentine.com>
parents: 99
diff changeset
580
91
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
581 To update the working directory to a particular revision, give a
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
582 revision number or changeset~ID to the \hgcmd{update} command.
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
583 \interaction{tour.older}
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
584 If you omit an explicit revision, \hgcmd{update} will update to the
94
0b97b0bdc830 Basic merge coverage.
Bryan O'Sullivan <bos@serpentine.com>
parents: 93
diff changeset
585 tip revision, as shown by the second call to \hgcmd{update} in the
0b97b0bdc830 Basic merge coverage.
Bryan O'Sullivan <bos@serpentine.com>
parents: 93
diff changeset
586 example above.
91
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
587
92
72d207927dc4 Tour: push.
Bryan O'Sullivan <bos@serpentine.com>
parents: 91
diff changeset
588 \subsection{Pushing changes to another repository}
72d207927dc4 Tour: push.
Bryan O'Sullivan <bos@serpentine.com>
parents: 91
diff changeset
589
72d207927dc4 Tour: push.
Bryan O'Sullivan <bos@serpentine.com>
parents: 91
diff changeset
590 Mercurial lets us push changes to another repository, from the
72d207927dc4 Tour: push.
Bryan O'Sullivan <bos@serpentine.com>
parents: 91
diff changeset
591 repository we're currently visiting. As with the example of
72d207927dc4 Tour: push.
Bryan O'Sullivan <bos@serpentine.com>
parents: 91
diff changeset
592 \hgcmd{pull} above, we'll create a temporary repository to push our
72d207927dc4 Tour: push.
Bryan O'Sullivan <bos@serpentine.com>
parents: 91
diff changeset
593 changes into.
72d207927dc4 Tour: push.
Bryan O'Sullivan <bos@serpentine.com>
parents: 91
diff changeset
594 \interaction{tour.clone-push}
72d207927dc4 Tour: push.
Bryan O'Sullivan <bos@serpentine.com>
parents: 91
diff changeset
595 The \hgcmd{outgoing} command tells us what changes would be pushed
72d207927dc4 Tour: push.
Bryan O'Sullivan <bos@serpentine.com>
parents: 91
diff changeset
596 into another repository.
72d207927dc4 Tour: push.
Bryan O'Sullivan <bos@serpentine.com>
parents: 91
diff changeset
597 \interaction{tour.outgoing}
72d207927dc4 Tour: push.
Bryan O'Sullivan <bos@serpentine.com>
parents: 91
diff changeset
598 And the \hgcmd{push} command does the actual push.
72d207927dc4 Tour: push.
Bryan O'Sullivan <bos@serpentine.com>
parents: 91
diff changeset
599 \interaction{tour.push}
72d207927dc4 Tour: push.
Bryan O'Sullivan <bos@serpentine.com>
parents: 91
diff changeset
600 As with \hgcmd{pull}, the \hgcmd{push} command does not update the
72d207927dc4 Tour: push.
Bryan O'Sullivan <bos@serpentine.com>
parents: 91
diff changeset
601 working directory in the repository that it's pushing changes into.
72d207927dc4 Tour: push.
Bryan O'Sullivan <bos@serpentine.com>
parents: 91
diff changeset
602 (Unlike \hgcmd{pull}, \hgcmd{push} does not provide a \texttt{-u}
72d207927dc4 Tour: push.
Bryan O'Sullivan <bos@serpentine.com>
parents: 91
diff changeset
603 option that updates the other repository's working directory.)
72d207927dc4 Tour: push.
Bryan O'Sullivan <bos@serpentine.com>
parents: 91
diff changeset
604
72d207927dc4 Tour: push.
Bryan O'Sullivan <bos@serpentine.com>
parents: 91
diff changeset
605 What happens if we try to pull or push changes and the receiving
72d207927dc4 Tour: push.
Bryan O'Sullivan <bos@serpentine.com>
parents: 91
diff changeset
606 repository already has those changes? Nothing too exciting.
72d207927dc4 Tour: push.
Bryan O'Sullivan <bos@serpentine.com>
parents: 91
diff changeset
607 \interaction{tour.push.nothing}
72d207927dc4 Tour: push.
Bryan O'Sullivan <bos@serpentine.com>
parents: 91
diff changeset
608
93
97638d862ef3 Network bits.
Bryan O'Sullivan <bos@serpentine.com>
parents: 92
diff changeset
609 \subsection{Sharing changes over a network}
97638d862ef3 Network bits.
Bryan O'Sullivan <bos@serpentine.com>
parents: 92
diff changeset
610
97638d862ef3 Network bits.
Bryan O'Sullivan <bos@serpentine.com>
parents: 92
diff changeset
611 The commands we have covered in the previous few sections are not
97638d862ef3 Network bits.
Bryan O'Sullivan <bos@serpentine.com>
parents: 92
diff changeset
612 limited to working with local repositories. Each works in exactly the
97638d862ef3 Network bits.
Bryan O'Sullivan <bos@serpentine.com>
parents: 92
diff changeset
613 same fashion over a network connection; simply pass in a URL instead
97638d862ef3 Network bits.
Bryan O'Sullivan <bos@serpentine.com>
parents: 92
diff changeset
614 of a local path.
97638d862ef3 Network bits.
Bryan O'Sullivan <bos@serpentine.com>
parents: 92
diff changeset
615 \interaction{tour.outgoing.net}
97638d862ef3 Network bits.
Bryan O'Sullivan <bos@serpentine.com>
parents: 92
diff changeset
616 In this example, we can see what changes we could push to the remote
97638d862ef3 Network bits.
Bryan O'Sullivan <bos@serpentine.com>
parents: 92
diff changeset
617 repository, but the repository is understandably not set up to let
97638d862ef3 Network bits.
Bryan O'Sullivan <bos@serpentine.com>
parents: 92
diff changeset
618 anonymous users push to it.
97638d862ef3 Network bits.
Bryan O'Sullivan <bos@serpentine.com>
parents: 92
diff changeset
619 \interaction{tour.push.net}
97638d862ef3 Network bits.
Bryan O'Sullivan <bos@serpentine.com>
parents: 92
diff changeset
620
84
43b9793b4e38 Begin tour chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
621 %%% Local Variables:
43b9793b4e38 Begin tour chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
622 %%% mode: latex
43b9793b4e38 Begin tour chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
623 %%% TeX-master: "00book"
43b9793b4e38 Begin tour chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
624 %%% End: