Mercurial > hgbook
comparison en/ch03-concepts.xml @ 691:4ce9d0754af3
Remove the words "section", "chapter", etc from in front of xref tags.
author | Bryan O'Sullivan <bos@serpentine.com> |
---|---|
date | Thu, 26 Mar 2009 21:22:03 -0700 |
parents | b788b405e141 |
children | 0b45854f0b7b |
comparison
equal
deleted
inserted
replaced
690:b788b405e141 | 691:4ce9d0754af3 |
---|---|
44 (<quote><literal>.i</literal></quote> suffix) files. For | 44 (<quote><literal>.i</literal></quote> suffix) files. For |
45 small files without much history, the revision data and index | 45 small files without much history, the revision data and index |
46 are combined in a single <quote><literal>.i</literal></quote> | 46 are combined in a single <quote><literal>.i</literal></quote> |
47 file. The correspondence between a file in the working | 47 file. The correspondence between a file in the working |
48 directory and the filelog that tracks its history in the | 48 directory and the filelog that tracks its history in the |
49 repository is illustrated in figure <xref | 49 repository is illustrated in <xref |
50 linkend="fig:concepts:filelog"/>.</para> | 50 linkend="fig:concepts:filelog"/>.</para> |
51 | 51 |
52 <figure id="fig:concepts:filelog"> | 52 <figure id="fig:concepts:filelog"> |
53 <title>Relationships between files in working directory and | 53 <title>Relationships between files in working directory and |
54 filelogs in repository</title> | 54 filelogs in repository</title> |
94 <para id="x_2f1">For every changeset in a repository, there is exactly one | 94 <para id="x_2f1">For every changeset in a repository, there is exactly one |
95 revision stored in the changelog. Each revision of the | 95 revision stored in the changelog. Each revision of the |
96 changelog contains a pointer to a single revision of the | 96 changelog contains a pointer to a single revision of the |
97 manifest. A revision of the manifest stores a pointer to a | 97 manifest. A revision of the manifest stores a pointer to a |
98 single revision of each filelog tracked when that changeset | 98 single revision of each filelog tracked when that changeset |
99 was created. These relationships are illustrated in figure | 99 was created. These relationships are illustrated in |
100 <xref linkend="fig:concepts:metadata"/>.</para> | 100 <xref linkend="fig:concepts:metadata"/>.</para> |
101 | 101 |
102 <figure id="fig:concepts:metadata"> | 102 <figure id="fig:concepts:metadata"> |
103 <title>Metadata relationships</title> | 103 <title>Metadata relationships</title> |
104 <mediaobject> | 104 <mediaobject> |
199 instead of another delta. This makes it possible to | 199 instead of another delta. This makes it possible to |
200 reconstruct <emphasis>any</emphasis> revision of a file | 200 reconstruct <emphasis>any</emphasis> revision of a file |
201 quickly. This approach works so well that it has since been | 201 quickly. This approach works so well that it has since been |
202 copied by several other revision control systems.</para> | 202 copied by several other revision control systems.</para> |
203 | 203 |
204 <para id="x_2fd">Figure <xref linkend="fig:concepts:snapshot"/> illustrates | 204 <para id="x_2fd"><xref linkend="fig:concepts:snapshot"/> illustrates |
205 the idea. In an entry in a revlog's index file, Mercurial | 205 the idea. In an entry in a revlog's index file, Mercurial |
206 stores the range of entries from the data file that it must | 206 stores the range of entries from the data file that it must |
207 read to reconstruct a particular revision.</para> | 207 read to reconstruct a particular revision.</para> |
208 | 208 |
209 <sect3> | 209 <sect3> |
271 for not one parent, but two. Mercurial uses a special hash, | 271 for not one parent, but two. Mercurial uses a special hash, |
272 called the <quote>null ID</quote>, to represent the idea | 272 called the <quote>null ID</quote>, to represent the idea |
273 <quote>there is no parent here</quote>. This hash is simply a | 273 <quote>there is no parent here</quote>. This hash is simply a |
274 string of zeroes.</para> | 274 string of zeroes.</para> |
275 | 275 |
276 <para id="x_305">In figure <xref linkend="fig:concepts:revlog"/>, you can see | 276 <para id="x_305">In <xref linkend="fig:concepts:revlog"/>, you can see |
277 an example of the conceptual structure of a revlog. Filelogs, | 277 an example of the conceptual structure of a revlog. Filelogs, |
278 manifests, and changelogs all have this same structure; they | 278 manifests, and changelogs all have this same structure; they |
279 differ only in the kind of data stored in each delta or | 279 differ only in the kind of data stored in each delta or |
280 snapshot.</para> | 280 snapshot.</para> |
281 | 281 |
345 <imageobject><imagedata fileref="wdir"/></imageobject> | 345 <imageobject><imagedata fileref="wdir"/></imageobject> |
346 <textobject><phrase>XXX add text</phrase></textobject> | 346 <textobject><phrase>XXX add text</phrase></textobject> |
347 </mediaobject> | 347 </mediaobject> |
348 </figure> | 348 </figure> |
349 | 349 |
350 <para id="x_30d">Figure <xref linkend="fig:concepts:wdir"/> shows the | 350 <para id="x_30d"><xref linkend="fig:concepts:wdir"/> shows the |
351 normal state of the working directory, where it has a single | 351 normal state of the working directory, where it has a single |
352 changeset as parent. That changeset is the | 352 changeset as parent. That changeset is the |
353 <emphasis>tip</emphasis>, the newest changeset in the | 353 <emphasis>tip</emphasis>, the newest changeset in the |
354 repository that has no children.</para> | 354 repository that has no children.</para> |
355 | 355 |
368 or copied will be reflected in that changeset, as will | 368 or copied will be reflected in that changeset, as will |
369 modifications to any files that Mercurial is already tracking; | 369 modifications to any files that Mercurial is already tracking; |
370 the new changeset will have the parents of the working | 370 the new changeset will have the parents of the working |
371 directory as its parents.</para> | 371 directory as its parents.</para> |
372 | 372 |
373 <para id="x_310">After a commit, Mercurial will update the parents of the | 373 <para id="x_310">After a commit, Mercurial will update the |
374 working directory, so that the first parent is the ID of the | 374 parents of the working directory, so that the first parent is |
375 new changeset, and the second is the null ID. This is shown | 375 the ID of the new changeset, and the second is the null ID. |
376 in figure <xref linkend="fig:concepts:wdir-after-commit"/>. | 376 This is shown in <xref |
377 Mercurial | 377 linkend="fig:concepts:wdir-after-commit"/>. Mercurial |
378 doesn't touch any of the files in the working directory when | 378 doesn't touch any of the files in the working directory when |
379 you commit; it just modifies the dirstate to note its new | 379 you commit; it just modifies the dirstate to note its new |
380 parents.</para> | 380 parents.</para> |
381 | 381 |
382 </sect2> | 382 </sect2> |
390 introduced a bug. In cases like this, the natural thing to do | 390 introduced a bug. In cases like this, the natural thing to do |
391 is update the working directory to the changeset you're | 391 is update the working directory to the changeset you're |
392 interested in, and then examine the files in the working | 392 interested in, and then examine the files in the working |
393 directory directly to see their contents as they were when you | 393 directory directly to see their contents as they were when you |
394 committed that changeset. The effect of this is shown in | 394 committed that changeset. The effect of this is shown in |
395 figure <xref linkend="fig:concepts:wdir-pre-branch"/>.</para> | 395 <xref linkend="fig:concepts:wdir-pre-branch"/>.</para> |
396 | 396 |
397 <figure id="fig:concepts:wdir-pre-branch"> | 397 <figure id="fig:concepts:wdir-pre-branch"> |
398 <title>The working directory, updated to an older | 398 <title>The working directory, updated to an older |
399 changeset</title> | 399 changeset</title> |
400 <mediaobject> | 400 <mediaobject> |
401 <imageobject><imagedata fileref="wdir-pre-branch"/></imageobject> | 401 <imageobject><imagedata fileref="wdir-pre-branch"/></imageobject> |
402 <textobject><phrase>XXX add text</phrase></textobject> | 402 <textobject><phrase>XXX add text</phrase></textobject> |
403 </mediaobject> | 403 </mediaobject> |
404 </figure> | 404 </figure> |
405 | 405 |
406 <para id="x_313">Having updated the working directory to an older | 406 <para id="x_313">Having updated the working directory to an |
407 changeset, what happens if you make some changes, and then | 407 older changeset, what happens if you make some changes, and |
408 commit? Mercurial behaves in the same way as I outlined | 408 then commit? Mercurial behaves in the same way as I outlined |
409 above. The parents of the working directory become the | 409 above. The parents of the working directory become the |
410 parents of the new changeset. This new changeset has no | 410 parents of the new changeset. This new changeset has no |
411 children, so it becomes the new tip. And the repository now | 411 children, so it becomes the new tip. And the repository now |
412 contains two changesets that have no children; we call these | 412 contains two changesets that have no children; we call these |
413 <emphasis>heads</emphasis>. You can see the structure that | 413 <emphasis>heads</emphasis>. You can see the structure that |
414 this creates in figure <xref | 414 this creates in <xref |
415 linkend="fig:concepts:wdir-branch"/>.</para> | 415 linkend="fig:concepts:wdir-branch"/>.</para> |
416 | 416 |
417 <figure id="fig:concepts:wdir-branch"> | 417 <figure id="fig:concepts:wdir-branch"> |
418 <title>After a commit made while synced to an older | 418 <title>After a commit made while synced to an older |
419 changeset</title> | 419 changeset</title> |
448 | 448 |
449 </sect2> | 449 </sect2> |
450 <sect2> | 450 <sect2> |
451 <title>Merging heads</title> | 451 <title>Merging heads</title> |
452 | 452 |
453 <para id="x_317">When you run the <command role="hg-cmd">hg merge</command> | 453 <para id="x_317">When you run the <command role="hg-cmd">hg |
454 command, Mercurial leaves the first parent of the working | 454 merge</command> command, Mercurial leaves the first parent |
455 directory unchanged, and sets the second parent to the | 455 of the working directory unchanged, and sets the second parent |
456 changeset you're merging with, as shown in figure <xref | 456 to the changeset you're merging with, as shown in <xref |
457 linkend="fig:concepts:wdir-merge"/>.</para> | 457 linkend="fig:concepts:wdir-merge"/>.</para> |
458 | 458 |
459 <figure id="fig:concepts:wdir-merge"> | 459 <figure id="fig:concepts:wdir-merge"> |
460 <title>Merging two heads</title> | 460 <title>Merging two heads</title> |
461 <mediaobject> | 461 <mediaobject> |
586 </sect3> | 586 </sect3> |
587 </sect2> | 587 </sect2> |
588 <sect2> | 588 <sect2> |
589 <title>Read/write ordering and atomicity</title> | 589 <title>Read/write ordering and atomicity</title> |
590 | 590 |
591 <para id="x_32a">Appending to files isn't the whole story when it comes to | 591 <para id="x_32a">Appending to files isn't the whole story when |
592 guaranteeing that a reader won't see a partial write. If you | 592 it comes to guaranteeing that a reader won't see a partial |
593 recall figure <xref linkend="fig:concepts:metadata"/>, | 593 write. If you recall <xref linkend="fig:concepts:metadata"/>, |
594 revisions in the | 594 revisions in |
595 changelog point to revisions in the manifest, and revisions in | 595 the changelog point to revisions in the manifest, and |
596 the manifest point to revisions in filelogs. This hierarchy | 596 revisions in the manifest point to revisions in filelogs. |
597 is deliberate.</para> | 597 This hierarchy is deliberate.</para> |
598 | 598 |
599 <para id="x_32b">A writer starts a transaction by writing filelog and | 599 <para id="x_32b">A writer starts a transaction by writing filelog and |
600 manifest data, and doesn't write any changelog data until | 600 manifest data, and doesn't write any changelog data until |
601 those are finished. A reader starts by reading changelog | 601 those are finished. A reader starts by reading changelog |
602 data, then manifest data, followed by filelog data.</para> | 602 data, then manifest data, followed by filelog data.</para> |