comparison en/ch00-preface.xml @ 683:c838b3975bc6

Add IDs to paragraphs.
author Bryan O'Sullivan <bos@serpentine.com>
date Thu, 19 Mar 2009 21:18:52 -0700
parents 28b5a5befb08
children 34cb220eb717
comparison
equal deleted inserted replaced
682:28b5a5befb08 683:c838b3975bc6
4 <title>Preface</title> 4 <title>Preface</title>
5 5
6 <sect1> 6 <sect1>
7 <title>Why revision control? Why Mercurial?</title> 7 <title>Why revision control? Why Mercurial?</title>
8 8
9 <para>Revision control is the process of managing multiple 9 <para id="x_6d">Revision control is the process of managing multiple
10 versions of a piece of information. In its simplest form, this 10 versions of a piece of information. In its simplest form, this
11 is something that many people do by hand: every time you modify 11 is something that many people do by hand: every time you modify
12 a file, save it under a new name that contains a number, each 12 a file, save it under a new name that contains a number, each
13 one higher than the number of the preceding version.</para> 13 one higher than the number of the preceding version.</para>
14 14
15 <para>Manually managing multiple versions of even a single file is 15 <para id="x_6e">Manually managing multiple versions of even a single file is
16 an error-prone task, though, so software tools to help automate 16 an error-prone task, though, so software tools to help automate
17 this process have long been available. The earliest automated 17 this process have long been available. The earliest automated
18 revision control tools were intended to help a single user to 18 revision control tools were intended to help a single user to
19 manage revisions of a single file. Over the past few decades, 19 manage revisions of a single file. Over the past few decades,
20 the scope of revision control tools has expanded greatly; they 20 the scope of revision control tools has expanded greatly; they
21 now manage multiple files, and help multiple people to work 21 now manage multiple files, and help multiple people to work
22 together. The best modern revision control tools have no 22 together. The best modern revision control tools have no
23 problem coping with thousands of people working together on 23 problem coping with thousands of people working together on
24 projects that consist of hundreds of thousands of files.</para> 24 projects that consist of hundreds of thousands of files.</para>
25 25
26 <para>The arrival of distributed revision control is relatively 26 <para id="x_6f">The arrival of distributed revision control is relatively
27 recent, and so far this new field has grown due to people's 27 recent, and so far this new field has grown due to people's
28 willingness to explore ill-charted territory.</para> 28 willingness to explore ill-charted territory.</para>
29 29
30 <para>I am writing a book about distributed revision control 30 <para id="x_70">I am writing a book about distributed revision control
31 because I believe that it is an important subject that deserves 31 because I believe that it is an important subject that deserves
32 a field guide. I chose to write about Mercurial because it is 32 a field guide. I chose to write about Mercurial because it is
33 the easiest tool to learn the terrain with, and yet it scales to 33 the easiest tool to learn the terrain with, and yet it scales to
34 the demands of real, challenging environments where many other 34 the demands of real, challenging environments where many other
35 revision control tools buckle.</para> 35 revision control tools buckle.</para>
36 36
37 <sect2> 37 <sect2>
38 <title>Why use revision control?</title> 38 <title>Why use revision control?</title>
39 39
40 <para>There are a number of reasons why you or your team might 40 <para id="x_71">There are a number of reasons why you or your team might
41 want to use an automated revision control tool for a 41 want to use an automated revision control tool for a
42 project.</para> 42 project.</para>
43 43
44 <itemizedlist> 44 <itemizedlist>
45 <listitem><para>It will track the history and evolution of 45 <listitem><para id="x_72">It will track the history and evolution of
46 your project, so you don't have to. For every change, 46 your project, so you don't have to. For every change,
47 you'll have a log of <emphasis>who</emphasis> made it; 47 you'll have a log of <emphasis>who</emphasis> made it;
48 <emphasis>why</emphasis> they made it; 48 <emphasis>why</emphasis> they made it;
49 <emphasis>when</emphasis> they made it; and 49 <emphasis>when</emphasis> they made it; and
50 <emphasis>what</emphasis> the change 50 <emphasis>what</emphasis> the change
51 was.</para></listitem> 51 was.</para></listitem>
52 <listitem><para>When you're working with other people, 52 <listitem><para id="x_73">When you're working with other people,
53 revision control software makes it easier for you to 53 revision control software makes it easier for you to
54 collaborate. For example, when people more or less 54 collaborate. For example, when people more or less
55 simultaneously make potentially incompatible changes, the 55 simultaneously make potentially incompatible changes, the
56 software will help you to identify and resolve those 56 software will help you to identify and resolve those
57 conflicts.</para></listitem> 57 conflicts.</para></listitem>
58 <listitem><para>It can help you to recover from mistakes. If 58 <listitem><para id="x_74">It can help you to recover from mistakes. If
59 you make a change that later turns out to be in error, you 59 you make a change that later turns out to be in error, you
60 can revert to an earlier version of one or more files. In 60 can revert to an earlier version of one or more files. In
61 fact, a <emphasis>really</emphasis> good revision control 61 fact, a <emphasis>really</emphasis> good revision control
62 tool will even help you to efficiently figure out exactly 62 tool will even help you to efficiently figure out exactly
63 when a problem was introduced (see section <xref 63 when a problem was introduced (see section <xref
64 linkend="sec:undo:bisect"/> for details).</para></listitem> 64 linkend="sec:undo:bisect"/> for details).</para></listitem>
65 <listitem><para>It will help you to work simultaneously on, 65 <listitem><para id="x_75">It will help you to work simultaneously on,
66 and manage the drift between, multiple versions of your 66 and manage the drift between, multiple versions of your
67 project.</para></listitem> 67 project.</para></listitem>
68 </itemizedlist> 68 </itemizedlist>
69 69
70 <para>Most of these reasons are equally valid---at least in 70 <para id="x_76">Most of these reasons are equally valid---at least in
71 theory---whether you're working on a project by yourself, or 71 theory---whether you're working on a project by yourself, or
72 with a hundred other people.</para> 72 with a hundred other people.</para>
73 73
74 <para>A key question about the practicality of revision control 74 <para id="x_77">A key question about the practicality of revision control
75 at these two different scales (<quote>lone hacker</quote> and 75 at these two different scales (<quote>lone hacker</quote> and
76 <quote>huge team</quote>) is how its 76 <quote>huge team</quote>) is how its
77 <emphasis>benefits</emphasis> compare to its 77 <emphasis>benefits</emphasis> compare to its
78 <emphasis>costs</emphasis>. A revision control tool that's 78 <emphasis>costs</emphasis>. A revision control tool that's
79 difficult to understand or use is going to impose a high 79 difficult to understand or use is going to impose a high
80 cost.</para> 80 cost.</para>
81 81
82 <para>A five-hundred-person project is likely to collapse under 82 <para id="x_78">A five-hundred-person project is likely to collapse under
83 its own weight almost immediately without a revision control 83 its own weight almost immediately without a revision control
84 tool and process. In this case, the cost of using revision 84 tool and process. In this case, the cost of using revision
85 control might hardly seem worth considering, since 85 control might hardly seem worth considering, since
86 <emphasis>without</emphasis> it, failure is almost 86 <emphasis>without</emphasis> it, failure is almost
87 guaranteed.</para> 87 guaranteed.</para>
88 88
89 <para>On the other hand, a one-person <quote>quick hack</quote> 89 <para id="x_79">On the other hand, a one-person <quote>quick hack</quote>
90 might seem like a poor place to use a revision control tool, 90 might seem like a poor place to use a revision control tool,
91 because surely the cost of using one must be close to the 91 because surely the cost of using one must be close to the
92 overall cost of the project. Right?</para> 92 overall cost of the project. Right?</para>
93 93
94 <para>Mercurial uniquely supports <emphasis>both</emphasis> of 94 <para id="x_7a">Mercurial uniquely supports <emphasis>both</emphasis> of
95 these scales of development. You can learn the basics in just 95 these scales of development. You can learn the basics in just
96 a few minutes, and due to its low overhead, you can apply 96 a few minutes, and due to its low overhead, you can apply
97 revision control to the smallest of projects with ease. Its 97 revision control to the smallest of projects with ease. Its
98 simplicity means you won't have a lot of abstruse concepts or 98 simplicity means you won't have a lot of abstruse concepts or
99 command sequences competing for mental space with whatever 99 command sequences competing for mental space with whatever
100 you're <emphasis>really</emphasis> trying to do. At the same 100 you're <emphasis>really</emphasis> trying to do. At the same
101 time, Mercurial's high performance and peer-to-peer nature let 101 time, Mercurial's high performance and peer-to-peer nature let
102 you scale painlessly to handle large projects.</para> 102 you scale painlessly to handle large projects.</para>
103 103
104 <para>No revision control tool can rescue a poorly run project, 104 <para id="x_7b">No revision control tool can rescue a poorly run project,
105 but a good choice of tools can make a huge difference to the 105 but a good choice of tools can make a huge difference to the
106 fluidity with which you can work on a project.</para> 106 fluidity with which you can work on a project.</para>
107 107
108 </sect2> 108 </sect2>
109 109
110 <sect2> 110 <sect2>
111 <title>The many names of revision control</title> 111 <title>The many names of revision control</title>
112 112
113 <para>Revision control is a diverse field, so much so that it is 113 <para id="x_7c">Revision control is a diverse field, so much so that it is
114 referred to by many names and acronyms. Here are a few of the 114 referred to by many names and acronyms. Here are a few of the
115 more common variations you'll encounter:</para> 115 more common variations you'll encounter:</para>
116 <itemizedlist> 116 <itemizedlist>
117 <listitem><para>Revision control (RCS)</para></listitem> 117 <listitem><para id="x_7d">Revision control (RCS)</para></listitem>
118 <listitem><para>Software configuration management (SCM), or 118 <listitem><para id="x_7e">Software configuration management (SCM), or
119 configuration management</para></listitem> 119 configuration management</para></listitem>
120 <listitem><para>Source code management</para></listitem> 120 <listitem><para id="x_7f">Source code management</para></listitem>
121 <listitem><para>Source code control, or source 121 <listitem><para id="x_80">Source code control, or source
122 control</para></listitem> 122 control</para></listitem>
123 <listitem><para>Version control 123 <listitem><para id="x_81">Version control
124 (VCS)</para></listitem></itemizedlist> 124 (VCS)</para></listitem></itemizedlist>
125 <para>Some people claim that these terms actually have different 125 <para id="x_82">Some people claim that these terms actually have different
126 meanings, but in practice they overlap so much that there's no 126 meanings, but in practice they overlap so much that there's no
127 agreed or even useful way to tease them apart.</para> 127 agreed or even useful way to tease them apart.</para>
128 128
129 </sect2> 129 </sect2>
130 </sect1> 130 </sect1>
131 131
132 <sect1> 132 <sect1>
133 <title>This book is a work in progress</title> 133 <title>This book is a work in progress</title>
134 134
135 <para>I am releasing this book while I am still writing it, in the 135 <para id="x_83">I am releasing this book while I am still writing it, in the
136 hope that it will prove useful to others. I am writing under an 136 hope that it will prove useful to others. I am writing under an
137 open license in the hope that you, my readers, will contribute 137 open license in the hope that you, my readers, will contribute
138 feedback and perhaps content of your own.</para> 138 feedback and perhaps content of your own.</para>
139 139
140 </sect1> 140 </sect1>
141 <sect1> 141 <sect1>
142 <title>About the examples in this book</title> 142 <title>About the examples in this book</title>
143 143
144 <para>This book takes an unusual approach to code samples. Every 144 <para id="x_84">This book takes an unusual approach to code samples. Every
145 example is <quote>live</quote>---each one is actually the result 145 example is <quote>live</quote>---each one is actually the result
146 of a shell script that executes the Mercurial commands you see. 146 of a shell script that executes the Mercurial commands you see.
147 Every time an image of the book is built from its sources, all 147 Every time an image of the book is built from its sources, all
148 the example scripts are automatically run, and their current 148 the example scripts are automatically run, and their current
149 results compared against their expected results.</para> 149 results compared against their expected results.</para>
150 150
151 <para>The advantage of this approach is that the examples are 151 <para id="x_85">The advantage of this approach is that the examples are
152 always accurate; they describe <emphasis>exactly</emphasis> the 152 always accurate; they describe <emphasis>exactly</emphasis> the
153 behaviour of the version of Mercurial that's mentioned at the 153 behaviour of the version of Mercurial that's mentioned at the
154 front of the book. If I update the version of Mercurial that 154 front of the book. If I update the version of Mercurial that
155 I'm documenting, and the output of some command changes, the 155 I'm documenting, and the output of some command changes, the
156 build fails.</para> 156 build fails.</para>
157 157
158 <para>There is a small disadvantage to this approach, which is 158 <para id="x_86">There is a small disadvantage to this approach, which is
159 that the dates and times you'll see in examples tend to be 159 that the dates and times you'll see in examples tend to be
160 <quote>squashed</quote> together in a way that they wouldn't be 160 <quote>squashed</quote> together in a way that they wouldn't be
161 if the same commands were being typed by a human. Where a human 161 if the same commands were being typed by a human. Where a human
162 can issue no more than one command every few seconds, with any 162 can issue no more than one command every few seconds, with any
163 resulting timestamps correspondingly spread out, my automated 163 resulting timestamps correspondingly spread out, my automated
164 example scripts run many commands in one second.</para> 164 example scripts run many commands in one second.</para>
165 165
166 <para>As an instance of this, several consecutive commits in an 166 <para id="x_87">As an instance of this, several consecutive commits in an
167 example can show up as having occurred during the same second. 167 example can show up as having occurred during the same second.
168 You can see this occur in the <literal 168 You can see this occur in the <literal
169 role="hg-ext">bisect</literal> example in section <xref 169 role="hg-ext">bisect</literal> example in section <xref
170 id="sec:undo:bisect"/>, for instance.</para> 170 id="sec:undo:bisect"/>, for instance.</para>
171 171
172 <para>So when you're reading examples, don't place too much weight 172 <para id="x_88">So when you're reading examples, don't place too much weight
173 on the dates or times you see in the output of commands. But 173 on the dates or times you see in the output of commands. But
174 <emphasis>do</emphasis> be confident that the behaviour you're 174 <emphasis>do</emphasis> be confident that the behaviour you're
175 seeing is consistent and reproducible.</para> 175 seeing is consistent and reproducible.</para>
176 176
177 </sect1> 177 </sect1>
178 178
179 <sect1> 179 <sect1>
180 <title>Trends in the field</title> 180 <title>Trends in the field</title>
181 181
182 <para>There has been an unmistakable trend in the development and 182 <para id="x_89">There has been an unmistakable trend in the development and
183 use of revision control tools over the past four decades, as 183 use of revision control tools over the past four decades, as
184 people have become familiar with the capabilities of their tools 184 people have become familiar with the capabilities of their tools
185 and constrained by their limitations.</para> 185 and constrained by their limitations.</para>
186 186
187 <para>The first generation began by managing single files on 187 <para id="x_8a">The first generation began by managing single files on
188 individual computers. Although these tools represented a huge 188 individual computers. Although these tools represented a huge
189 advance over ad-hoc manual revision control, their locking model 189 advance over ad-hoc manual revision control, their locking model
190 and reliance on a single computer limited them to small, 190 and reliance on a single computer limited them to small,
191 tightly-knit teams.</para> 191 tightly-knit teams.</para>
192 192
193 <para>The second generation loosened these constraints by moving 193 <para id="x_8b">The second generation loosened these constraints by moving
194 to network-centered architectures, and managing entire projects 194 to network-centered architectures, and managing entire projects
195 at a time. As projects grew larger, they ran into new problems. 195 at a time. As projects grew larger, they ran into new problems.
196 With clients needing to talk to servers very frequently, server 196 With clients needing to talk to servers very frequently, server
197 scaling became an issue for large projects. An unreliable 197 scaling became an issue for large projects. An unreliable
198 network connection could prevent remote users from being able to 198 network connection could prevent remote users from being able to
200 making read-only access available anonymously to anyone, people 200 making read-only access available anonymously to anyone, people
201 without commit privileges found that they could not use the 201 without commit privileges found that they could not use the
202 tools to interact with a project in a natural way, as they could 202 tools to interact with a project in a natural way, as they could
203 not record their changes.</para> 203 not record their changes.</para>
204 204
205 <para>The current generation of revision control tools is 205 <para id="x_8c">The current generation of revision control tools is
206 peer-to-peer in nature. All of these systems have dropped the 206 peer-to-peer in nature. All of these systems have dropped the
207 dependency on a single central server, and allow people to 207 dependency on a single central server, and allow people to
208 distribute their revision control data to where it's actually 208 distribute their revision control data to where it's actually
209 needed. Collaboration over the Internet has moved from 209 needed. Collaboration over the Internet has moved from
210 constrained by technology to a matter of choice and consensus. 210 constrained by technology to a matter of choice and consensus.
215 </sect1> 215 </sect1>
216 <sect1> 216 <sect1>
217 <title>A few of the advantages of distributed revision 217 <title>A few of the advantages of distributed revision
218 control</title> 218 control</title>
219 219
220 <para>Even though distributed revision control tools have for 220 <para id="x_8d">Even though distributed revision control tools have for
221 several years been as robust and usable as their 221 several years been as robust and usable as their
222 previous-generation counterparts, people using older tools have 222 previous-generation counterparts, people using older tools have
223 not yet necessarily woken up to their advantages. There are a 223 not yet necessarily woken up to their advantages. There are a
224 number of ways in which distributed tools shine relative to 224 number of ways in which distributed tools shine relative to
225 centralised ones.</para> 225 centralised ones.</para>
226 226
227 <para>For an individual developer, distributed tools are almost 227 <para id="x_8e">For an individual developer, distributed tools are almost
228 always much faster than centralised tools. This is for a simple 228 always much faster than centralised tools. This is for a simple
229 reason: a centralised tool needs to talk over the network for 229 reason: a centralised tool needs to talk over the network for
230 many common operations, because most metadata is stored in a 230 many common operations, because most metadata is stored in a
231 single copy on the central server. A distributed tool stores 231 single copy on the central server. A distributed tool stores
232 all of its metadata locally. All else being equal, talking over 232 all of its metadata locally. All else being equal, talking over
233 the network adds overhead to a centralised tool. Don't 233 the network adds overhead to a centralised tool. Don't
234 underestimate the value of a snappy, responsive tool: you're 234 underestimate the value of a snappy, responsive tool: you're
235 going to spend a lot of time interacting with your revision 235 going to spend a lot of time interacting with your revision
236 control software.</para> 236 control software.</para>
237 237
238 <para>Distributed tools are indifferent to the vagaries of your 238 <para id="x_8f">Distributed tools are indifferent to the vagaries of your
239 server infrastructure, again because they replicate metadata to 239 server infrastructure, again because they replicate metadata to
240 so many locations. If you use a centralised system and your 240 so many locations. If you use a centralised system and your
241 server catches fire, you'd better hope that your backup media 241 server catches fire, you'd better hope that your backup media
242 are reliable, and that your last backup was recent and actually 242 are reliable, and that your last backup was recent and actually
243 worked. With a distributed tool, you have many backups 243 worked. With a distributed tool, you have many backups
244 available on every contributor's computer.</para> 244 available on every contributor's computer.</para>
245 245
246 <para>The reliability of your network will affect distributed 246 <para id="x_90">The reliability of your network will affect distributed
247 tools far less than it will centralised tools. You can't even 247 tools far less than it will centralised tools. You can't even
248 use a centralised tool without a network connection, except for 248 use a centralised tool without a network connection, except for
249 a few highly constrained commands. With a distributed tool, if 249 a few highly constrained commands. With a distributed tool, if
250 your network connection goes down while you're working, you may 250 your network connection goes down while you're working, you may
251 not even notice. The only thing you won't be able to do is talk 251 not even notice. The only thing you won't be able to do is talk
254 team of collaborators, this may be significant.</para> 254 team of collaborators, this may be significant.</para>
255 255
256 <sect2> 256 <sect2>
257 <title>Advantages for open source projects</title> 257 <title>Advantages for open source projects</title>
258 258
259 <para>If you take a shine to an open source project and decide 259 <para id="x_91">If you take a shine to an open source project and decide
260 that you would like to start hacking on it, and that project 260 that you would like to start hacking on it, and that project
261 uses a distributed revision control tool, you are at once a 261 uses a distributed revision control tool, you are at once a
262 peer with the people who consider themselves the 262 peer with the people who consider themselves the
263 <quote>core</quote> of that project. If they publish their 263 <quote>core</quote> of that project. If they publish their
264 repositories, you can immediately copy their project history, 264 repositories, you can immediately copy their project history,
272 client's view of the repository.</para> 272 client's view of the repository.</para>
273 273
274 <sect3> 274 <sect3>
275 <title>The forking non-problem</title> 275 <title>The forking non-problem</title>
276 276
277 <para>It has been suggested that distributed revision control 277 <para id="x_92">It has been suggested that distributed revision control
278 tools pose some sort of risk to open source projects because 278 tools pose some sort of risk to open source projects because
279 they make it easy to <quote>fork</quote> the development of 279 they make it easy to <quote>fork</quote> the development of
280 a project. A fork happens when there are differences in 280 a project. A fork happens when there are differences in
281 opinion or attitude between groups of developers that cause 281 opinion or attitude between groups of developers that cause
282 them to decide that they can't work together any longer. 282 them to decide that they can't work together any longer.
283 Each side takes a more or less complete copy of the 283 Each side takes a more or less complete copy of the
284 project's source code, and goes off in its own 284 project's source code, and goes off in its own
285 direction.</para> 285 direction.</para>
286 286
287 <para>Sometimes the camps in a fork decide to reconcile their 287 <para id="x_93">Sometimes the camps in a fork decide to reconcile their
288 differences. With a centralised revision control system, the 288 differences. With a centralised revision control system, the
289 <emphasis>technical</emphasis> process of reconciliation is 289 <emphasis>technical</emphasis> process of reconciliation is
290 painful, and has to be performed largely by hand. You have 290 painful, and has to be performed largely by hand. You have
291 to decide whose revision history is going to 291 to decide whose revision history is going to
292 <quote>win</quote>, and graft the other team's changes into 292 <quote>win</quote>, and graft the other team's changes into
293 the tree somehow. This usually loses some or all of one 293 the tree somehow. This usually loses some or all of one
294 side's revision history.</para> 294 side's revision history.</para>
295 295
296 <para>What distributed tools do with respect to forking is 296 <para id="x_94">What distributed tools do with respect to forking is
297 they make forking the <emphasis>only</emphasis> way to 297 they make forking the <emphasis>only</emphasis> way to
298 develop a project. Every single change that you make is 298 develop a project. Every single change that you make is
299 potentially a fork point. The great strength of this 299 potentially a fork point. The great strength of this
300 approach is that a distributed revision control tool has to 300 approach is that a distributed revision control tool has to
301 be really good at <emphasis>merging</emphasis> forks, 301 be really good at <emphasis>merging</emphasis> forks,
302 because forks are absolutely fundamental: they happen all 302 because forks are absolutely fundamental: they happen all
303 the time.</para> 303 the time.</para>
304 304
305 <para>If every piece of work that everybody does, all the 305 <para id="x_95">If every piece of work that everybody does, all the
306 time, is framed in terms of forking and merging, then what 306 time, is framed in terms of forking and merging, then what
307 the open source world refers to as a <quote>fork</quote> 307 the open source world refers to as a <quote>fork</quote>
308 becomes <emphasis>purely</emphasis> a social issue. If 308 becomes <emphasis>purely</emphasis> a social issue. If
309 anything, distributed tools <emphasis>lower</emphasis> the 309 anything, distributed tools <emphasis>lower</emphasis> the
310 likelihood of a fork:</para> 310 likelihood of a fork:</para>
311 <itemizedlist> 311 <itemizedlist>
312 <listitem><para>They eliminate the social distinction that 312 <listitem><para id="x_96">They eliminate the social distinction that
313 centralised tools impose: that between insiders (people 313 centralised tools impose: that between insiders (people
314 with commit access) and outsiders (people 314 with commit access) and outsiders (people
315 without).</para></listitem> 315 without).</para></listitem>
316 <listitem><para>They make it easier to reconcile after a 316 <listitem><para id="x_97">They make it easier to reconcile after a
317 social fork, because all that's involved from the 317 social fork, because all that's involved from the
318 perspective of the revision control software is just 318 perspective of the revision control software is just
319 another merge.</para></listitem></itemizedlist> 319 another merge.</para></listitem></itemizedlist>
320 320
321 <para>Some people resist distributed tools because they want 321 <para id="x_98">Some people resist distributed tools because they want
322 to retain tight control over their projects, and they 322 to retain tight control over their projects, and they
323 believe that centralised tools give them this control. 323 believe that centralised tools give them this control.
324 However, if you're of this belief, and you publish your CVS 324 However, if you're of this belief, and you publish your CVS
325 or Subversion repositories publicly, there are plenty of 325 or Subversion repositories publicly, there are plenty of
326 tools available that can pull out your entire project's 326 tools available that can pull out your entire project's
333 </sect3> 333 </sect3>
334 </sect2> 334 </sect2>
335 <sect2> 335 <sect2>
336 <title>Advantages for commercial projects</title> 336 <title>Advantages for commercial projects</title>
337 337
338 <para>Many commercial projects are undertaken by teams that are 338 <para id="x_99">Many commercial projects are undertaken by teams that are
339 scattered across the globe. Contributors who are far from a 339 scattered across the globe. Contributors who are far from a
340 central server will see slower command execution and perhaps 340 central server will see slower command execution and perhaps
341 less reliability. Commercial revision control systems attempt 341 less reliability. Commercial revision control systems attempt
342 to ameliorate these problems with remote-site replication 342 to ameliorate these problems with remote-site replication
343 add-ons that are typically expensive to buy and cantankerous 343 add-ons that are typically expensive to buy and cantankerous
345 problems in the first place. Better yet, you can easily set 345 problems in the first place. Better yet, you can easily set
346 up multiple authoritative servers, say one per site, so that 346 up multiple authoritative servers, say one per site, so that
347 there's no redundant communication between repositories over 347 there's no redundant communication between repositories over
348 expensive long-haul network links.</para> 348 expensive long-haul network links.</para>
349 349
350 <para>Centralised revision control systems tend to have 350 <para id="x_9a">Centralised revision control systems tend to have
351 relatively low scalability. It's not unusual for an expensive 351 relatively low scalability. It's not unusual for an expensive
352 centralised system to fall over under the combined load of 352 centralised system to fall over under the combined load of
353 just a few dozen concurrent users. Once again, the typical 353 just a few dozen concurrent users. Once again, the typical
354 response tends to be an expensive and clunky replication 354 response tends to be an expensive and clunky replication
355 facility. Since the load on a central server---if you have 355 facility. Since the load on a central server---if you have
357 (because all of the data is replicated everywhere), a single 357 (because all of the data is replicated everywhere), a single
358 cheap server can handle the needs of a much larger team, and 358 cheap server can handle the needs of a much larger team, and
359 replication to balance load becomes a simple matter of 359 replication to balance load becomes a simple matter of
360 scripting.</para> 360 scripting.</para>
361 361
362 <para>If you have an employee in the field, troubleshooting a 362 <para id="x_9b">If you have an employee in the field, troubleshooting a
363 problem at a customer's site, they'll benefit from distributed 363 problem at a customer's site, they'll benefit from distributed
364 revision control. The tool will let them generate custom 364 revision control. The tool will let them generate custom
365 builds, try different fixes in isolation from each other, and 365 builds, try different fixes in isolation from each other, and
366 search efficiently through history for the sources of bugs and 366 search efficiently through history for the sources of bugs and
367 regressions in the customer's environment, all without needing 367 regressions in the customer's environment, all without needing
370 </sect2> 370 </sect2>
371 </sect1> 371 </sect1>
372 <sect1> 372 <sect1>
373 <title>Why choose Mercurial?</title> 373 <title>Why choose Mercurial?</title>
374 374
375 <para>Mercurial has a unique set of properties that make it a 375 <para id="x_9c">Mercurial has a unique set of properties that make it a
376 particularly good choice as a revision control system.</para> 376 particularly good choice as a revision control system.</para>
377 <itemizedlist> 377 <itemizedlist>
378 <listitem><para>It is easy to learn and use.</para></listitem> 378 <listitem><para id="x_9d">It is easy to learn and use.</para></listitem>
379 <listitem><para>It is lightweight.</para></listitem> 379 <listitem><para id="x_9e">It is lightweight.</para></listitem>
380 <listitem><para>It scales excellently.</para></listitem> 380 <listitem><para id="x_9f">It scales excellently.</para></listitem>
381 <listitem><para>It is easy to 381 <listitem><para id="x_a0">It is easy to
382 customise.</para></listitem></itemizedlist> 382 customise.</para></listitem></itemizedlist>
383 383
384 <para>If you are at all familiar with revision control systems, 384 <para id="x_a1">If you are at all familiar with revision control systems,
385 you should be able to get up and running with Mercurial in less 385 you should be able to get up and running with Mercurial in less
386 than five minutes. Even if not, it will take no more than a few 386 than five minutes. Even if not, it will take no more than a few
387 minutes longer. Mercurial's command and feature sets are 387 minutes longer. Mercurial's command and feature sets are
388 generally uniform and consistent, so you can keep track of a few 388 generally uniform and consistent, so you can keep track of a few
389 general rules instead of a host of exceptions.</para> 389 general rules instead of a host of exceptions.</para>
390 390
391 <para>On a small project, you can start working with Mercurial in 391 <para id="x_a2">On a small project, you can start working with Mercurial in
392 moments. Creating new changes and branches; transferring changes 392 moments. Creating new changes and branches; transferring changes
393 around (whether locally or over a network); and history and 393 around (whether locally or over a network); and history and
394 status operations are all fast. Mercurial attempts to stay 394 status operations are all fast. Mercurial attempts to stay
395 nimble and largely out of your way by combining low cognitive 395 nimble and largely out of your way by combining low cognitive
396 overhead with blazingly fast operations.</para> 396 overhead with blazingly fast operations.</para>
397 397
398 <para>The usefulness of Mercurial is not limited to small 398 <para id="x_a3">The usefulness of Mercurial is not limited to small
399 projects: it is used by projects with hundreds to thousands of 399 projects: it is used by projects with hundreds to thousands of
400 contributors, each containing tens of thousands of files and 400 contributors, each containing tens of thousands of files and
401 hundreds of megabytes of source code.</para> 401 hundreds of megabytes of source code.</para>
402 402
403 <para>If the core functionality of Mercurial is not enough for 403 <para id="x_a4">If the core functionality of Mercurial is not enough for
404 you, it's easy to build on. Mercurial is well suited to 404 you, it's easy to build on. Mercurial is well suited to
405 scripting tasks, and its clean internals and implementation in 405 scripting tasks, and its clean internals and implementation in
406 Python make it easy to add features in the form of extensions. 406 Python make it easy to add features in the form of extensions.
407 There are a number of popular and useful extensions already 407 There are a number of popular and useful extensions already
408 available, ranging from helping to identify bugs to improving 408 available, ranging from helping to identify bugs to improving
410 410
411 </sect1> 411 </sect1>
412 <sect1> 412 <sect1>
413 <title>Mercurial compared with other tools</title> 413 <title>Mercurial compared with other tools</title>
414 414
415 <para>Before you read on, please understand that this section 415 <para id="x_a5">Before you read on, please understand that this section
416 necessarily reflects my own experiences, interests, and (dare I 416 necessarily reflects my own experiences, interests, and (dare I
417 say it) biases. I have used every one of the revision control 417 say it) biases. I have used every one of the revision control
418 tools listed below, in most cases for several years at a 418 tools listed below, in most cases for several years at a
419 time.</para> 419 time.</para>
420 420
421 421
422 <sect2> 422 <sect2>
423 <title>Subversion</title> 423 <title>Subversion</title>
424 424
425 <para>Subversion is a popular revision control tool, developed 425 <para id="x_a6">Subversion is a popular revision control tool, developed
426 to replace CVS. It has a centralised client/server 426 to replace CVS. It has a centralised client/server
427 architecture.</para> 427 architecture.</para>
428 428
429 <para>Subversion and Mercurial have similarly named commands for 429 <para id="x_a7">Subversion and Mercurial have similarly named commands for
430 performing the same operations, so if you're familiar with 430 performing the same operations, so if you're familiar with
431 one, it is easy to learn to use the other. Both tools are 431 one, it is easy to learn to use the other. Both tools are
432 portable to all popular operating systems.</para> 432 portable to all popular operating systems.</para>
433 433
434 <para>Prior to version 1.5, Subversion had no useful support for 434 <para id="x_a8">Prior to version 1.5, Subversion had no useful support for
435 merges. At the time of writing, its merge tracking capability 435 merges. At the time of writing, its merge tracking capability
436 is new, and known to be <ulink 436 is new, and known to be <ulink
437 url="http://svnbook.red-bean.com/nightly/en/svn.branchmerge.advanced.html#svn.branchmerge.advanced.finalword">complicated 437 url="http://svnbook.red-bean.com/nightly/en/svn.branchmerge.advanced.html#svn.branchmerge.advanced.finalword">complicated
438 and buggy</ulink>.</para> 438 and buggy</ulink>.</para>
439 439
440 <para>Mercurial has a substantial performance advantage over 440 <para id="x_a9">Mercurial has a substantial performance advantage over
441 Subversion on every revision control operation I have 441 Subversion on every revision control operation I have
442 benchmarked. I have measured its advantage as ranging from a 442 benchmarked. I have measured its advantage as ranging from a
443 factor of two to a factor of six when compared with Subversion 443 factor of two to a factor of six when compared with Subversion
444 1.4.3's <emphasis>ra_local</emphasis> file store, which is the 444 1.4.3's <emphasis>ra_local</emphasis> file store, which is the
445 fastest access method available. In more realistic 445 fastest access method available. In more realistic
448 Subversion commands must talk to the server and Subversion 448 Subversion commands must talk to the server and Subversion
449 does not have useful replication facilities, server capacity 449 does not have useful replication facilities, server capacity
450 and network bandwidth become bottlenecks for modestly large 450 and network bandwidth become bottlenecks for modestly large
451 projects.</para> 451 projects.</para>
452 452
453 <para>Additionally, Subversion incurs substantial storage 453 <para id="x_aa">Additionally, Subversion incurs substantial storage
454 overhead to avoid network transactions for a few common 454 overhead to avoid network transactions for a few common
455 operations, such as finding modified files 455 operations, such as finding modified files
456 (<literal>status</literal>) and displaying modifications 456 (<literal>status</literal>) and displaying modifications
457 against the current revision (<literal>diff</literal>). As a 457 against the current revision (<literal>diff</literal>). As a
458 result, a Subversion working copy is often the same size as, 458 result, a Subversion working copy is often the same size as,
459 or larger than, a Mercurial repository and working directory, 459 or larger than, a Mercurial repository and working directory,
460 even though the Mercurial repository contains a complete 460 even though the Mercurial repository contains a complete
461 history of the project.</para> 461 history of the project.</para>
462 462
463 <para>Subversion is widely supported by third party tools. 463 <para id="x_ab">Subversion is widely supported by third party tools.
464 Mercurial currently lags considerably in this area. This gap 464 Mercurial currently lags considerably in this area. This gap
465 is closing, however, and indeed some of Mercurial's GUI tools 465 is closing, however, and indeed some of Mercurial's GUI tools
466 now outshine their Subversion equivalents. Like Mercurial, 466 now outshine their Subversion equivalents. Like Mercurial,
467 Subversion has an excellent user manual.</para> 467 Subversion has an excellent user manual.</para>
468 468
469 <para>Because Subversion doesn't store revision history on the 469 <para id="x_ac">Because Subversion doesn't store revision history on the
470 client, it is well suited to managing projects that deal with 470 client, it is well suited to managing projects that deal with
471 lots of large, opaque binary files. If you check in fifty 471 lots of large, opaque binary files. If you check in fifty
472 revisions to an incompressible 10MB file, Subversion's 472 revisions to an incompressible 10MB file, Subversion's
473 client-side space usage stays constant The space used by any 473 client-side space usage stays constant The space used by any
474 distributed SCM will grow rapidly in proportion to the number 474 distributed SCM will grow rapidly in proportion to the number
475 of revisions, because the differences between each revision 475 of revisions, because the differences between each revision
476 are large.</para> 476 are large.</para>
477 477
478 <para>In addition, it's often difficult or, more usually, 478 <para id="x_ad">In addition, it's often difficult or, more usually,
479 impossible to merge different versions of a binary file. 479 impossible to merge different versions of a binary file.
480 Subversion's ability to let a user lock a file, so that they 480 Subversion's ability to let a user lock a file, so that they
481 temporarily have the exclusive right to commit changes to it, 481 temporarily have the exclusive right to commit changes to it,
482 can be a significant advantage to a project where binary files 482 can be a significant advantage to a project where binary files
483 are widely used.</para> 483 are widely used.</para>
484 484
485 <para>Mercurial can import revision history from a Subversion 485 <para id="x_ae">Mercurial can import revision history from a Subversion
486 repository. It can also export revision history to a 486 repository. It can also export revision history to a
487 Subversion repository. This makes it easy to <quote>test the 487 Subversion repository. This makes it easy to <quote>test the
488 waters</quote> and use Mercurial and Subversion in parallel 488 waters</quote> and use Mercurial and Subversion in parallel
489 before deciding to switch. History conversion is incremental, 489 before deciding to switch. History conversion is incremental,
490 so you can perform an initial conversion, then small 490 so you can perform an initial conversion, then small
494 494
495 </sect2> 495 </sect2>
496 <sect2> 496 <sect2>
497 <title>Git</title> 497 <title>Git</title>
498 498
499 <para>Git is a distributed revision control tool that was 499 <para id="x_af">Git is a distributed revision control tool that was
500 developed for managing the Linux kernel source tree. Like 500 developed for managing the Linux kernel source tree. Like
501 Mercurial, its early design was somewhat influenced by 501 Mercurial, its early design was somewhat influenced by
502 Monotone.</para> 502 Monotone.</para>
503 503
504 <para>Git has a very large command set, with version 1.5.0 504 <para id="x_b0">Git has a very large command set, with version 1.5.0
505 providing 139 individual commands. It has something of a 505 providing 139 individual commands. It has something of a
506 reputation for being difficult to learn. Compared to Git, 506 reputation for being difficult to learn. Compared to Git,
507 Mercurial has a strong focus on simplicity.</para> 507 Mercurial has a strong focus on simplicity.</para>
508 508
509 <para>In terms of performance, Git is extremely fast. In 509 <para id="x_b1">In terms of performance, Git is extremely fast. In
510 several cases, it is faster than Mercurial, at least on Linux, 510 several cases, it is faster than Mercurial, at least on Linux,
511 while Mercurial performs better on other operations. However, 511 while Mercurial performs better on other operations. However,
512 on Windows, the performance and general level of support that 512 on Windows, the performance and general level of support that
513 Git provides is, at the time of writing, far behind that of 513 Git provides is, at the time of writing, far behind that of
514 Mercurial.</para> 514 Mercurial.</para>
515 515
516 <para>While a Mercurial repository needs no maintenance, a Git 516 <para id="x_b2">While a Mercurial repository needs no maintenance, a Git
517 repository requires frequent manual <quote>repacks</quote> of 517 repository requires frequent manual <quote>repacks</quote> of
518 its metadata. Without these, performance degrades, while 518 its metadata. Without these, performance degrades, while
519 space usage grows rapidly. A server that contains many Git 519 space usage grows rapidly. A server that contains many Git
520 repositories that are not rigorously and frequently repacked 520 repositories that are not rigorously and frequently repacked
521 will become heavily disk-bound during backups, and there have 521 will become heavily disk-bound during backups, and there have
522 been instances of daily backups taking far longer than 24 522 been instances of daily backups taking far longer than 24
523 hours as a result. A freshly packed Git repository is 523 hours as a result. A freshly packed Git repository is
524 slightly smaller than a Mercurial repository, but an unpacked 524 slightly smaller than a Mercurial repository, but an unpacked
525 repository is several orders of magnitude larger.</para> 525 repository is several orders of magnitude larger.</para>
526 526
527 <para>The core of Git is written in C. Many Git commands are 527 <para id="x_b3">The core of Git is written in C. Many Git commands are
528 implemented as shell or Perl scripts, and the quality of these 528 implemented as shell or Perl scripts, and the quality of these
529 scripts varies widely. I have encountered several instances 529 scripts varies widely. I have encountered several instances
530 where scripts charged along blindly in the presence of errors 530 where scripts charged along blindly in the presence of errors
531 that should have been fatal.</para> 531 that should have been fatal.</para>
532 532
533 <para>Mercurial can import revision history from a Git 533 <para id="x_b4">Mercurial can import revision history from a Git
534 repository.</para> 534 repository.</para>
535 535
536 536
537 </sect2> 537 </sect2>
538 <sect2> 538 <sect2>
539 <title>CVS</title> 539 <title>CVS</title>
540 540
541 <para>CVS is probably the most widely used revision control tool 541 <para id="x_b5">CVS is probably the most widely used revision control tool
542 in the world. Due to its age and internal untidiness, it has 542 in the world. Due to its age and internal untidiness, it has
543 been only lightly maintained for many years.</para> 543 been only lightly maintained for many years.</para>
544 544
545 <para>It has a centralised client/server architecture. It does 545 <para id="x_b6">It has a centralised client/server architecture. It does
546 not group related file changes into atomic commits, making it 546 not group related file changes into atomic commits, making it
547 easy for people to <quote>break the build</quote>: one person 547 easy for people to <quote>break the build</quote>: one person
548 can successfully commit part of a change and then be blocked 548 can successfully commit part of a change and then be blocked
549 by the need for a merge, causing other people to see only a 549 by the need for a merge, causing other people to see only a
550 portion of the work they intended to do. This also affects 550 portion of the work they intended to do. This also affects
552 the modifications someone made as part of a task, you will 552 the modifications someone made as part of a task, you will
553 need to manually inspect the descriptions and timestamps of 553 need to manually inspect the descriptions and timestamps of
554 the changes made to each file involved (if you even know what 554 the changes made to each file involved (if you even know what
555 those files were).</para> 555 those files were).</para>
556 556
557 <para>CVS has a muddled notion of tags and branches that I will 557 <para id="x_b7">CVS has a muddled notion of tags and branches that I will
558 not attempt to even describe. It does not support renaming of 558 not attempt to even describe. It does not support renaming of
559 files or directories well, making it easy to corrupt a 559 files or directories well, making it easy to corrupt a
560 repository. It has almost no internal consistency checking 560 repository. It has almost no internal consistency checking
561 capabilities, so it is usually not even possible to tell 561 capabilities, so it is usually not even possible to tell
562 whether or how a repository is corrupt. I would not recommend 562 whether or how a repository is corrupt. I would not recommend
563 CVS for any project, existing or new.</para> 563 CVS for any project, existing or new.</para>
564 564
565 <para>Mercurial can import CVS revision history. However, there 565 <para id="x_b8">Mercurial can import CVS revision history. However, there
566 are a few caveats that apply; these are true of every other 566 are a few caveats that apply; these are true of every other
567 revision control tool's CVS importer, too. Due to CVS's lack 567 revision control tool's CVS importer, too. Due to CVS's lack
568 of atomic changes and unversioned filesystem hierarchy, it is 568 of atomic changes and unversioned filesystem hierarchy, it is
569 not possible to reconstruct CVS history completely accurately; 569 not possible to reconstruct CVS history completely accurately;
570 some guesswork is involved, and renames will usually not show 570 some guesswork is involved, and renames will usually not show
574 repositories (completely bogus revision timestamps and files 574 repositories (completely bogus revision timestamps and files
575 that have remained locked for over a decade are just two of 575 that have remained locked for over a decade are just two of
576 the less interesting problems I can recall from personal 576 the less interesting problems I can recall from personal
577 experience).</para> 577 experience).</para>
578 578
579 <para>Mercurial can import revision history from a CVS 579 <para id="x_b9">Mercurial can import revision history from a CVS
580 repository.</para> 580 repository.</para>
581 581
582 582
583 </sect2> 583 </sect2>
584 <sect2> 584 <sect2>
585 <title>Commercial tools</title> 585 <title>Commercial tools</title>
586 586
587 <para>Perforce has a centralised client/server architecture, 587 <para id="x_ba">Perforce has a centralised client/server architecture,
588 with no client-side caching of any data. Unlike modern 588 with no client-side caching of any data. Unlike modern
589 revision control tools, Perforce requires that a user run a 589 revision control tools, Perforce requires that a user run a
590 command to inform the server about every file they intend to 590 command to inform the server about every file they intend to
591 edit.</para> 591 edit.</para>
592 592
593 <para>The performance of Perforce is quite good for small teams, 593 <para id="x_bb">The performance of Perforce is quite good for small teams,
594 but it falls off rapidly as the number of users grows beyond a 594 but it falls off rapidly as the number of users grows beyond a
595 few dozen. Modestly large Perforce installations require the 595 few dozen. Modestly large Perforce installations require the
596 deployment of proxies to cope with the load their users 596 deployment of proxies to cope with the load their users
597 generate.</para> 597 generate.</para>
598 598
599 599
600 </sect2> 600 </sect2>
601 <sect2> 601 <sect2>
602 <title>Choosing a revision control tool</title> 602 <title>Choosing a revision control tool</title>
603 603
604 <para>With the exception of CVS, all of the tools listed above 604 <para id="x_bc">With the exception of CVS, all of the tools listed above
605 have unique strengths that suit them to particular styles of 605 have unique strengths that suit them to particular styles of
606 work. There is no single revision control tool that is best 606 work. There is no single revision control tool that is best
607 in all situations.</para> 607 in all situations.</para>
608 608
609 <para>As an example, Subversion is a good choice for working 609 <para id="x_bd">As an example, Subversion is a good choice for working
610 with frequently edited binary files, due to its centralised 610 with frequently edited binary files, due to its centralised
611 nature and support for file locking.</para> 611 nature and support for file locking.</para>
612 612
613 <para>I personally find Mercurial's properties of simplicity, 613 <para id="x_be">I personally find Mercurial's properties of simplicity,
614 performance, and good merge support to be a compelling 614 performance, and good merge support to be a compelling
615 combination that has served me well for several years.</para> 615 combination that has served me well for several years.</para>
616 616
617 617
618 </sect2> 618 </sect2>
619 </sect1> 619 </sect1>
620 <sect1> 620 <sect1>
621 <title>Switching from another tool to Mercurial</title> 621 <title>Switching from another tool to Mercurial</title>
622 622
623 <para>Mercurial is bundled with an extension named <literal 623 <para id="x_bf">Mercurial is bundled with an extension named <literal
624 role="hg-ext">convert</literal>, which can incrementally 624 role="hg-ext">convert</literal>, which can incrementally
625 import revision history from several other revision control 625 import revision history from several other revision control
626 tools. By <quote>incremental</quote>, I mean that you can 626 tools. By <quote>incremental</quote>, I mean that you can
627 convert all of a project's history to date in one go, then rerun 627 convert all of a project's history to date in one go, then rerun
628 the conversion later to obtain new changes that happened after 628 the conversion later to obtain new changes that happened after
629 the initial conversion.</para> 629 the initial conversion.</para>
630 630
631 <para>The revision control tools supported by <literal 631 <para id="x_c0">The revision control tools supported by <literal
632 role="hg-ext">convert</literal> are as follows:</para> 632 role="hg-ext">convert</literal> are as follows:</para>
633 <itemizedlist> 633 <itemizedlist>
634 <listitem><para>Subversion</para></listitem> 634 <listitem><para id="x_c1">Subversion</para></listitem>
635 <listitem><para>CVS</para></listitem> 635 <listitem><para id="x_c2">CVS</para></listitem>
636 <listitem><para>Git</para></listitem> 636 <listitem><para id="x_c3">Git</para></listitem>
637 <listitem><para>Darcs</para></listitem></itemizedlist> 637 <listitem><para id="x_c4">Darcs</para></listitem></itemizedlist>
638 638
639 <para>In addition, <literal role="hg-ext">convert</literal> can 639 <para id="x_c5">In addition, <literal role="hg-ext">convert</literal> can
640 export changes from Mercurial to Subversion. This makes it 640 export changes from Mercurial to Subversion. This makes it
641 possible to try Subversion and Mercurial in parallel before 641 possible to try Subversion and Mercurial in parallel before
642 committing to a switchover, without risking the loss of any 642 committing to a switchover, without risking the loss of any
643 work.</para> 643 work.</para>
644 644
645 <para>The <command role="hg-ext-convert">convert</command> command 645 <para id="x_c6">The <command role="hg-ext-convert">convert</command> command
646 is easy to use. Simply point it at the path or URL of the 646 is easy to use. Simply point it at the path or URL of the
647 source repository, optionally give it the name of the 647 source repository, optionally give it the name of the
648 destination repository, and it will start working. After the 648 destination repository, and it will start working. After the
649 initial conversion, just run the same command again to import 649 initial conversion, just run the same command again to import
650 new changes.</para> 650 new changes.</para>
651 </sect1> 651 </sect1>
652 652
653 <sect1> 653 <sect1>
654 <title>A short history of revision control</title> 654 <title>A short history of revision control</title>
655 655
656 <para>The best known of the old-time revision control tools is 656 <para id="x_c7">The best known of the old-time revision control tools is
657 SCCS (Source Code Control System), which Marc Rochkind wrote at 657 SCCS (Source Code Control System), which Marc Rochkind wrote at
658 Bell Labs, in the early 1970s. SCCS operated on individual 658 Bell Labs, in the early 1970s. SCCS operated on individual
659 files, and required every person working on a project to have 659 files, and required every person working on a project to have
660 access to a shared workspace on a single system. Only one 660 access to a shared workspace on a single system. Only one
661 person could modify a file at any time; arbitration for access 661 person could modify a file at any time; arbitration for access
662 to files was via locks. It was common for people to lock files, 662 to files was via locks. It was common for people to lock files,
663 and later forget to unlock them, preventing anyone else from 663 and later forget to unlock them, preventing anyone else from
664 modifying those files without the help of an 664 modifying those files without the help of an
665 administrator.</para> 665 administrator.</para>
666 666
667 <para>Walter Tichy developed a free alternative to SCCS in the 667 <para id="x_c8">Walter Tichy developed a free alternative to SCCS in the
668 early 1980s; he called his program RCS (Revision Control System). 668 early 1980s; he called his program RCS (Revision Control System).
669 Like SCCS, RCS required developers to work in a single shared 669 Like SCCS, RCS required developers to work in a single shared
670 workspace, and to lock files to prevent multiple people from 670 workspace, and to lock files to prevent multiple people from
671 modifying them simultaneously.</para> 671 modifying them simultaneously.</para>
672 672
673 <para>Later in the 1980s, Dick Grune used RCS as a building block 673 <para id="x_c9">Later in the 1980s, Dick Grune used RCS as a building block
674 for a set of shell scripts he initially called cmt, but then 674 for a set of shell scripts he initially called cmt, but then
675 renamed to CVS (Concurrent Versions System). The big innovation 675 renamed to CVS (Concurrent Versions System). The big innovation
676 of CVS was that it let developers work simultaneously and 676 of CVS was that it let developers work simultaneously and
677 somewhat independently in their own personal workspaces. The 677 somewhat independently in their own personal workspaces. The
678 personal workspaces prevented developers from stepping on each 678 personal workspaces prevented developers from stepping on each
679 other's toes all the time, as was common with SCCS and RCS. Each 679 other's toes all the time, as was common with SCCS and RCS. Each
680 developer had a copy of every project file, and could modify 680 developer had a copy of every project file, and could modify
681 their copies independently. They had to merge their edits prior 681 their copies independently. They had to merge their edits prior
682 to committing changes to the central repository.</para> 682 to committing changes to the central repository.</para>
683 683
684 <para>Brian Berliner took Grune's original scripts and rewrote 684 <para id="x_ca">Brian Berliner took Grune's original scripts and rewrote
685 them in C, releasing in 1989 the code that has since developed 685 them in C, releasing in 1989 the code that has since developed
686 into the modern version of CVS. CVS subsequently acquired the 686 into the modern version of CVS. CVS subsequently acquired the
687 ability to operate over a network connection, giving it a 687 ability to operate over a network connection, giving it a
688 client/server architecture. CVS's architecture is centralised; 688 client/server architecture. CVS's architecture is centralised;
689 only the server has a copy of the history of the project. Client 689 only the server has a copy of the history of the project. Client
690 workspaces just contain copies of recent versions of the 690 workspaces just contain copies of recent versions of the
691 project's files, and a little metadata to tell them where the 691 project's files, and a little metadata to tell them where the
692 server is. CVS has been enormously successful; it is probably 692 server is. CVS has been enormously successful; it is probably
693 the world's most widely used revision control system.</para> 693 the world's most widely used revision control system.</para>
694 694
695 <para>In the early 1990s, Sun Microsystems developed an early 695 <para id="x_cb">In the early 1990s, Sun Microsystems developed an early
696 distributed revision control system, called TeamWare. A 696 distributed revision control system, called TeamWare. A
697 TeamWare workspace contains a complete copy of the project's 697 TeamWare workspace contains a complete copy of the project's
698 history. TeamWare has no notion of a central repository. (CVS 698 history. TeamWare has no notion of a central repository. (CVS
699 relied upon RCS for its history storage; TeamWare used 699 relied upon RCS for its history storage; TeamWare used
700 SCCS.)</para> 700 SCCS.)</para>
701 701
702 <para>As the 1990s progressed, awareness grew of a number of 702 <para id="x_cc">As the 1990s progressed, awareness grew of a number of
703 problems with CVS. It records simultaneous changes to multiple 703 problems with CVS. It records simultaneous changes to multiple
704 files individually, instead of grouping them together as a 704 files individually, instead of grouping them together as a
705 single logically atomic operation. It does not manage its file 705 single logically atomic operation. It does not manage its file
706 hierarchy well; it is easy to make a mess of a repository by 706 hierarchy well; it is easy to make a mess of a repository by
707 renaming files and directories. Worse, its source code is 707 renaming files and directories. Worse, its source code is
708 difficult to read and maintain, which made the <quote>pain 708 difficult to read and maintain, which made the <quote>pain
709 level</quote> of fixing these architectural problems 709 level</quote> of fixing these architectural problems
710 prohibitive.</para> 710 prohibitive.</para>
711 711
712 <para>In 2001, Jim Blandy and Karl Fogel, two developers who had 712 <para id="x_cd">In 2001, Jim Blandy and Karl Fogel, two developers who had
713 worked on CVS, started a project to replace it with a tool that 713 worked on CVS, started a project to replace it with a tool that
714 would have a better architecture and cleaner code. The result, 714 would have a better architecture and cleaner code. The result,
715 Subversion, does not stray from CVS's centralised client/server 715 Subversion, does not stray from CVS's centralised client/server
716 model, but it adds multi-file atomic commits, better namespace 716 model, but it adds multi-file atomic commits, better namespace
717 management, and a number of other features that make it a 717 management, and a number of other features that make it a
718 generally better tool than CVS. Since its initial release, it 718 generally better tool than CVS. Since its initial release, it
719 has rapidly grown in popularity.</para> 719 has rapidly grown in popularity.</para>
720 720
721 <para>More or less simultaneously, Graydon Hoare began working on 721 <para id="x_ce">More or less simultaneously, Graydon Hoare began working on
722 an ambitious distributed revision control system that he named 722 an ambitious distributed revision control system that he named
723 Monotone. While Monotone addresses many of CVS's design flaws 723 Monotone. While Monotone addresses many of CVS's design flaws
724 and has a peer-to-peer architecture, it goes beyond earlier (and 724 and has a peer-to-peer architecture, it goes beyond earlier (and
725 subsequent) revision control tools in a number of innovative 725 subsequent) revision control tools in a number of innovative
726 ways. It uses cryptographic hashes as identifiers, and has an 726 ways. It uses cryptographic hashes as identifiers, and has an
727 integral notion of <quote>trust</quote> for code from different 727 integral notion of <quote>trust</quote> for code from different
728 sources.</para> 728 sources.</para>
729 729
730 <para>Mercurial began life in 2005. While a few aspects of its 730 <para id="x_cf">Mercurial began life in 2005. While a few aspects of its
731 design are influenced by Monotone, Mercurial focuses on ease of 731 design are influenced by Monotone, Mercurial focuses on ease of
732 use, high performance, and scalability to very large 732 use, high performance, and scalability to very large
733 projects.</para> 733 projects.</para>
734 734
735 </sect1> 735 </sect1>
736 736
737 <sect1> 737 <sect1>
738 <title>Colophon&emdash;this book is Free</title> 738 <title>Colophon&emdash;this book is Free</title>
739 739
740 <para>This book is licensed under the Open Publication License, 740 <para id="x_d0">This book is licensed under the Open Publication License,
741 and is produced entirely using Free Software tools. It is 741 and is produced entirely using Free Software tools. It is
742 typeset with DocBook XML. Illustrations are drawn and rendered with 742 typeset with DocBook XML. Illustrations are drawn and rendered with
743 <ulink url="http://www.inkscape.org/">Inkscape</ulink>.</para> 743 <ulink url="http://www.inkscape.org/">Inkscape</ulink>.</para>
744 744
745 <para>The complete source code for this book is published as a 745 <para id="x_d1">The complete source code for this book is published as a
746 Mercurial repository, at <ulink 746 Mercurial repository, at <ulink
747 url="http://hg.serpentine.com/mercurial/book">http://hg.serpentine.com/mercurial/book</ulink>.</para> 747 url="http://hg.serpentine.com/mercurial/book">http://hg.serpentine.com/mercurial/book</ulink>.</para>
748 748
749 </sect1> 749 </sect1>
750 </preface> 750 </preface>