annotate en/ch01-tour-basic.xml @ 766:3b33dd6aba87

Merge with http://hg.serpentine.com/mercurial/book
author Dongsheng Song <songdongsheng@live.cn>
date Thu, 02 Apr 2009 09:24:36 +0800
parents 1c13ed2130a7 c44d5854620b
children 3b640272a966
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
652
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
1 <!-- vim: set filetype=docbkxml shiftwidth=2 autoindent expandtab tw=77 : -->
84
43b9793b4e38 Begin tour chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
2
658
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 657
diff changeset
3 <chapter id="chap:tour-basic">
671
13513d2a128d Add sensible names to chapters.
Bryan O'Sullivan <bos@serpentine.com>
parents: 665
diff changeset
4 <?dbhtml filename="a-tour-of-mercurial-the-basics.html"?>
652
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
5 <title>A tour of Mercurial: the basics</title>
84
43b9793b4e38 Begin tour chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
6
658
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 657
diff changeset
7 <sect1 id="sec:tour:install">
652
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
8 <title>Installing Mercurial on your system</title>
85
b7c69a68b0cc A little progress on "lightning tour".
Bryan O'Sullivan <bos@serpentine.com>
parents: 84
diff changeset
9
683
c838b3975bc6 Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents: 682
diff changeset
10 <para id="x_1">Prebuilt binary packages of Mercurial are available for
652
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
11 every popular operating system. These make it easy to start
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
12 using Mercurial on your computer immediately.</para>
84
43b9793b4e38 Begin tour chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
13
652
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
14 <sect2>
714
c44d5854620b Fix up chapter 1.
Bryan O'Sullivan <bos@serpentine.com>
parents: 693
diff changeset
15 <title>Windows</title>
c44d5854620b Fix up chapter 1.
Bryan O'Sullivan <bos@serpentine.com>
parents: 693
diff changeset
16
c44d5854620b Fix up chapter 1.
Bryan O'Sullivan <bos@serpentine.com>
parents: 693
diff changeset
17 <para id="x_c">The best version of Mercurial for Windows is
c44d5854620b Fix up chapter 1.
Bryan O'Sullivan <bos@serpentine.com>
parents: 693
diff changeset
18 TortoiseHg, which can be found at <ulink
c44d5854620b Fix up chapter 1.
Bryan O'Sullivan <bos@serpentine.com>
parents: 693
diff changeset
19 url="http://bitbucket.org/tortoisehg/stable/wiki/Home">http://bitbucket.org/tortoisehg/stable/wiki/Home</ulink>.
c44d5854620b Fix up chapter 1.
Bryan O'Sullivan <bos@serpentine.com>
parents: 693
diff changeset
20 This package has no external dependencies; it <quote>just
c44d5854620b Fix up chapter 1.
Bryan O'Sullivan <bos@serpentine.com>
parents: 693
diff changeset
21 works</quote>. It provides both command line and graphical
c44d5854620b Fix up chapter 1.
Bryan O'Sullivan <bos@serpentine.com>
parents: 693
diff changeset
22 user interfaces.</para>
c44d5854620b Fix up chapter 1.
Bryan O'Sullivan <bos@serpentine.com>
parents: 693
diff changeset
23
c44d5854620b Fix up chapter 1.
Bryan O'Sullivan <bos@serpentine.com>
parents: 693
diff changeset
24 </sect2>
c44d5854620b Fix up chapter 1.
Bryan O'Sullivan <bos@serpentine.com>
parents: 693
diff changeset
25
c44d5854620b Fix up chapter 1.
Bryan O'Sullivan <bos@serpentine.com>
parents: 693
diff changeset
26 <sect2>
c44d5854620b Fix up chapter 1.
Bryan O'Sullivan <bos@serpentine.com>
parents: 693
diff changeset
27 <title>Mac OS X</title>
c44d5854620b Fix up chapter 1.
Bryan O'Sullivan <bos@serpentine.com>
parents: 693
diff changeset
28
c44d5854620b Fix up chapter 1.
Bryan O'Sullivan <bos@serpentine.com>
parents: 693
diff changeset
29 <para id="x_a">Lee Cantey publishes an installer of Mercurial
c44d5854620b Fix up chapter 1.
Bryan O'Sullivan <bos@serpentine.com>
parents: 693
diff changeset
30 for Mac OS X at <ulink
c44d5854620b Fix up chapter 1.
Bryan O'Sullivan <bos@serpentine.com>
parents: 693
diff changeset
31 url="http://mercurial.berkwood.com">http://mercurial.berkwood.com</ulink>.</para>
c44d5854620b Fix up chapter 1.
Bryan O'Sullivan <bos@serpentine.com>
parents: 693
diff changeset
32 </sect2>
c44d5854620b Fix up chapter 1.
Bryan O'Sullivan <bos@serpentine.com>
parents: 693
diff changeset
33
c44d5854620b Fix up chapter 1.
Bryan O'Sullivan <bos@serpentine.com>
parents: 693
diff changeset
34 <sect2>
652
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
35 <title>Linux</title>
84
43b9793b4e38 Begin tour chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
36
683
c838b3975bc6 Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents: 682
diff changeset
37 <para id="x_2">Because each Linux distribution has its own packaging
652
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
38 tools, policies, and rate of development, it's difficult to
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
39 give a comprehensive set of instructions on how to install
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
40 Mercurial binaries. The version of Mercurial that you will
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
41 end up with can vary depending on how active the person is who
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
42 maintains the package for your distribution.</para>
84
43b9793b4e38 Begin tour chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
43
683
c838b3975bc6 Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents: 682
diff changeset
44 <para id="x_3">To keep things simple, I will focus on installing
652
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
45 Mercurial from the command line under the most popular Linux
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
46 distributions. Most of these distributions provide graphical
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
47 package managers that will let you install Mercurial with a
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
48 single click; the package name to look for is
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
49 <literal>mercurial</literal>.</para>
84
43b9793b4e38 Begin tour chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
50
652
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
51 <itemizedlist>
714
c44d5854620b Fix up chapter 1.
Bryan O'Sullivan <bos@serpentine.com>
parents: 693
diff changeset
52 <listitem><para id="x_4">Ubuntu and Debian:</para>
679
80928ea6e7ae Add the ability to include text files and have them XML-mangled.
Bryan O'Sullivan <bos@serpentine.com>
parents: 671
diff changeset
53 <programlisting>apt-get install mercurial</programlisting></listitem>
714
c44d5854620b Fix up chapter 1.
Bryan O'Sullivan <bos@serpentine.com>
parents: 693
diff changeset
54 <listitem><para id="x_5">Fedora and OpenSUSE:</para>
679
80928ea6e7ae Add the ability to include text files and have them XML-mangled.
Bryan O'Sullivan <bos@serpentine.com>
parents: 671
diff changeset
55 <programlisting>yum install mercurial</programlisting></listitem>
683
c838b3975bc6 Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents: 682
diff changeset
56 <listitem><para id="x_6">Gentoo:</para>
652
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
57 <programlisting>emerge mercurial</programlisting></listitem>
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
58 </itemizedlist>
84
43b9793b4e38 Begin tour chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
59
652
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
60 </sect2>
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
61 <sect2>
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
62 <title>Solaris</title>
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
63
683
c838b3975bc6 Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents: 682
diff changeset
64 <para id="x_9">SunFreeWare, at <ulink
652
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
65 url="http://www.sunfreeware.com">http://www.sunfreeware.com</ulink>,
714
c44d5854620b Fix up chapter 1.
Bryan O'Sullivan <bos@serpentine.com>
parents: 693
diff changeset
66 provides prebuilt packages of Mercurial.</para>
84
43b9793b4e38 Begin tour chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
67
652
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
68 </sect2>
84
43b9793b4e38 Begin tour chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
69
714
c44d5854620b Fix up chapter 1.
Bryan O'Sullivan <bos@serpentine.com>
parents: 693
diff changeset
70 </sect1>
412
a168daed199b Fix typos
Simon Ruderich <simon@ruderich.org>
parents: 264
diff changeset
71
652
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
72 <sect1>
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
73 <title>Getting started</title>
84
43b9793b4e38 Begin tour chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
74
683
c838b3975bc6 Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents: 682
diff changeset
75 <para id="x_e">To begin, we'll use the <command role="hg-cmd">hg
652
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
76 version</command> command to find out whether Mercurial is
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
77 actually installed properly. The actual version information
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
78 that it prints isn't so important; it's whether it prints
658
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 657
diff changeset
79 anything at all that we care about.</para>
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 657
diff changeset
80
665
27043f385f3f Get autogeneration of examples more or less working.
Bryan O'Sullivan <bos@serpentine.com>
parents: 658
diff changeset
81 &interaction.tour.version;
652
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
82
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
83 <sect2>
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
84 <title>Built-in help</title>
87
0995016342f8 More bumf.
Bryan O'Sullivan <bos@serpentine.com>
parents: 85
diff changeset
85
683
c838b3975bc6 Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents: 682
diff changeset
86 <para id="x_f">Mercurial provides a built-in help system. This is
658
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 657
diff changeset
87 invaluable for those times when you find yourself stuck
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 657
diff changeset
88 trying to remember how to run a command. If you are
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 657
diff changeset
89 completely stuck, simply run <command role="hg-cmd">hg
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 657
diff changeset
90 help</command>; it will print a brief list of commands,
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 657
diff changeset
91 along with a description of what each does. If you ask for
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 657
diff changeset
92 help on a specific command (as below), it prints more
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 657
diff changeset
93 detailed information.</para>
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 657
diff changeset
94
665
27043f385f3f Get autogeneration of examples more or less working.
Bryan O'Sullivan <bos@serpentine.com>
parents: 658
diff changeset
95 &interaction.tour.help;
658
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 657
diff changeset
96
683
c838b3975bc6 Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents: 682
diff changeset
97 <para id="x_10">For a more impressive level of detail (which you won't
658
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 657
diff changeset
98 usually need) run <command role="hg-cmd">hg help <option
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 657
diff changeset
99 role="hg-opt-global">-v</option></command>. The <option
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 657
diff changeset
100 role="hg-opt-global">-v</option> option is short for
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 657
diff changeset
101 <option role="hg-opt-global">--verbose</option>, and tells
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 657
diff changeset
102 Mercurial to print more information than it usually
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 657
diff changeset
103 would.</para>
87
0995016342f8 More bumf.
Bryan O'Sullivan <bos@serpentine.com>
parents: 85
diff changeset
104
652
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
105 </sect2>
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
106 </sect1>
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
107 <sect1>
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
108 <title>Working with a repository</title>
87
0995016342f8 More bumf.
Bryan O'Sullivan <bos@serpentine.com>
parents: 85
diff changeset
109
683
c838b3975bc6 Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents: 682
diff changeset
110 <para id="x_11">In Mercurial, everything happens inside a
652
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
111 <emphasis>repository</emphasis>. The repository for a project
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
112 contains all of the files that <quote>belong to</quote> that
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
113 project, along with a historical record of the project's
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
114 files.</para>
87
0995016342f8 More bumf.
Bryan O'Sullivan <bos@serpentine.com>
parents: 85
diff changeset
115
683
c838b3975bc6 Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents: 682
diff changeset
116 <para id="x_12">There's nothing particularly magical about a repository; it
652
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
117 is simply a directory tree in your filesystem that Mercurial
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
118 treats as special. You can rename or delete a repository any
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
119 time you like, using either the command line or your file
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
120 browser.</para>
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
121
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
122 <sect2>
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
123 <title>Making a local copy of a repository</title>
87
0995016342f8 More bumf.
Bryan O'Sullivan <bos@serpentine.com>
parents: 85
diff changeset
124
683
c838b3975bc6 Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents: 682
diff changeset
125 <para id="x_13"><emphasis>Copying</emphasis> a repository is just a little
652
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
126 bit special. While you could use a normal file copying
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
127 command to make a copy of a repository, it's best to use a
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
128 built-in command that Mercurial provides. This command is
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
129 called <command role="hg-cmd">hg clone</command>, because it
714
c44d5854620b Fix up chapter 1.
Bryan O'Sullivan <bos@serpentine.com>
parents: 693
diff changeset
130 makes an identical copy of an existing repository.</para>
658
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 657
diff changeset
131
665
27043f385f3f Get autogeneration of examples more or less working.
Bryan O'Sullivan <bos@serpentine.com>
parents: 658
diff changeset
132 &interaction.tour.clone;
658
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 657
diff changeset
133
714
c44d5854620b Fix up chapter 1.
Bryan O'Sullivan <bos@serpentine.com>
parents: 693
diff changeset
134 <para>One advantage of using <command role="hg-cmd">hg
c44d5854620b Fix up chapter 1.
Bryan O'Sullivan <bos@serpentine.com>
parents: 693
diff changeset
135 clone</command> is that, as we can see above, it lets us clone
c44d5854620b Fix up chapter 1.
Bryan O'Sullivan <bos@serpentine.com>
parents: 693
diff changeset
136 repositories over the network. Another is that it remembers
c44d5854620b Fix up chapter 1.
Bryan O'Sullivan <bos@serpentine.com>
parents: 693
diff changeset
137 where we cloned from, which we'll find useful soon when we
c44d5854620b Fix up chapter 1.
Bryan O'Sullivan <bos@serpentine.com>
parents: 693
diff changeset
138 want to fetch new changes from another repository.</para>
c44d5854620b Fix up chapter 1.
Bryan O'Sullivan <bos@serpentine.com>
parents: 693
diff changeset
139
683
c838b3975bc6 Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents: 682
diff changeset
140 <para id="x_14">If our clone succeeded, we should now have a local
658
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 657
diff changeset
141 directory called <filename class="directory">hello</filename>.
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 657
diff changeset
142 This directory will contain some files.</para>
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 657
diff changeset
143
665
27043f385f3f Get autogeneration of examples more or less working.
Bryan O'Sullivan <bos@serpentine.com>
parents: 658
diff changeset
144 &interaction.tour.ls;
658
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 657
diff changeset
145
683
c838b3975bc6 Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents: 682
diff changeset
146 <para id="x_15">These files have the same contents and history in our
658
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 657
diff changeset
147 repository as they do in the repository we cloned.</para>
87
0995016342f8 More bumf.
Bryan O'Sullivan <bos@serpentine.com>
parents: 85
diff changeset
148
714
c44d5854620b Fix up chapter 1.
Bryan O'Sullivan <bos@serpentine.com>
parents: 693
diff changeset
149 <para id="x_16">Every Mercurial repository is complete,
c44d5854620b Fix up chapter 1.
Bryan O'Sullivan <bos@serpentine.com>
parents: 693
diff changeset
150 self-contained, and independent. It contains its own private
c44d5854620b Fix up chapter 1.
Bryan O'Sullivan <bos@serpentine.com>
parents: 693
diff changeset
151 copy of a project's files and history. As we just mentioned,
c44d5854620b Fix up chapter 1.
Bryan O'Sullivan <bos@serpentine.com>
parents: 693
diff changeset
152 a cloned repository remembers the location of the repository
c44d5854620b Fix up chapter 1.
Bryan O'Sullivan <bos@serpentine.com>
parents: 693
diff changeset
153 it was cloned from, but Mercurial will not communicate with
c44d5854620b Fix up chapter 1.
Bryan O'Sullivan <bos@serpentine.com>
parents: 693
diff changeset
154 that repository, or any other, unless you tell it to.</para>
652
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
155
683
c838b3975bc6 Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents: 682
diff changeset
156 <para id="x_17">What this means for now is that we're free to experiment
652
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
157 with our repository, safe in the knowledge that it's a private
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
158 <quote>sandbox</quote> that won't affect anyone else.</para>
87
0995016342f8 More bumf.
Bryan O'Sullivan <bos@serpentine.com>
parents: 85
diff changeset
159
652
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
160 </sect2>
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
161 <sect2>
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
162 <title>What's in a repository?</title>
87
0995016342f8 More bumf.
Bryan O'Sullivan <bos@serpentine.com>
parents: 85
diff changeset
163
683
c838b3975bc6 Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents: 682
diff changeset
164 <para id="x_18">When we take a more detailed look inside a repository, we
652
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
165 can see that it contains a directory named <filename
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
166 class="directory">.hg</filename>. This is where Mercurial
658
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 657
diff changeset
167 keeps all of its metadata for the repository.</para>
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 657
diff changeset
168
665
27043f385f3f Get autogeneration of examples more or less working.
Bryan O'Sullivan <bos@serpentine.com>
parents: 658
diff changeset
169 &interaction.tour.ls-a;
85
b7c69a68b0cc A little progress on "lightning tour".
Bryan O'Sullivan <bos@serpentine.com>
parents: 84
diff changeset
170
683
c838b3975bc6 Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents: 682
diff changeset
171 <para id="x_19">The contents of the <filename
652
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
172 class="directory">.hg</filename> directory and its
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
173 subdirectories are private to Mercurial. Every other file and
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
174 directory in the repository is yours to do with as you
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
175 please.</para>
88
d351032c189c Progress with log coverage.
Bryan O'Sullivan <bos@serpentine.com>
parents: 87
diff changeset
176
683
c838b3975bc6 Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents: 682
diff changeset
177 <para id="x_1a">To introduce a little terminology, the <filename
652
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
178 class="directory">.hg</filename> directory is the
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
179 <quote>real</quote> repository, and all of the files and
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
180 directories that coexist with it are said to live in the
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
181 <emphasis>working directory</emphasis>. An easy way to
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
182 remember the distinction is that the
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
183 <emphasis>repository</emphasis> contains the
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
184 <emphasis>history</emphasis> of your project, while the
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
185 <emphasis>working directory</emphasis> contains a
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
186 <emphasis>snapshot</emphasis> of your project at a particular
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
187 point in history.</para>
88
d351032c189c Progress with log coverage.
Bryan O'Sullivan <bos@serpentine.com>
parents: 87
diff changeset
188
652
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
189 </sect2>
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
190 </sect1>
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
191 <sect1>
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
192 <title>A tour through history</title>
88
d351032c189c Progress with log coverage.
Bryan O'Sullivan <bos@serpentine.com>
parents: 87
diff changeset
193
683
c838b3975bc6 Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents: 682
diff changeset
194 <para id="x_1b">One of the first things we might want to do with a new,
652
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
195 unfamiliar repository is understand its history. The <command
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
196 role="hg-cmd">hg log</command> command gives us a view of
714
c44d5854620b Fix up chapter 1.
Bryan O'Sullivan <bos@serpentine.com>
parents: 693
diff changeset
197 the history of changes in the repository.</para>
658
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 657
diff changeset
198
665
27043f385f3f Get autogeneration of examples more or less working.
Bryan O'Sullivan <bos@serpentine.com>
parents: 658
diff changeset
199 &interaction.tour.log;
658
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 657
diff changeset
200
683
c838b3975bc6 Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents: 682
diff changeset
201 <para id="x_1c">By default, this command prints a brief paragraph of output
658
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 657
diff changeset
202 for each change to the project that was recorded. In Mercurial
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 657
diff changeset
203 terminology, we call each of these recorded events a
652
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
204 <emphasis>changeset</emphasis>, because it can contain a record
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
205 of changes to several files.</para>
88
d351032c189c Progress with log coverage.
Bryan O'Sullivan <bos@serpentine.com>
parents: 87
diff changeset
206
683
c838b3975bc6 Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents: 682
diff changeset
207 <para id="x_1d">The fields in a record of output from <command
652
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
208 role="hg-cmd">hg log</command> are as follows.</para>
714
c44d5854620b Fix up chapter 1.
Bryan O'Sullivan <bos@serpentine.com>
parents: 693
diff changeset
209
652
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
210 <itemizedlist>
714
c44d5854620b Fix up chapter 1.
Bryan O'Sullivan <bos@serpentine.com>
parents: 693
diff changeset
211 <listitem><para id="x_1e"><literal>changeset</literal>: This
c44d5854620b Fix up chapter 1.
Bryan O'Sullivan <bos@serpentine.com>
parents: 693
diff changeset
212 field has the format of a number, followed by a colon,
c44d5854620b Fix up chapter 1.
Bryan O'Sullivan <bos@serpentine.com>
parents: 693
diff changeset
213 followed by a hexadecimal (or <emphasis>hex</emphasis>)
c44d5854620b Fix up chapter 1.
Bryan O'Sullivan <bos@serpentine.com>
parents: 693
diff changeset
214 string. These are <emphasis>identifiers</emphasis> for the
c44d5854620b Fix up chapter 1.
Bryan O'Sullivan <bos@serpentine.com>
parents: 693
diff changeset
215 changeset. The hex string is a unique identifier: the same
c44d5854620b Fix up chapter 1.
Bryan O'Sullivan <bos@serpentine.com>
parents: 693
diff changeset
216 hex string will always refer to the same changeset. The
c44d5854620b Fix up chapter 1.
Bryan O'Sullivan <bos@serpentine.com>
parents: 693
diff changeset
217 number is shorter and easier to type than the hex string,
c44d5854620b Fix up chapter 1.
Bryan O'Sullivan <bos@serpentine.com>
parents: 693
diff changeset
218 but it isn't unique: the same number in two different clones
c44d5854620b Fix up chapter 1.
Bryan O'Sullivan <bos@serpentine.com>
parents: 693
diff changeset
219 of a repository may identify different changesets. Why
c44d5854620b Fix up chapter 1.
Bryan O'Sullivan <bos@serpentine.com>
parents: 693
diff changeset
220 provide the number at all, then? For local
c44d5854620b Fix up chapter 1.
Bryan O'Sullivan <bos@serpentine.com>
parents: 693
diff changeset
221 convenience.</para>
c44d5854620b Fix up chapter 1.
Bryan O'Sullivan <bos@serpentine.com>
parents: 693
diff changeset
222 </listitem>
683
c838b3975bc6 Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents: 682
diff changeset
223 <listitem><para id="x_1f"><literal>user</literal>: The identity of the
652
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
224 person who created the changeset. This is a free-form
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
225 field, but it most often contains a person's name and email
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
226 address.</para></listitem>
683
c838b3975bc6 Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents: 682
diff changeset
227 <listitem><para id="x_20"><literal>date</literal>: The date and time on
652
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
228 which the changeset was created, and the timezone in which
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
229 it was created. (The date and time are local to that
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
230 timezone; they display what time and date it was for the
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
231 person who created the changeset.)</para></listitem>
683
c838b3975bc6 Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents: 682
diff changeset
232 <listitem><para id="x_21"><literal>summary</literal>: The first line of
652
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
233 the text message that the creator of the changeset entered
714
c44d5854620b Fix up chapter 1.
Bryan O'Sullivan <bos@serpentine.com>
parents: 693
diff changeset
234 to describe the changeset.</para></listitem>
c44d5854620b Fix up chapter 1.
Bryan O'Sullivan <bos@serpentine.com>
parents: 693
diff changeset
235 <listitem>
c44d5854620b Fix up chapter 1.
Bryan O'Sullivan <bos@serpentine.com>
parents: 693
diff changeset
236 <para>Some changesets, such as the first in the list above,
c44d5854620b Fix up chapter 1.
Bryan O'Sullivan <bos@serpentine.com>
parents: 693
diff changeset
237 have a <literal>tag</literal> field. A tag is another way
c44d5854620b Fix up chapter 1.
Bryan O'Sullivan <bos@serpentine.com>
parents: 693
diff changeset
238 to identify a changeset, by giving it an easy-to-remember
c44d5854620b Fix up chapter 1.
Bryan O'Sullivan <bos@serpentine.com>
parents: 693
diff changeset
239 name. (The tag named <literal>tip</literal> is special: it
c44d5854620b Fix up chapter 1.
Bryan O'Sullivan <bos@serpentine.com>
parents: 693
diff changeset
240 always refers to the newest change in a repository.)</para>
c44d5854620b Fix up chapter 1.
Bryan O'Sullivan <bos@serpentine.com>
parents: 693
diff changeset
241 </listitem>
c44d5854620b Fix up chapter 1.
Bryan O'Sullivan <bos@serpentine.com>
parents: 693
diff changeset
242 </itemizedlist>
c44d5854620b Fix up chapter 1.
Bryan O'Sullivan <bos@serpentine.com>
parents: 693
diff changeset
243
c44d5854620b Fix up chapter 1.
Bryan O'Sullivan <bos@serpentine.com>
parents: 693
diff changeset
244 <para id="x_22">The default output printed by <command
c44d5854620b Fix up chapter 1.
Bryan O'Sullivan <bos@serpentine.com>
parents: 693
diff changeset
245 role="hg-cmd">hg log</command> is purely a summary; it is
c44d5854620b Fix up chapter 1.
Bryan O'Sullivan <bos@serpentine.com>
parents: 693
diff changeset
246 missing a lot of detail.</para>
88
d351032c189c Progress with log coverage.
Bryan O'Sullivan <bos@serpentine.com>
parents: 87
diff changeset
247
691
4ce9d0754af3 Remove the words "section", "chapter", etc from in front of xref tags.
Bryan O'Sullivan <bos@serpentine.com>
parents: 690
diff changeset
248 <para id="x_23"><xref linkend="fig:tour-basic:history"/> provides
4ce9d0754af3 Remove the words "section", "chapter", etc from in front of xref tags.
Bryan O'Sullivan <bos@serpentine.com>
parents: 690
diff changeset
249 a graphical representation of the history of the <filename
652
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
250 class="directory">hello</filename> repository, to make it a
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
251 little easier to see which direction history is
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
252 <quote>flowing</quote> in. We'll be returning to this figure
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
253 several times in this chapter and the chapter that
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
254 follows.</para>
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
255
690
b788b405e141 Replace uses of <informalfigure> with <figure>
Bryan O'Sullivan <bos@serpentine.com>
parents: 683
diff changeset
256 <figure id="fig:tour-basic:history">
b788b405e141 Replace uses of <informalfigure> with <figure>
Bryan O'Sullivan <bos@serpentine.com>
parents: 683
diff changeset
257 <title>Graphical history of the <filename
b788b405e141 Replace uses of <informalfigure> with <figure>
Bryan O'Sullivan <bos@serpentine.com>
parents: 683
diff changeset
258 class="directory">hello</filename> repository</title>
657
8631da51309b Slow progress on XML conversion
Bryan O'Sullivan <bos@serpentine.com>
parents: 652
diff changeset
259 <mediaobject>
693
0b45854f0b7b Generate and include images properly.
Bryan O'Sullivan <bos@serpentine.com>
parents: 691
diff changeset
260 <imageobject><imagedata fileref="figs/tour-history.png"/></imageobject>
657
8631da51309b Slow progress on XML conversion
Bryan O'Sullivan <bos@serpentine.com>
parents: 652
diff changeset
261 <textobject><phrase>XXX add text</phrase></textobject>
8631da51309b Slow progress on XML conversion
Bryan O'Sullivan <bos@serpentine.com>
parents: 652
diff changeset
262 </mediaobject>
690
b788b405e141 Replace uses of <informalfigure> with <figure>
Bryan O'Sullivan <bos@serpentine.com>
parents: 683
diff changeset
263 </figure>
96
7d7ddc3a57af Split tour into two chapters.
Bryan O'Sullivan <bos@serpentine.com>
parents: 95
diff changeset
264
652
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
265 <sect2>
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
266 <title>Changesets, revisions, and talking to other
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
267 people</title>
88
d351032c189c Progress with log coverage.
Bryan O'Sullivan <bos@serpentine.com>
parents: 87
diff changeset
268
683
c838b3975bc6 Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents: 682
diff changeset
269 <para id="x_25">As English is a notoriously sloppy language, and computer
652
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
270 science has a hallowed history of terminological confusion
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
271 (why use one term when four will do?), revision control has a
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
272 variety of words and phrases that mean the same thing. If you
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
273 are talking about Mercurial history with other people, you
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
274 will find that the word <quote>changeset</quote> is often
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
275 compressed to <quote>change</quote> or (when written)
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
276 <quote>cset</quote>, and sometimes a changeset is referred to
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
277 as a <quote>revision</quote> or a <quote>rev</quote>.</para>
88
d351032c189c Progress with log coverage.
Bryan O'Sullivan <bos@serpentine.com>
parents: 87
diff changeset
278
683
c838b3975bc6 Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents: 682
diff changeset
279 <para id="x_26">While it doesn't matter what <emphasis>word</emphasis> you
652
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
280 use to refer to the concept of <quote>a changeset</quote>, the
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
281 <emphasis>identifier</emphasis> that you use to refer to
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
282 <quote>a <emphasis>specific</emphasis> changeset</quote> is of
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
283 great importance. Recall that the <literal>changeset</literal>
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
284 field in the output from <command role="hg-cmd">hg
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
285 log</command> identifies a changeset using both a number and
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
286 a hexadecimal string.</para>
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
287 <itemizedlist>
714
c44d5854620b Fix up chapter 1.
Bryan O'Sullivan <bos@serpentine.com>
parents: 693
diff changeset
288 <listitem><para id="x_27">The revision number is a handy
c44d5854620b Fix up chapter 1.
Bryan O'Sullivan <bos@serpentine.com>
parents: 693
diff changeset
289 notation that is <emphasis>only valid in that
c44d5854620b Fix up chapter 1.
Bryan O'Sullivan <bos@serpentine.com>
parents: 693
diff changeset
290 repository</emphasis>.</para></listitem>
c44d5854620b Fix up chapter 1.
Bryan O'Sullivan <bos@serpentine.com>
parents: 693
diff changeset
291 <listitem><para id="x_28">The hexadecimal string is the
652
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
292 <emphasis>permanent, unchanging identifier</emphasis> that
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
293 will always identify that exact changeset in
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
294 <emphasis>every</emphasis> copy of the
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
295 repository.</para></listitem></itemizedlist>
714
c44d5854620b Fix up chapter 1.
Bryan O'Sullivan <bos@serpentine.com>
parents: 693
diff changeset
296
c44d5854620b Fix up chapter 1.
Bryan O'Sullivan <bos@serpentine.com>
parents: 693
diff changeset
297 <para id="x_29">This distinction is important. If you send
c44d5854620b Fix up chapter 1.
Bryan O'Sullivan <bos@serpentine.com>
parents: 693
diff changeset
298 someone an email talking about <quote>revision 33</quote>,
c44d5854620b Fix up chapter 1.
Bryan O'Sullivan <bos@serpentine.com>
parents: 693
diff changeset
299 there's a high likelihood that their revision 33 will
c44d5854620b Fix up chapter 1.
Bryan O'Sullivan <bos@serpentine.com>
parents: 693
diff changeset
300 <emphasis>not be the same</emphasis> as yours. The reason for
c44d5854620b Fix up chapter 1.
Bryan O'Sullivan <bos@serpentine.com>
parents: 693
diff changeset
301 this is that a revision number depends on the order in which
c44d5854620b Fix up chapter 1.
Bryan O'Sullivan <bos@serpentine.com>
parents: 693
diff changeset
302 changes arrived in a repository, and there is no guarantee
c44d5854620b Fix up chapter 1.
Bryan O'Sullivan <bos@serpentine.com>
parents: 693
diff changeset
303 that the same changes will happen in the same order in
c44d5854620b Fix up chapter 1.
Bryan O'Sullivan <bos@serpentine.com>
parents: 693
diff changeset
304 different repositories. Three changes <literal>a,b,c</literal>
c44d5854620b Fix up chapter 1.
Bryan O'Sullivan <bos@serpentine.com>
parents: 693
diff changeset
305 can easily appear in one repository as
c44d5854620b Fix up chapter 1.
Bryan O'Sullivan <bos@serpentine.com>
parents: 693
diff changeset
306 <literal>0,1,2</literal>, while in another as
c44d5854620b Fix up chapter 1.
Bryan O'Sullivan <bos@serpentine.com>
parents: 693
diff changeset
307 <literal>0,2,1</literal>.</para>
88
d351032c189c Progress with log coverage.
Bryan O'Sullivan <bos@serpentine.com>
parents: 87
diff changeset
308
683
c838b3975bc6 Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents: 682
diff changeset
309 <para id="x_2a">Mercurial uses revision numbers purely as a convenient
652
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
310 shorthand. If you need to discuss a changeset with someone,
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
311 or make a record of a changeset for some other reason (for
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
312 example, in a bug report), use the hexadecimal
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
313 identifier.</para>
88
d351032c189c Progress with log coverage.
Bryan O'Sullivan <bos@serpentine.com>
parents: 87
diff changeset
314
652
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
315 </sect2>
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
316 <sect2>
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
317 <title>Viewing specific revisions</title>
88
d351032c189c Progress with log coverage.
Bryan O'Sullivan <bos@serpentine.com>
parents: 87
diff changeset
318
683
c838b3975bc6 Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents: 682
diff changeset
319 <para id="x_2b">To narrow the output of <command role="hg-cmd">hg
652
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
320 log</command> down to a single revision, use the <option
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
321 role="hg-opt-log">-r</option> (or <option
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
322 role="hg-opt-log">--rev</option>) option. You can use
714
c44d5854620b Fix up chapter 1.
Bryan O'Sullivan <bos@serpentine.com>
parents: 693
diff changeset
323 either a revision number or a hexadecimal identifier,
658
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 657
diff changeset
324 and you can provide as many revisions as you want.</para>
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 657
diff changeset
325
665
27043f385f3f Get autogeneration of examples more or less working.
Bryan O'Sullivan <bos@serpentine.com>
parents: 658
diff changeset
326 &interaction.tour.log-r;
88
d351032c189c Progress with log coverage.
Bryan O'Sullivan <bos@serpentine.com>
parents: 87
diff changeset
327
683
c838b3975bc6 Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents: 682
diff changeset
328 <para id="x_2c">If you want to see the history of several revisions
652
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
329 without having to list each one, you can use <emphasis>range
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
330 notation</emphasis>; this lets you express the idea <quote>I
658
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 657
diff changeset
331 want all revisions between <literal>abc</literal> and
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 657
diff changeset
332 <literal>def</literal>, inclusive</quote>.</para>
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 657
diff changeset
333
665
27043f385f3f Get autogeneration of examples more or less working.
Bryan O'Sullivan <bos@serpentine.com>
parents: 658
diff changeset
334 &interaction.tour.log.range;
658
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 657
diff changeset
335
683
c838b3975bc6 Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents: 682
diff changeset
336 <para id="x_2d">Mercurial also honours the order in which you specify
658
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 657
diff changeset
337 revisions, so <command role="hg-cmd">hg log -r 2:4</command>
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 657
diff changeset
338 prints 2, 3, and 4. while <command role="hg-cmd">hg log -r
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 657
diff changeset
339 4:2</command> prints 4, 3, and 2.</para>
88
d351032c189c Progress with log coverage.
Bryan O'Sullivan <bos@serpentine.com>
parents: 87
diff changeset
340
652
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
341 </sect2>
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
342 <sect2>
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
343 <title>More detailed information</title>
91
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
344
683
c838b3975bc6 Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents: 682
diff changeset
345 <para id="x_2e">While the summary information printed by <command
652
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
346 role="hg-cmd">hg log</command> is useful if you already know
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
347 what you're looking for, you may need to see a complete
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
348 description of the change, or a list of the files changed, if
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
349 you're trying to decide whether a changeset is the one you're
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
350 looking for. The <command role="hg-cmd">hg log</command>
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
351 command's <option role="hg-opt-global">-v</option> (or <option
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
352 role="hg-opt-global">--verbose</option>) option gives you
658
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 657
diff changeset
353 this extra detail.</para>
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 657
diff changeset
354
665
27043f385f3f Get autogeneration of examples more or less working.
Bryan O'Sullivan <bos@serpentine.com>
parents: 658
diff changeset
355 &interaction.tour.log-v;
91
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
356
691
4ce9d0754af3 Remove the words "section", "chapter", etc from in front of xref tags.
Bryan O'Sullivan <bos@serpentine.com>
parents: 690
diff changeset
357 <para id="x_2f">If you want to see both the description and
4ce9d0754af3 Remove the words "section", "chapter", etc from in front of xref tags.
Bryan O'Sullivan <bos@serpentine.com>
parents: 690
diff changeset
358 content of a change, add the <option
4ce9d0754af3 Remove the words "section", "chapter", etc from in front of xref tags.
Bryan O'Sullivan <bos@serpentine.com>
parents: 690
diff changeset
359 role="hg-opt-log">-p</option> (or <option
4ce9d0754af3 Remove the words "section", "chapter", etc from in front of xref tags.
Bryan O'Sullivan <bos@serpentine.com>
parents: 690
diff changeset
360 role="hg-opt-log">--patch</option>) option. This displays
4ce9d0754af3 Remove the words "section", "chapter", etc from in front of xref tags.
Bryan O'Sullivan <bos@serpentine.com>
parents: 690
diff changeset
361 the content of a change as a <emphasis>unified diff</emphasis>
4ce9d0754af3 Remove the words "section", "chapter", etc from in front of xref tags.
Bryan O'Sullivan <bos@serpentine.com>
parents: 690
diff changeset
362 (if you've never seen a unified diff before, see <xref
4ce9d0754af3 Remove the words "section", "chapter", etc from in front of xref tags.
Bryan O'Sullivan <bos@serpentine.com>
parents: 690
diff changeset
363 linkend="sec:mq:patch"/> for an overview).</para>
658
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 657
diff changeset
364
665
27043f385f3f Get autogeneration of examples more or less working.
Bryan O'Sullivan <bos@serpentine.com>
parents: 658
diff changeset
365 &interaction.tour.log-vp;
91
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
366
714
c44d5854620b Fix up chapter 1.
Bryan O'Sullivan <bos@serpentine.com>
parents: 693
diff changeset
367 <para>The <option role="hg-opt-log">-p</option> option is
c44d5854620b Fix up chapter 1.
Bryan O'Sullivan <bos@serpentine.com>
parents: 693
diff changeset
368 tremendously useful, so it's well worth remembering.</para>
c44d5854620b Fix up chapter 1.
Bryan O'Sullivan <bos@serpentine.com>
parents: 693
diff changeset
369
652
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
370 </sect2>
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
371 </sect1>
714
c44d5854620b Fix up chapter 1.
Bryan O'Sullivan <bos@serpentine.com>
parents: 693
diff changeset
372
652
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
373 <sect1>
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
374 <title>All about command options</title>
91
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
375
683
c838b3975bc6 Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents: 682
diff changeset
376 <para id="x_30">Let's take a brief break from exploring Mercurial commands
652
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
377 to discuss a pattern in the way that they work; you may find
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
378 this useful to keep in mind as we continue our tour.</para>
91
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
379
683
c838b3975bc6 Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents: 682
diff changeset
380 <para id="x_31">Mercurial has a consistent and straightforward approach to
652
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
381 dealing with the options that you can pass to commands. It
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
382 follows the conventions for options that are common to modern
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
383 Linux and Unix systems.</para>
714
c44d5854620b Fix up chapter 1.
Bryan O'Sullivan <bos@serpentine.com>
parents: 693
diff changeset
384
652
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
385 <itemizedlist>
714
c44d5854620b Fix up chapter 1.
Bryan O'Sullivan <bos@serpentine.com>
parents: 693
diff changeset
386 <listitem>
c44d5854620b Fix up chapter 1.
Bryan O'Sullivan <bos@serpentine.com>
parents: 693
diff changeset
387 <para id="x_32">Every option has a long name. For example, as
652
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
388 we've already seen, the <command role="hg-cmd">hg
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
389 log</command> command accepts a <option
714
c44d5854620b Fix up chapter 1.
Bryan O'Sullivan <bos@serpentine.com>
parents: 693
diff changeset
390 role="hg-opt-log">--rev</option> option.</para>
c44d5854620b Fix up chapter 1.
Bryan O'Sullivan <bos@serpentine.com>
parents: 693
diff changeset
391 </listitem>
c44d5854620b Fix up chapter 1.
Bryan O'Sullivan <bos@serpentine.com>
parents: 693
diff changeset
392 <listitem>
c44d5854620b Fix up chapter 1.
Bryan O'Sullivan <bos@serpentine.com>
parents: 693
diff changeset
393 <para id="x_33">Most options have short names, too. Instead
c44d5854620b Fix up chapter 1.
Bryan O'Sullivan <bos@serpentine.com>
parents: 693
diff changeset
394 of <option role="hg-opt-log">--rev</option>, we can use
c44d5854620b Fix up chapter 1.
Bryan O'Sullivan <bos@serpentine.com>
parents: 693
diff changeset
395 <option role="hg-opt-log">-r</option>. (The reason that
c44d5854620b Fix up chapter 1.
Bryan O'Sullivan <bos@serpentine.com>
parents: 693
diff changeset
396 some options don't have short names is that the options in
c44d5854620b Fix up chapter 1.
Bryan O'Sullivan <bos@serpentine.com>
parents: 693
diff changeset
397 question are rarely used.)</para>
c44d5854620b Fix up chapter 1.
Bryan O'Sullivan <bos@serpentine.com>
parents: 693
diff changeset
398 </listitem>
c44d5854620b Fix up chapter 1.
Bryan O'Sullivan <bos@serpentine.com>
parents: 693
diff changeset
399 <listitem>
c44d5854620b Fix up chapter 1.
Bryan O'Sullivan <bos@serpentine.com>
parents: 693
diff changeset
400 <para id="x_34">Long options start with two dashes (e.g.
c44d5854620b Fix up chapter 1.
Bryan O'Sullivan <bos@serpentine.com>
parents: 693
diff changeset
401 <option role="hg-opt-log">--rev</option>), while short
c44d5854620b Fix up chapter 1.
Bryan O'Sullivan <bos@serpentine.com>
parents: 693
diff changeset
402 options start with one (e.g. <option
c44d5854620b Fix up chapter 1.
Bryan O'Sullivan <bos@serpentine.com>
parents: 693
diff changeset
403 role="hg-opt-log">-r</option>).</para>
c44d5854620b Fix up chapter 1.
Bryan O'Sullivan <bos@serpentine.com>
parents: 693
diff changeset
404 </listitem>
c44d5854620b Fix up chapter 1.
Bryan O'Sullivan <bos@serpentine.com>
parents: 693
diff changeset
405 <listitem>
c44d5854620b Fix up chapter 1.
Bryan O'Sullivan <bos@serpentine.com>
parents: 693
diff changeset
406 <para id="x_35">Option naming and usage is consistent across
652
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
407 commands. For example, every command that lets you specify
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
408 a changeset ID or revision number accepts both <option
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
409 role="hg-opt-log">-r</option> and <option
714
c44d5854620b Fix up chapter 1.
Bryan O'Sullivan <bos@serpentine.com>
parents: 693
diff changeset
410 role="hg-opt-log">--rev</option> arguments.</para>
c44d5854620b Fix up chapter 1.
Bryan O'Sullivan <bos@serpentine.com>
parents: 693
diff changeset
411 </listitem>
c44d5854620b Fix up chapter 1.
Bryan O'Sullivan <bos@serpentine.com>
parents: 693
diff changeset
412 <listitem>
c44d5854620b Fix up chapter 1.
Bryan O'Sullivan <bos@serpentine.com>
parents: 693
diff changeset
413 <para>If you are using short options, you can save typing by
c44d5854620b Fix up chapter 1.
Bryan O'Sullivan <bos@serpentine.com>
parents: 693
diff changeset
414 running them together. For example, the command <command
c44d5854620b Fix up chapter 1.
Bryan O'Sullivan <bos@serpentine.com>
parents: 693
diff changeset
415 role="hg-cmd">hg log -v -p -r 2</command> can be written
c44d5854620b Fix up chapter 1.
Bryan O'Sullivan <bos@serpentine.com>
parents: 693
diff changeset
416 as <command role="hg-cmd">hg log -vpr2</command>.</para>
c44d5854620b Fix up chapter 1.
Bryan O'Sullivan <bos@serpentine.com>
parents: 693
diff changeset
417 </listitem>
c44d5854620b Fix up chapter 1.
Bryan O'Sullivan <bos@serpentine.com>
parents: 693
diff changeset
418 </itemizedlist>
c44d5854620b Fix up chapter 1.
Bryan O'Sullivan <bos@serpentine.com>
parents: 693
diff changeset
419
683
c838b3975bc6 Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents: 682
diff changeset
420 <para id="x_36">In the examples throughout this book, I use short options
652
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
421 instead of long. This just reflects my own preference, so don't
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
422 read anything significant into it.</para>
91
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
423
683
c838b3975bc6 Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents: 682
diff changeset
424 <para id="x_37">Most commands that print output of some kind will print more
652
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
425 output when passed a <option role="hg-opt-global">-v</option>
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
426 (or <option role="hg-opt-global">--verbose</option>) option, and
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
427 less when passed <option role="hg-opt-global">-q</option> (or
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
428 <option role="hg-opt-global">--quiet</option>).</para>
91
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
429
714
c44d5854620b Fix up chapter 1.
Bryan O'Sullivan <bos@serpentine.com>
parents: 693
diff changeset
430 <note>
c44d5854620b Fix up chapter 1.
Bryan O'Sullivan <bos@serpentine.com>
parents: 693
diff changeset
431 <title>Option naming consistency</title>
c44d5854620b Fix up chapter 1.
Bryan O'Sullivan <bos@serpentine.com>
parents: 693
diff changeset
432
c44d5854620b Fix up chapter 1.
Bryan O'Sullivan <bos@serpentine.com>
parents: 693
diff changeset
433 <para>Almost always, Mercurial commands use consistent option
c44d5854620b Fix up chapter 1.
Bryan O'Sullivan <bos@serpentine.com>
parents: 693
diff changeset
434 names to refer to the same concepts. For instance, if a
c44d5854620b Fix up chapter 1.
Bryan O'Sullivan <bos@serpentine.com>
parents: 693
diff changeset
435 command deals with changesets, you'll always identify them
c44d5854620b Fix up chapter 1.
Bryan O'Sullivan <bos@serpentine.com>
parents: 693
diff changeset
436 with <option role="hg-opt-log">--rev</option> or <option
c44d5854620b Fix up chapter 1.
Bryan O'Sullivan <bos@serpentine.com>
parents: 693
diff changeset
437 role="hg-opt-log">-r</option>. This consistent use of
c44d5854620b Fix up chapter 1.
Bryan O'Sullivan <bos@serpentine.com>
parents: 693
diff changeset
438 option names makes it easier to remember what options a
c44d5854620b Fix up chapter 1.
Bryan O'Sullivan <bos@serpentine.com>
parents: 693
diff changeset
439 particular command takes.</para>
c44d5854620b Fix up chapter 1.
Bryan O'Sullivan <bos@serpentine.com>
parents: 693
diff changeset
440 </note>
c44d5854620b Fix up chapter 1.
Bryan O'Sullivan <bos@serpentine.com>
parents: 693
diff changeset
441
652
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
442 </sect1>
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
443 <sect1>
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
444 <title>Making and reviewing changes</title>
91
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
445
683
c838b3975bc6 Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents: 682
diff changeset
446 <para id="x_38">Now that we have a grasp of viewing history in Mercurial,
652
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
447 let's take a look at making some changes and examining
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
448 them.</para>
91
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
449
683
c838b3975bc6 Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents: 682
diff changeset
450 <para id="x_39">The first thing we'll do is isolate our experiment in a
652
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
451 repository of its own. We use the <command role="hg-cmd">hg
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
452 clone</command> command, but we don't need to clone a copy of
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
453 the remote repository. Since we already have a copy of it
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
454 locally, we can just clone that instead. This is much faster
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
455 than cloning over the network, and cloning a local repository
714
c44d5854620b Fix up chapter 1.
Bryan O'Sullivan <bos@serpentine.com>
parents: 693
diff changeset
456 uses less disk space in most cases, too<footnote>
c44d5854620b Fix up chapter 1.
Bryan O'Sullivan <bos@serpentine.com>
parents: 693
diff changeset
457 <para>The saving of space arises when source and destination
c44d5854620b Fix up chapter 1.
Bryan O'Sullivan <bos@serpentine.com>
parents: 693
diff changeset
458 repositories are on the same filesystem, in which case
c44d5854620b Fix up chapter 1.
Bryan O'Sullivan <bos@serpentine.com>
parents: 693
diff changeset
459 Mercurial will use hardlinks to do copy-on-write sharing of
c44d5854620b Fix up chapter 1.
Bryan O'Sullivan <bos@serpentine.com>
parents: 693
diff changeset
460 its internal metadata. If that explanation meant nothing to
c44d5854620b Fix up chapter 1.
Bryan O'Sullivan <bos@serpentine.com>
parents: 693
diff changeset
461 you, don't worry: everything happens transparently and
c44d5854620b Fix up chapter 1.
Bryan O'Sullivan <bos@serpentine.com>
parents: 693
diff changeset
462 automatically, and you don't need to understand it.</para>
c44d5854620b Fix up chapter 1.
Bryan O'Sullivan <bos@serpentine.com>
parents: 693
diff changeset
463 </footnote>.</para>
658
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 657
diff changeset
464
665
27043f385f3f Get autogeneration of examples more or less working.
Bryan O'Sullivan <bos@serpentine.com>
parents: 658
diff changeset
465 &interaction.tour.reclone;
658
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 657
diff changeset
466
683
c838b3975bc6 Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents: 682
diff changeset
467 <para id="x_3a">As an aside, it's often good practice to keep a
658
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 657
diff changeset
468 <quote>pristine</quote> copy of a remote repository around,
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 657
diff changeset
469 which you can then make temporary clones of to create sandboxes
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 657
diff changeset
470 for each task you want to work on. This lets you work on
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 657
diff changeset
471 multiple tasks in parallel, each isolated from the others until
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 657
diff changeset
472 it's complete and you're ready to integrate it back. Because
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 657
diff changeset
473 local clones are so cheap, there's almost no overhead to cloning
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 657
diff changeset
474 and destroying repositories whenever you want.</para>
91
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
475
683
c838b3975bc6 Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents: 682
diff changeset
476 <para id="x_3b">In our <filename class="directory">my-hello</filename>
652
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
477 repository, we have a file <filename>hello.c</filename> that
714
c44d5854620b Fix up chapter 1.
Bryan O'Sullivan <bos@serpentine.com>
parents: 693
diff changeset
478 contains the classic <quote>hello, world</quote> program.</para>
c44d5854620b Fix up chapter 1.
Bryan O'Sullivan <bos@serpentine.com>
parents: 693
diff changeset
479
c44d5854620b Fix up chapter 1.
Bryan O'Sullivan <bos@serpentine.com>
parents: 693
diff changeset
480 &interaction.tour.cat1;
658
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 657
diff changeset
481
714
c44d5854620b Fix up chapter 1.
Bryan O'Sullivan <bos@serpentine.com>
parents: 693
diff changeset
482 <para>Let's edit this file so that it prints a second line of
c44d5854620b Fix up chapter 1.
Bryan O'Sullivan <bos@serpentine.com>
parents: 693
diff changeset
483 output.</para>
c44d5854620b Fix up chapter 1.
Bryan O'Sullivan <bos@serpentine.com>
parents: 693
diff changeset
484
c44d5854620b Fix up chapter 1.
Bryan O'Sullivan <bos@serpentine.com>
parents: 693
diff changeset
485 &interaction.tour.cat2;
91
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
486
683
c838b3975bc6 Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents: 682
diff changeset
487 <para id="x_3c">Mercurial's <command role="hg-cmd">hg status</command>
652
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
488 command will tell us what Mercurial knows about the files in the
658
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 657
diff changeset
489 repository.</para>
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 657
diff changeset
490
665
27043f385f3f Get autogeneration of examples more or less working.
Bryan O'Sullivan <bos@serpentine.com>
parents: 658
diff changeset
491 &interaction.tour.status;
658
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 657
diff changeset
492
683
c838b3975bc6 Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents: 682
diff changeset
493 <para id="x_3d">The <command role="hg-cmd">hg status</command> command
658
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 657
diff changeset
494 prints no output for some files, but a line starting with
652
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
495 <quote><literal>M</literal></quote> for
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
496 <filename>hello.c</filename>. Unless you tell it to, <command
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
497 role="hg-cmd">hg status</command> will not print any output
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
498 for files that have not been modified.</para>
91
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
499
683
c838b3975bc6 Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents: 682
diff changeset
500 <para id="x_3e">The <quote><literal>M</literal></quote> indicates that
652
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
501 Mercurial has noticed that we modified
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
502 <filename>hello.c</filename>. We didn't need to
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
503 <emphasis>inform</emphasis> Mercurial that we were going to
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
504 modify the file before we started, or that we had modified the
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
505 file after we were done; it was able to figure this out
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
506 itself.</para>
91
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
507
714
c44d5854620b Fix up chapter 1.
Bryan O'Sullivan <bos@serpentine.com>
parents: 693
diff changeset
508 <para id="x_3f">It's somewhat helpful to know that we've modified
652
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
509 <filename>hello.c</filename>, but we might prefer to know
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
510 exactly <emphasis>what</emphasis> changes we've made to it. To
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
511 do this, we use the <command role="hg-cmd">hg diff</command>
658
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 657
diff changeset
512 command.</para>
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 657
diff changeset
513
665
27043f385f3f Get autogeneration of examples more or less working.
Bryan O'Sullivan <bos@serpentine.com>
parents: 658
diff changeset
514 &interaction.tour.diff;
91
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
515
714
c44d5854620b Fix up chapter 1.
Bryan O'Sullivan <bos@serpentine.com>
parents: 693
diff changeset
516 <tip>
c44d5854620b Fix up chapter 1.
Bryan O'Sullivan <bos@serpentine.com>
parents: 693
diff changeset
517 <title>Understanding patches</title>
c44d5854620b Fix up chapter 1.
Bryan O'Sullivan <bos@serpentine.com>
parents: 693
diff changeset
518
c44d5854620b Fix up chapter 1.
Bryan O'Sullivan <bos@serpentine.com>
parents: 693
diff changeset
519 <para>Remember to take a look at <xref
c44d5854620b Fix up chapter 1.
Bryan O'Sullivan <bos@serpentine.com>
parents: 693
diff changeset
520 linkend="sec:mq:patch"/> if you don't know how to read
c44d5854620b Fix up chapter 1.
Bryan O'Sullivan <bos@serpentine.com>
parents: 693
diff changeset
521 output above.</para>
c44d5854620b Fix up chapter 1.
Bryan O'Sullivan <bos@serpentine.com>
parents: 693
diff changeset
522 </tip>
652
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
523 </sect1>
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
524 <sect1>
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
525 <title>Recording changes in a new changeset</title>
91
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
526
683
c838b3975bc6 Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents: 682
diff changeset
527 <para id="x_40">We can modify files, build and test our changes, and use
652
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
528 <command role="hg-cmd">hg status</command> and <command
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
529 role="hg-cmd">hg diff</command> to review our changes, until
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
530 we're satisfied with what we've done and arrive at a natural
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
531 stopping point where we want to record our work in a new
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
532 changeset.</para>
91
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
533
683
c838b3975bc6 Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents: 682
diff changeset
534 <para id="x_41">The <command role="hg-cmd">hg commit</command> command lets
652
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
535 us create a new changeset; we'll usually refer to this as
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
536 <quote>making a commit</quote> or
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
537 <quote>committing</quote>.</para>
91
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
538
652
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
539 <sect2>
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
540 <title>Setting up a username</title>
102
ff9dc8bc2a8b More. Merge. Stuff.
Bryan O'Sullivan <bos@serpentine.com>
parents: 101
diff changeset
541
683
c838b3975bc6 Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents: 682
diff changeset
542 <para id="x_42">When you try to run <command role="hg-cmd">hg
652
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
543 commit</command> for the first time, it is not guaranteed to
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
544 succeed. Mercurial records your name and address with each
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
545 change that you commit, so that you and others will later be
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
546 able to tell who made each change. Mercurial tries to
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
547 automatically figure out a sensible username to commit the
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
548 change with. It will attempt each of the following methods,
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
549 in order:</para>
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
550 <orderedlist>
683
c838b3975bc6 Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents: 682
diff changeset
551 <listitem><para id="x_43">If you specify a <option
652
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
552 role="hg-opt-commit">-u</option> option to the <command
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
553 role="hg-cmd">hg commit</command> command on the command
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
554 line, followed by a username, this is always given the
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
555 highest precedence.</para></listitem>
683
c838b3975bc6 Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents: 682
diff changeset
556 <listitem><para id="x_44">If you have set the <envar>HGUSER</envar>
652
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
557 environment variable, this is checked
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
558 next.</para></listitem>
691
4ce9d0754af3 Remove the words "section", "chapter", etc from in front of xref tags.
Bryan O'Sullivan <bos@serpentine.com>
parents: 690
diff changeset
559 <listitem><para id="x_45">If you create a file in your home
4ce9d0754af3 Remove the words "section", "chapter", etc from in front of xref tags.
Bryan O'Sullivan <bos@serpentine.com>
parents: 690
diff changeset
560 directory called <filename
4ce9d0754af3 Remove the words "section", "chapter", etc from in front of xref tags.
Bryan O'Sullivan <bos@serpentine.com>
parents: 690
diff changeset
561 role="special">.hgrc</filename>, with a <envar
4ce9d0754af3 Remove the words "section", "chapter", etc from in front of xref tags.
Bryan O'Sullivan <bos@serpentine.com>
parents: 690
diff changeset
562 role="rc-item-ui">username</envar> entry, that will be
4ce9d0754af3 Remove the words "section", "chapter", etc from in front of xref tags.
Bryan O'Sullivan <bos@serpentine.com>
parents: 690
diff changeset
563 used next. To see what the contents of this file should
4ce9d0754af3 Remove the words "section", "chapter", etc from in front of xref tags.
Bryan O'Sullivan <bos@serpentine.com>
parents: 690
diff changeset
564 look like, refer to <xref
657
8631da51309b Slow progress on XML conversion
Bryan O'Sullivan <bos@serpentine.com>
parents: 652
diff changeset
565 linkend="sec:tour-basic:username"/>
652
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
566 below.</para></listitem>
683
c838b3975bc6 Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents: 682
diff changeset
567 <listitem><para id="x_46">If you have set the <envar>EMAIL</envar>
652
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
568 environment variable, this will be used
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
569 next.</para></listitem>
683
c838b3975bc6 Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents: 682
diff changeset
570 <listitem><para id="x_47">Mercurial will query your system to find out
652
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
571 your local user name and host name, and construct a
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
572 username from these components. Since this often results
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
573 in a username that is not very useful, it will print a
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
574 warning if it has to do
657
8631da51309b Slow progress on XML conversion
Bryan O'Sullivan <bos@serpentine.com>
parents: 652
diff changeset
575 this.</para></listitem>
8631da51309b Slow progress on XML conversion
Bryan O'Sullivan <bos@serpentine.com>
parents: 652
diff changeset
576 </orderedlist>
683
c838b3975bc6 Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents: 682
diff changeset
577 <para id="x_48">If all of these mechanisms fail, Mercurial will
652
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
578 fail, printing an error message. In this case, it will not
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
579 let you commit until you set up a
657
8631da51309b Slow progress on XML conversion
Bryan O'Sullivan <bos@serpentine.com>
parents: 652
diff changeset
580 username.</para>
683
c838b3975bc6 Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents: 682
diff changeset
581 <para id="x_49">You should think of the <envar>HGUSER</envar> environment
657
8631da51309b Slow progress on XML conversion
Bryan O'Sullivan <bos@serpentine.com>
parents: 652
diff changeset
582 variable and the <option role="hg-opt-commit">-u</option>
8631da51309b Slow progress on XML conversion
Bryan O'Sullivan <bos@serpentine.com>
parents: 652
diff changeset
583 option to the <command role="hg-cmd">hg commit</command>
8631da51309b Slow progress on XML conversion
Bryan O'Sullivan <bos@serpentine.com>
parents: 652
diff changeset
584 command as ways to <emphasis>override</emphasis> Mercurial's
8631da51309b Slow progress on XML conversion
Bryan O'Sullivan <bos@serpentine.com>
parents: 652
diff changeset
585 default selection of username. For normal use, the simplest
8631da51309b Slow progress on XML conversion
Bryan O'Sullivan <bos@serpentine.com>
parents: 652
diff changeset
586 and most robust way to set a username for yourself is by
8631da51309b Slow progress on XML conversion
Bryan O'Sullivan <bos@serpentine.com>
parents: 652
diff changeset
587 creating a <filename role="special">.hgrc</filename> file; see
8631da51309b Slow progress on XML conversion
Bryan O'Sullivan <bos@serpentine.com>
parents: 652
diff changeset
588 below for details.</para>
8631da51309b Slow progress on XML conversion
Bryan O'Sullivan <bos@serpentine.com>
parents: 652
diff changeset
589 <sect3 id="sec:tour-basic:username">
652
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
590 <title>Creating a Mercurial configuration file</title>
657
8631da51309b Slow progress on XML conversion
Bryan O'Sullivan <bos@serpentine.com>
parents: 652
diff changeset
591
683
c838b3975bc6 Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents: 682
diff changeset
592 <para id="x_4a">To set a user name, use your favourite editor
652
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
593 to create a file called <filename
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
594 role="special">.hgrc</filename> in your home directory.
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
595 Mercurial will use this file to look up your personalised
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
596 configuration settings. The initial contents of your
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
597 <filename role="special">.hgrc</filename> should look like
657
8631da51309b Slow progress on XML conversion
Bryan O'Sullivan <bos@serpentine.com>
parents: 652
diff changeset
598 this.</para>
714
c44d5854620b Fix up chapter 1.
Bryan O'Sullivan <bos@serpentine.com>
parents: 693
diff changeset
599
c44d5854620b Fix up chapter 1.
Bryan O'Sullivan <bos@serpentine.com>
parents: 693
diff changeset
600 <remark>Figure out what the appropriate directory is on
c44d5854620b Fix up chapter 1.
Bryan O'Sullivan <bos@serpentine.com>
parents: 693
diff changeset
601 Windows.</remark>
c44d5854620b Fix up chapter 1.
Bryan O'Sullivan <bos@serpentine.com>
parents: 693
diff changeset
602
657
8631da51309b Slow progress on XML conversion
Bryan O'Sullivan <bos@serpentine.com>
parents: 652
diff changeset
603 <programlisting># This is a Mercurial configuration file.
679
80928ea6e7ae Add the ability to include text files and have them XML-mangled.
Bryan O'Sullivan <bos@serpentine.com>
parents: 671
diff changeset
604 [ui]
714
c44d5854620b Fix up chapter 1.
Bryan O'Sullivan <bos@serpentine.com>
parents: 693
diff changeset
605 username = Firstname Lastname &lt;email.address@domain.net&gt;</programlisting>
657
8631da51309b Slow progress on XML conversion
Bryan O'Sullivan <bos@serpentine.com>
parents: 652
diff changeset
606
683
c838b3975bc6 Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents: 682
diff changeset
607 <para id="x_4b">The <quote><literal>[ui]</literal></quote> line begins a
657
8631da51309b Slow progress on XML conversion
Bryan O'Sullivan <bos@serpentine.com>
parents: 652
diff changeset
608 <emphasis>section</emphasis> of the config file, so you can
8631da51309b Slow progress on XML conversion
Bryan O'Sullivan <bos@serpentine.com>
parents: 652
diff changeset
609 read the <quote><literal>username = ...</literal></quote>
8631da51309b Slow progress on XML conversion
Bryan O'Sullivan <bos@serpentine.com>
parents: 652
diff changeset
610 line as meaning <quote>set the value of the
8631da51309b Slow progress on XML conversion
Bryan O'Sullivan <bos@serpentine.com>
parents: 652
diff changeset
611 <literal>username</literal> item in the
8631da51309b Slow progress on XML conversion
Bryan O'Sullivan <bos@serpentine.com>
parents: 652
diff changeset
612 <literal>ui</literal> section</quote>. A section continues
8631da51309b Slow progress on XML conversion
Bryan O'Sullivan <bos@serpentine.com>
parents: 652
diff changeset
613 until a new section begins, or the end of the file.
8631da51309b Slow progress on XML conversion
Bryan O'Sullivan <bos@serpentine.com>
parents: 652
diff changeset
614 Mercurial ignores empty lines and treats any text from
8631da51309b Slow progress on XML conversion
Bryan O'Sullivan <bos@serpentine.com>
parents: 652
diff changeset
615 <quote><literal>#</literal></quote> to the end of a line as
8631da51309b Slow progress on XML conversion
Bryan O'Sullivan <bos@serpentine.com>
parents: 652
diff changeset
616 a comment.</para>
652
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
617 </sect3>
657
8631da51309b Slow progress on XML conversion
Bryan O'Sullivan <bos@serpentine.com>
parents: 652
diff changeset
618
652
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
619 <sect3>
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
620 <title>Choosing a user name</title>
102
ff9dc8bc2a8b More. Merge. Stuff.
Bryan O'Sullivan <bos@serpentine.com>
parents: 101
diff changeset
621
683
c838b3975bc6 Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents: 682
diff changeset
622 <para id="x_4c">You can use any text you like as the value of
652
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
623 the <literal>username</literal> config item, since this
714
c44d5854620b Fix up chapter 1.
Bryan O'Sullivan <bos@serpentine.com>
parents: 693
diff changeset
624 information is for reading by other people, but will not be
c44d5854620b Fix up chapter 1.
Bryan O'Sullivan <bos@serpentine.com>
parents: 693
diff changeset
625 interpreted by Mercurial. The convention that most
652
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
626 people follow is to use their name and email address, as
657
8631da51309b Slow progress on XML conversion
Bryan O'Sullivan <bos@serpentine.com>
parents: 652
diff changeset
627 in the example above.</para>
652
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
628 <note>
683
c838b3975bc6 Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents: 682
diff changeset
629 <para id="x_4d">Mercurial's built-in web server obfuscates
652
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
630 email addresses, to make it more difficult for the email
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
631 harvesting tools that spammers use. This reduces the
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
632 likelihood that you'll start receiving more junk email
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
633 if you publish a Mercurial repository on the
657
8631da51309b Slow progress on XML conversion
Bryan O'Sullivan <bos@serpentine.com>
parents: 652
diff changeset
634 web.</para></note>
102
ff9dc8bc2a8b More. Merge. Stuff.
Bryan O'Sullivan <bos@serpentine.com>
parents: 101
diff changeset
635
652
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
636 </sect3>
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
637 </sect2>
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
638 <sect2>
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
639 <title>Writing a commit message</title>
102
ff9dc8bc2a8b More. Merge. Stuff.
Bryan O'Sullivan <bos@serpentine.com>
parents: 101
diff changeset
640
683
c838b3975bc6 Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents: 682
diff changeset
641 <para id="x_4e">When we commit a change, Mercurial drops us into
652
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
642 a text editor, to enter a message that will describe the
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
643 modifications we've made in this changeset. This is called
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
644 the <emphasis>commit message</emphasis>. It will be a
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
645 record for readers of what we did and why, and it will be
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
646 printed by <command role="hg-cmd">hg log</command> after
657
8631da51309b Slow progress on XML conversion
Bryan O'Sullivan <bos@serpentine.com>
parents: 652
diff changeset
647 we've finished committing.</para>
8631da51309b Slow progress on XML conversion
Bryan O'Sullivan <bos@serpentine.com>
parents: 652
diff changeset
648
665
27043f385f3f Get autogeneration of examples more or less working.
Bryan O'Sullivan <bos@serpentine.com>
parents: 658
diff changeset
649 &interaction.tour.commit;
657
8631da51309b Slow progress on XML conversion
Bryan O'Sullivan <bos@serpentine.com>
parents: 652
diff changeset
650
683
c838b3975bc6 Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents: 682
diff changeset
651 <para id="x_4f">The editor that the <command role="hg-cmd">hg
652
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
652 commit</command> command drops us into will contain an
714
c44d5854620b Fix up chapter 1.
Bryan O'Sullivan <bos@serpentine.com>
parents: 693
diff changeset
653 empty line or two, followed by a number of lines starting with
657
8631da51309b Slow progress on XML conversion
Bryan O'Sullivan <bos@serpentine.com>
parents: 652
diff changeset
654 <quote><literal>HG:</literal></quote>.</para>
8631da51309b Slow progress on XML conversion
Bryan O'Sullivan <bos@serpentine.com>
parents: 652
diff changeset
655
714
c44d5854620b Fix up chapter 1.
Bryan O'Sullivan <bos@serpentine.com>
parents: 693
diff changeset
656 <programlisting>
c44d5854620b Fix up chapter 1.
Bryan O'Sullivan <bos@serpentine.com>
parents: 693
diff changeset
657 This is where I type my commit comment.
c44d5854620b Fix up chapter 1.
Bryan O'Sullivan <bos@serpentine.com>
parents: 693
diff changeset
658
c44d5854620b Fix up chapter 1.
Bryan O'Sullivan <bos@serpentine.com>
parents: 693
diff changeset
659 HG: Enter commit message. Lines beginning with 'HG:' are removed.
c44d5854620b Fix up chapter 1.
Bryan O'Sullivan <bos@serpentine.com>
parents: 693
diff changeset
660 HG: --
c44d5854620b Fix up chapter 1.
Bryan O'Sullivan <bos@serpentine.com>
parents: 693
diff changeset
661 HG: user: Bryan O'Sullivan &lt;bos@serpentine.com&gt;
c44d5854620b Fix up chapter 1.
Bryan O'Sullivan <bos@serpentine.com>
parents: 693
diff changeset
662 HG: branch 'default'
c44d5854620b Fix up chapter 1.
Bryan O'Sullivan <bos@serpentine.com>
parents: 693
diff changeset
663 HG: changed hello.c</programlisting>
657
8631da51309b Slow progress on XML conversion
Bryan O'Sullivan <bos@serpentine.com>
parents: 652
diff changeset
664
683
c838b3975bc6 Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents: 682
diff changeset
665 <para id="x_50">Mercurial ignores the lines that start with
652
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
666 <quote><literal>HG:</literal></quote>; it uses them only to
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
667 tell us which files it's recording changes to. Modifying or
657
8631da51309b Slow progress on XML conversion
Bryan O'Sullivan <bos@serpentine.com>
parents: 652
diff changeset
668 deleting these lines has no effect.</para>
652
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
669 </sect2>
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
670 <sect2>
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
671 <title>Writing a good commit message</title>
91
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
672
683
c838b3975bc6 Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents: 682
diff changeset
673 <para id="x_51">Since <command role="hg-cmd">hg log</command>
652
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
674 only prints the first line of a commit message by default,
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
675 it's best to write a commit message whose first line stands
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
676 alone. Here's a real example of a commit message that
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
677 <emphasis>doesn't</emphasis> follow this guideline, and
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
678 hence has a summary that is not
657
8631da51309b Slow progress on XML conversion
Bryan O'Sullivan <bos@serpentine.com>
parents: 652
diff changeset
679 readable.</para>
91
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
680
657
8631da51309b Slow progress on XML conversion
Bryan O'Sullivan <bos@serpentine.com>
parents: 652
diff changeset
681 <programlisting>
8631da51309b Slow progress on XML conversion
Bryan O'Sullivan <bos@serpentine.com>
parents: 652
diff changeset
682 changeset: 73:584af0e231be
679
80928ea6e7ae Add the ability to include text files and have them XML-mangled.
Bryan O'Sullivan <bos@serpentine.com>
parents: 671
diff changeset
683 user: Censored Person &lt;censored.person@example.org&gt;
80928ea6e7ae Add the ability to include text files and have them XML-mangled.
Bryan O'Sullivan <bos@serpentine.com>
parents: 671
diff changeset
684 date: Tue Sep 26 21:37:07 2006 -0700
657
8631da51309b Slow progress on XML conversion
Bryan O'Sullivan <bos@serpentine.com>
parents: 652
diff changeset
685 summary: include buildmeister/commondefs. Add exports.</programlisting>
8631da51309b Slow progress on XML conversion
Bryan O'Sullivan <bos@serpentine.com>
parents: 652
diff changeset
686
683
c838b3975bc6 Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents: 682
diff changeset
687 <para id="x_52">As far as the remainder of the contents of the
652
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
688 commit message are concerned, there are no hard-and-fast
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
689 rules. Mercurial itself doesn't interpret or care about the
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
690 contents of the commit message, though your project may have
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
691 policies that dictate a certain kind of
657
8631da51309b Slow progress on XML conversion
Bryan O'Sullivan <bos@serpentine.com>
parents: 652
diff changeset
692 formatting.</para>
683
c838b3975bc6 Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents: 682
diff changeset
693 <para id="x_53">My personal preference is for short, but
652
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
694 informative, commit messages that tell me something that I
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
695 can't figure out with a quick glance at the output of
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
696 <command role="hg-cmd">hg log
657
8631da51309b Slow progress on XML conversion
Bryan O'Sullivan <bos@serpentine.com>
parents: 652
diff changeset
697 --patch</command>.</para>
652
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
698 </sect2>
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
699 <sect2>
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
700 <title>Aborting a commit</title>
91
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
701
683
c838b3975bc6 Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents: 682
diff changeset
702 <para id="x_54">If you decide that you don't want to commit
652
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
703 while in the middle of editing a commit message, simply exit
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
704 from your editor without saving the file that it's editing.
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
705 This will cause nothing to happen to either the repository
657
8631da51309b Slow progress on XML conversion
Bryan O'Sullivan <bos@serpentine.com>
parents: 652
diff changeset
706 or the working directory.</para>
683
c838b3975bc6 Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents: 682
diff changeset
707 <para id="x_55">If we run the <command role="hg-cmd">hg
652
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
708 commit</command> command without any arguments, it records
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
709 all of the changes we've made, as reported by <command
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
710 role="hg-cmd">hg status</command> and <command
657
8631da51309b Slow progress on XML conversion
Bryan O'Sullivan <bos@serpentine.com>
parents: 652
diff changeset
711 role="hg-cmd">hg diff</command>.</para>
652
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
712 </sect2>
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
713 <sect2>
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
714 <title>Admiring our new handiwork</title>
91
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
715
683
c838b3975bc6 Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents: 682
diff changeset
716 <para id="x_56">Once we've finished the commit, we can use the
652
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
717 <command role="hg-cmd">hg tip</command> command to display
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
718 the changeset we just created. This command produces output
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
719 that is identical to <command role="hg-cmd">hg
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
720 log</command>, but it only displays the newest revision in
657
8631da51309b Slow progress on XML conversion
Bryan O'Sullivan <bos@serpentine.com>
parents: 652
diff changeset
721 the repository.</para>
8631da51309b Slow progress on XML conversion
Bryan O'Sullivan <bos@serpentine.com>
parents: 652
diff changeset
722
665
27043f385f3f Get autogeneration of examples more or less working.
Bryan O'Sullivan <bos@serpentine.com>
parents: 658
diff changeset
723 &interaction.tour.tip;
657
8631da51309b Slow progress on XML conversion
Bryan O'Sullivan <bos@serpentine.com>
parents: 652
diff changeset
724
714
c44d5854620b Fix up chapter 1.
Bryan O'Sullivan <bos@serpentine.com>
parents: 693
diff changeset
725 <para id="x_57">We refer to the newest revision in the
c44d5854620b Fix up chapter 1.
Bryan O'Sullivan <bos@serpentine.com>
parents: 693
diff changeset
726 repository as the <emphasis>tip revision</emphasis>, or simply
c44d5854620b Fix up chapter 1.
Bryan O'Sullivan <bos@serpentine.com>
parents: 693
diff changeset
727 the <emphasis>tip</emphasis>.</para>
c44d5854620b Fix up chapter 1.
Bryan O'Sullivan <bos@serpentine.com>
parents: 693
diff changeset
728
c44d5854620b Fix up chapter 1.
Bryan O'Sullivan <bos@serpentine.com>
parents: 693
diff changeset
729 <para>By the way, the <command role="hg-cmd">hg tip</command>
c44d5854620b Fix up chapter 1.
Bryan O'Sullivan <bos@serpentine.com>
parents: 693
diff changeset
730 command accepts many of the same options as <command
c44d5854620b Fix up chapter 1.
Bryan O'Sullivan <bos@serpentine.com>
parents: 693
diff changeset
731 role="hg-cmd">hg log</command>, so <option
c44d5854620b Fix up chapter 1.
Bryan O'Sullivan <bos@serpentine.com>
parents: 693
diff changeset
732 role="hg-opt-global">-v</option> above indicates <quote>be
c44d5854620b Fix up chapter 1.
Bryan O'Sullivan <bos@serpentine.com>
parents: 693
diff changeset
733 verbose</quote>, <option role="hg-opt-tip">-p</option>
c44d5854620b Fix up chapter 1.
Bryan O'Sullivan <bos@serpentine.com>
parents: 693
diff changeset
734 specifies <quote>print a patch</quote>. The use of <option
c44d5854620b Fix up chapter 1.
Bryan O'Sullivan <bos@serpentine.com>
parents: 693
diff changeset
735 role="hg-opt-tip">-p</option> to print patches is another
c44d5854620b Fix up chapter 1.
Bryan O'Sullivan <bos@serpentine.com>
parents: 693
diff changeset
736 example of the consistent naming we mentioned earlier.</para>
652
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
737 </sect2>
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
738 </sect1>
657
8631da51309b Slow progress on XML conversion
Bryan O'Sullivan <bos@serpentine.com>
parents: 652
diff changeset
739
652
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
740 <sect1>
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
741 <title>Sharing changes</title>
91
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
742
683
c838b3975bc6 Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents: 682
diff changeset
743 <para id="x_58">We mentioned earlier that repositories in
652
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
744 Mercurial are self-contained. This means that the changeset
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
745 we just created exists only in our <filename
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
746 class="directory">my-hello</filename> repository. Let's
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
747 look at a few ways that we can propagate this change into
657
8631da51309b Slow progress on XML conversion
Bryan O'Sullivan <bos@serpentine.com>
parents: 652
diff changeset
748 other repositories.</para>
8631da51309b Slow progress on XML conversion
Bryan O'Sullivan <bos@serpentine.com>
parents: 652
diff changeset
749
8631da51309b Slow progress on XML conversion
Bryan O'Sullivan <bos@serpentine.com>
parents: 652
diff changeset
750 <sect2 id="sec:tour:pull">
652
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
751 <title>Pulling changes from another repository</title>
683
c838b3975bc6 Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents: 682
diff changeset
752 <para id="x_59">To get started, let's clone our original
652
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
753 <filename class="directory">hello</filename> repository,
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
754 which does not contain the change we just committed. We'll
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
755 call our temporary repository <filename
657
8631da51309b Slow progress on XML conversion
Bryan O'Sullivan <bos@serpentine.com>
parents: 652
diff changeset
756 class="directory">hello-pull</filename>.</para>
8631da51309b Slow progress on XML conversion
Bryan O'Sullivan <bos@serpentine.com>
parents: 652
diff changeset
757
665
27043f385f3f Get autogeneration of examples more or less working.
Bryan O'Sullivan <bos@serpentine.com>
parents: 658
diff changeset
758 &interaction.tour.clone-pull;
657
8631da51309b Slow progress on XML conversion
Bryan O'Sullivan <bos@serpentine.com>
parents: 652
diff changeset
759
683
c838b3975bc6 Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents: 682
diff changeset
760 <para id="x_5a">We'll use the <command role="hg-cmd">hg
652
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
761 pull</command> command to bring changes from <filename
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
762 class="directory">my-hello</filename> into <filename
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
763 class="directory">hello-pull</filename>. However, blindly
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
764 pulling unknown changes into a repository is a somewhat
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
765 scary prospect. Mercurial provides the <command
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
766 role="hg-cmd">hg incoming</command> command to tell us
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
767 what changes the <command role="hg-cmd">hg pull</command>
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
768 command <emphasis>would</emphasis> pull into the repository,
657
8631da51309b Slow progress on XML conversion
Bryan O'Sullivan <bos@serpentine.com>
parents: 652
diff changeset
769 without actually pulling the changes in.</para>
8631da51309b Slow progress on XML conversion
Bryan O'Sullivan <bos@serpentine.com>
parents: 652
diff changeset
770
665
27043f385f3f Get autogeneration of examples more or less working.
Bryan O'Sullivan <bos@serpentine.com>
parents: 658
diff changeset
771 &interaction.tour.incoming;
657
8631da51309b Slow progress on XML conversion
Bryan O'Sullivan <bos@serpentine.com>
parents: 652
diff changeset
772
714
c44d5854620b Fix up chapter 1.
Bryan O'Sullivan <bos@serpentine.com>
parents: 693
diff changeset
773 <para id="x_5b">Suppose you're pulling changes from a repository
c44d5854620b Fix up chapter 1.
Bryan O'Sullivan <bos@serpentine.com>
parents: 693
diff changeset
774 on the network somewhere. While you are looking at the <command
c44d5854620b Fix up chapter 1.
Bryan O'Sullivan <bos@serpentine.com>
parents: 693
diff changeset
775 role="hg-cmd">hg incoming</command> output, and before you
c44d5854620b Fix up chapter 1.
Bryan O'Sullivan <bos@serpentine.com>
parents: 693
diff changeset
776 pull those changes, someone might have committed something in
c44d5854620b Fix up chapter 1.
Bryan O'Sullivan <bos@serpentine.com>
parents: 693
diff changeset
777 the remote repository. This means that it's possible to pull
c44d5854620b Fix up chapter 1.
Bryan O'Sullivan <bos@serpentine.com>
parents: 693
diff changeset
778 more changes than you saw when using <command
c44d5854620b Fix up chapter 1.
Bryan O'Sullivan <bos@serpentine.com>
parents: 693
diff changeset
779 role="hg-cmd">hg incoming</command>.</para>
657
8631da51309b Slow progress on XML conversion
Bryan O'Sullivan <bos@serpentine.com>
parents: 652
diff changeset
780
683
c838b3975bc6 Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents: 682
diff changeset
781 <para id="x_5c">Bringing changes into a repository is a simple
652
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
782 matter of running the <command role="hg-cmd">hg
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
783 pull</command> command, and telling it which repository to
657
8631da51309b Slow progress on XML conversion
Bryan O'Sullivan <bos@serpentine.com>
parents: 652
diff changeset
784 pull from.</para>
8631da51309b Slow progress on XML conversion
Bryan O'Sullivan <bos@serpentine.com>
parents: 652
diff changeset
785
665
27043f385f3f Get autogeneration of examples more or less working.
Bryan O'Sullivan <bos@serpentine.com>
parents: 658
diff changeset
786 &interaction.tour.pull;
657
8631da51309b Slow progress on XML conversion
Bryan O'Sullivan <bos@serpentine.com>
parents: 652
diff changeset
787
683
c838b3975bc6 Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents: 682
diff changeset
788 <para id="x_5d">As you can see
652
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
789 from the before-and-after output of <command
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
790 role="hg-cmd">hg tip</command>, we have successfully
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
791 pulled changes into our repository. There remains one step
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
792 before we can see these changes in the working
657
8631da51309b Slow progress on XML conversion
Bryan O'Sullivan <bos@serpentine.com>
parents: 652
diff changeset
793 directory.</para>
652
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
794 </sect2>
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
795 <sect2>
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
796 <title>Updating the working directory</title>
91
7524d52d9577 More tour progress.
Bryan O'Sullivan <bos@serpentine.com>
parents: 88
diff changeset
797
691
4ce9d0754af3 Remove the words "section", "chapter", etc from in front of xref tags.
Bryan O'Sullivan <bos@serpentine.com>
parents: 690
diff changeset
798 <para id="x_5e">We have so far glossed over the relationship
4ce9d0754af3 Remove the words "section", "chapter", etc from in front of xref tags.
Bryan O'Sullivan <bos@serpentine.com>
parents: 690
diff changeset
799 between a repository and its working directory. The <command
658
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 657
diff changeset
800 role="hg-cmd">hg pull</command> command that we ran in
691
4ce9d0754af3 Remove the words "section", "chapter", etc from in front of xref tags.
Bryan O'Sullivan <bos@serpentine.com>
parents: 690
diff changeset
801 <xref linkend="sec:tour:pull"/> brought changes into the
4ce9d0754af3 Remove the words "section", "chapter", etc from in front of xref tags.
Bryan O'Sullivan <bos@serpentine.com>
parents: 690
diff changeset
802 repository, but if we check, there's no sign of those changes
4ce9d0754af3 Remove the words "section", "chapter", etc from in front of xref tags.
Bryan O'Sullivan <bos@serpentine.com>
parents: 690
diff changeset
803 in the working directory. This is because <command
658
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 657
diff changeset
804 role="hg-cmd">hg pull</command> does not (by default) touch
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 657
diff changeset
805 the working directory. Instead, we use the <command
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 657
diff changeset
806 role="hg-cmd">hg update</command> command to do this.</para>
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 657
diff changeset
807
665
27043f385f3f Get autogeneration of examples more or less working.
Bryan O'Sullivan <bos@serpentine.com>
parents: 658
diff changeset
808 &interaction.tour.update;
658
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 657
diff changeset
809
683
c838b3975bc6 Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents: 682
diff changeset
810 <para id="x_5f">It might seem a bit strange that <command role="hg-cmd">hg
658
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 657
diff changeset
811 pull</command> doesn't update the working directory
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 657
diff changeset
812 automatically. There's actually a good reason for this: you
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 657
diff changeset
813 can use <command role="hg-cmd">hg update</command> to update
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 657
diff changeset
814 the working directory to the state it was in at <emphasis>any
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 657
diff changeset
815 revision</emphasis> in the history of the repository. If
714
c44d5854620b Fix up chapter 1.
Bryan O'Sullivan <bos@serpentine.com>
parents: 693
diff changeset
816 you had the working directory updated to an old revision&emdash;to
c44d5854620b Fix up chapter 1.
Bryan O'Sullivan <bos@serpentine.com>
parents: 693
diff changeset
817 hunt down the origin of a bug, say&emdash;and ran a <command
658
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 657
diff changeset
818 role="hg-cmd">hg pull</command> which automatically updated
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 657
diff changeset
819 the working directory to a new revision, you might not be
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 657
diff changeset
820 terribly happy.</para>
683
c838b3975bc6 Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents: 682
diff changeset
821 <para id="x_60">However, since pull-then-update is such a common thing to
658
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 657
diff changeset
822 do, Mercurial lets you combine the two by passing the <option
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 657
diff changeset
823 role="hg-opt-pull">-u</option> option to <command
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 657
diff changeset
824 role="hg-cmd">hg pull</command>.</para>
657
8631da51309b Slow progress on XML conversion
Bryan O'Sullivan <bos@serpentine.com>
parents: 652
diff changeset
825
683
c838b3975bc6 Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents: 682
diff changeset
826 <para id="x_61">If you look back at the output of <command
691
4ce9d0754af3 Remove the words "section", "chapter", etc from in front of xref tags.
Bryan O'Sullivan <bos@serpentine.com>
parents: 690
diff changeset
827 role="hg-cmd">hg pull</command> in <xref
657
8631da51309b Slow progress on XML conversion
Bryan O'Sullivan <bos@serpentine.com>
parents: 652
diff changeset
828 linkend="sec:tour:pull"/> when we ran it without <option
658
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 657
diff changeset
829 role="hg-opt-pull">-u</option>, you can see that it printed
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 657
diff changeset
830 a helpful reminder that we'd have to take an explicit step to
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 657
diff changeset
831 update the working directory:</para>
657
8631da51309b Slow progress on XML conversion
Bryan O'Sullivan <bos@serpentine.com>
parents: 652
diff changeset
832
8631da51309b Slow progress on XML conversion
Bryan O'Sullivan <bos@serpentine.com>
parents: 652
diff changeset
833 <!-- &interaction.xxx.fixme; -->
101
321732566ac1 A few bits of terminological clarification.
Bryan O'Sullivan <bos@serpentine.com>
parents: 99
diff changeset
834
683
c838b3975bc6 Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents: 682
diff changeset
835 <para id="x_62">To find out what revision the working directory is at, use
658
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 657
diff changeset
836 the <command role="hg-cmd">hg parents</command>
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 657
diff changeset
837 command.</para>
657
8631da51309b Slow progress on XML conversion
Bryan O'Sullivan <bos@serpentine.com>
parents: 652
diff changeset
838
665
27043f385f3f Get autogeneration of examples more or less working.
Bryan O'Sullivan <bos@serpentine.com>
parents: 658
diff changeset
839 &interaction.tour.parents;
657
8631da51309b Slow progress on XML conversion
Bryan O'Sullivan <bos@serpentine.com>
parents: 652
diff changeset
840
691
4ce9d0754af3 Remove the words "section", "chapter", etc from in front of xref tags.
Bryan O'Sullivan <bos@serpentine.com>
parents: 690
diff changeset
841 <para id="x_63">If you look back at <xref
658
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 657
diff changeset
842 linkend="fig:tour-basic:history"/>,
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 657
diff changeset
843 you'll see arrows connecting each changeset. The node that
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 657
diff changeset
844 the arrow leads <emphasis>from</emphasis> in each case is a
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 657
diff changeset
845 parent, and the node that the arrow leads
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 657
diff changeset
846 <emphasis>to</emphasis> is its child. The working directory
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 657
diff changeset
847 has a parent in just the same way; this is the changeset that
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 657
diff changeset
848 the working directory currently contains.</para>
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 657
diff changeset
849
683
c838b3975bc6 Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents: 682
diff changeset
850 <para id="x_64">To update the working directory to a particular revision,
658
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 657
diff changeset
851
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 657
diff changeset
852 give a revision number or changeset ID to the <command
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 657
diff changeset
853 role="hg-cmd">hg update</command> command.</para>
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 657
diff changeset
854
665
27043f385f3f Get autogeneration of examples more or less working.
Bryan O'Sullivan <bos@serpentine.com>
parents: 658
diff changeset
855 &interaction.tour.older;
658
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 657
diff changeset
856
683
c838b3975bc6 Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents: 682
diff changeset
857 <para id="x_65">If you omit an explicit revision, <command
658
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 657
diff changeset
858 role="hg-cmd">hg update</command> will update to the tip
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 657
diff changeset
859 revision, as shown by the second call to <command
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 657
diff changeset
860 role="hg-cmd">hg update</command> in the example
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 657
diff changeset
861 above.</para>
652
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
862 </sect2>
657
8631da51309b Slow progress on XML conversion
Bryan O'Sullivan <bos@serpentine.com>
parents: 652
diff changeset
863
652
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
864 <sect2>
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
865 <title>Pushing changes to another repository</title>
92
72d207927dc4 Tour: push.
Bryan O'Sullivan <bos@serpentine.com>
parents: 91
diff changeset
866
683
c838b3975bc6 Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents: 682
diff changeset
867 <para id="x_66">Mercurial lets us push changes to another
652
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
868 repository, from the repository we're currently visiting.
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
869 As with the example of <command role="hg-cmd">hg
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
870 pull</command> above, we'll create a temporary repository
657
8631da51309b Slow progress on XML conversion
Bryan O'Sullivan <bos@serpentine.com>
parents: 652
diff changeset
871 to push our changes into.</para>
8631da51309b Slow progress on XML conversion
Bryan O'Sullivan <bos@serpentine.com>
parents: 652
diff changeset
872
665
27043f385f3f Get autogeneration of examples more or less working.
Bryan O'Sullivan <bos@serpentine.com>
parents: 658
diff changeset
873 &interaction.tour.clone-push;
657
8631da51309b Slow progress on XML conversion
Bryan O'Sullivan <bos@serpentine.com>
parents: 652
diff changeset
874
683
c838b3975bc6 Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents: 682
diff changeset
875 <para id="x_67">The <command role="hg-cmd">hg outgoing</command> command
652
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
876 tells us what changes would be pushed into another
657
8631da51309b Slow progress on XML conversion
Bryan O'Sullivan <bos@serpentine.com>
parents: 652
diff changeset
877 repository.</para>
8631da51309b Slow progress on XML conversion
Bryan O'Sullivan <bos@serpentine.com>
parents: 652
diff changeset
878
665
27043f385f3f Get autogeneration of examples more or less working.
Bryan O'Sullivan <bos@serpentine.com>
parents: 658
diff changeset
879 &interaction.tour.outgoing;
657
8631da51309b Slow progress on XML conversion
Bryan O'Sullivan <bos@serpentine.com>
parents: 652
diff changeset
880
683
c838b3975bc6 Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents: 682
diff changeset
881 <para id="x_68">And the
652
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
882 <command role="hg-cmd">hg push</command> command does the
657
8631da51309b Slow progress on XML conversion
Bryan O'Sullivan <bos@serpentine.com>
parents: 652
diff changeset
883 actual push.</para>
8631da51309b Slow progress on XML conversion
Bryan O'Sullivan <bos@serpentine.com>
parents: 652
diff changeset
884
665
27043f385f3f Get autogeneration of examples more or less working.
Bryan O'Sullivan <bos@serpentine.com>
parents: 658
diff changeset
885 &interaction.tour.push;
657
8631da51309b Slow progress on XML conversion
Bryan O'Sullivan <bos@serpentine.com>
parents: 652
diff changeset
886
714
c44d5854620b Fix up chapter 1.
Bryan O'Sullivan <bos@serpentine.com>
parents: 693
diff changeset
887 <para id="x_69">As with <command role="hg-cmd">hg
c44d5854620b Fix up chapter 1.
Bryan O'Sullivan <bos@serpentine.com>
parents: 693
diff changeset
888 pull</command>, the <command role="hg-cmd">hg push</command>
c44d5854620b Fix up chapter 1.
Bryan O'Sullivan <bos@serpentine.com>
parents: 693
diff changeset
889 command does not update the working directory in the
c44d5854620b Fix up chapter 1.
Bryan O'Sullivan <bos@serpentine.com>
parents: 693
diff changeset
890 repository that it's pushing changes into. Unlike <command
c44d5854620b Fix up chapter 1.
Bryan O'Sullivan <bos@serpentine.com>
parents: 693
diff changeset
891 role="hg-cmd">hg pull</command>, <command role="hg-cmd">hg
c44d5854620b Fix up chapter 1.
Bryan O'Sullivan <bos@serpentine.com>
parents: 693
diff changeset
892 push</command> does not provide a <literal>-u</literal>
c44d5854620b Fix up chapter 1.
Bryan O'Sullivan <bos@serpentine.com>
parents: 693
diff changeset
893 option that updates the other repository's working directory.
c44d5854620b Fix up chapter 1.
Bryan O'Sullivan <bos@serpentine.com>
parents: 693
diff changeset
894 This asymmetry is deliberate: the repository we're pushing to
c44d5854620b Fix up chapter 1.
Bryan O'Sullivan <bos@serpentine.com>
parents: 693
diff changeset
895 might be on a remote server and shared between several people.
c44d5854620b Fix up chapter 1.
Bryan O'Sullivan <bos@serpentine.com>
parents: 693
diff changeset
896 If we were to update its working directory while someone was
c44d5854620b Fix up chapter 1.
Bryan O'Sullivan <bos@serpentine.com>
parents: 693
diff changeset
897 working in it, their work would be disrupted.</para>
657
8631da51309b Slow progress on XML conversion
Bryan O'Sullivan <bos@serpentine.com>
parents: 652
diff changeset
898
683
c838b3975bc6 Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents: 682
diff changeset
899 <para id="x_6a">What happens if we try to pull or push changes
652
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
900 and the receiving repository already has those changes?
657
8631da51309b Slow progress on XML conversion
Bryan O'Sullivan <bos@serpentine.com>
parents: 652
diff changeset
901 Nothing too exciting.</para>
8631da51309b Slow progress on XML conversion
Bryan O'Sullivan <bos@serpentine.com>
parents: 652
diff changeset
902
665
27043f385f3f Get autogeneration of examples more or less working.
Bryan O'Sullivan <bos@serpentine.com>
parents: 658
diff changeset
903 &interaction.tour.push.nothing;
652
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
904 </sect2>
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
905 <sect2>
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
906 <title>Sharing changes over a network</title>
92
72d207927dc4 Tour: push.
Bryan O'Sullivan <bos@serpentine.com>
parents: 91
diff changeset
907
683
c838b3975bc6 Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents: 682
diff changeset
908 <para id="x_6b">The commands we have covered in the previous few
652
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
909 sections are not limited to working with local repositories.
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
910 Each works in exactly the same fashion over a network
657
8631da51309b Slow progress on XML conversion
Bryan O'Sullivan <bos@serpentine.com>
parents: 652
diff changeset
911 connection; simply pass in a URL instead of a local
8631da51309b Slow progress on XML conversion
Bryan O'Sullivan <bos@serpentine.com>
parents: 652
diff changeset
912 path.</para>
8631da51309b Slow progress on XML conversion
Bryan O'Sullivan <bos@serpentine.com>
parents: 652
diff changeset
913
665
27043f385f3f Get autogeneration of examples more or less working.
Bryan O'Sullivan <bos@serpentine.com>
parents: 658
diff changeset
914 &interaction.tour.outgoing.net;
657
8631da51309b Slow progress on XML conversion
Bryan O'Sullivan <bos@serpentine.com>
parents: 652
diff changeset
915
683
c838b3975bc6 Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents: 682
diff changeset
916 <para id="x_6c">In this example, we
652
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
917 can see what changes we could push to the remote repository,
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
918 but the repository is understandably not set up to let
657
8631da51309b Slow progress on XML conversion
Bryan O'Sullivan <bos@serpentine.com>
parents: 652
diff changeset
919 anonymous users push to it.</para>
8631da51309b Slow progress on XML conversion
Bryan O'Sullivan <bos@serpentine.com>
parents: 652
diff changeset
920
665
27043f385f3f Get autogeneration of examples more or less working.
Bryan O'Sullivan <bos@serpentine.com>
parents: 658
diff changeset
921 &interaction.tour.push.net;
652
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
922 </sect2>
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
923 </sect1>
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
924 </chapter>
93
97638d862ef3 Network bits.
Bryan O'Sullivan <bos@serpentine.com>
parents: 92
diff changeset
925
652
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
926 <!--
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
927 local variables:
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
928 sgml-parent-document: ("00book.xml" "book" "chapter")
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
929 end:
863a82f13901 Basic progress on XML.
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
930 -->