Mercurial > hgbook
annotate en/ch03-concepts.xml @ 759:f7add9f718a8
Update Chinese translation
author | Dongsheng Song <dongsheng.song@gmail.com> |
---|---|
date | Tue, 31 Mar 2009 10:02:16 +0800 |
parents | 1c13ed2130a7 |
children | e9ef075327c1 |
rev | line source |
---|---|
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
1 <!-- vim: set filetype=docbkxml shiftwidth=2 autoindent expandtab tw=77 : --> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
2 |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
3 <chapter id="chap:concepts"> |
671
13513d2a128d
Add sensible names to chapters.
Bryan O'Sullivan <bos@serpentine.com>
parents:
658
diff
changeset
|
4 <?dbhtml filename="behind-the-scenes.html"?> |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
5 <title>Behind the scenes</title> |
56
b8539d91c84d
Begining of concepts chapter
Josef "Jeff" Sipek <jeffpc@josefsipek.net>
parents:
diff
changeset
|
6 |
683
c838b3975bc6
Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents:
682
diff
changeset
|
7 <para id="x_2e8">Unlike many revision control systems, the concepts upon which |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
8 Mercurial is built are simple enough that it's easy to understand |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
9 how the software really works. Knowing this certainly isn't |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
10 necessary, but I find it useful to have a <quote>mental |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
11 model</quote> of what's going on.</para> |
56
b8539d91c84d
Begining of concepts chapter
Josef "Jeff" Sipek <jeffpc@josefsipek.net>
parents:
diff
changeset
|
12 |
683
c838b3975bc6
Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents:
682
diff
changeset
|
13 <para id="x_2e9">This understanding gives me confidence that Mercurial has been |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
14 carefully designed to be both <emphasis>safe</emphasis> and |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
15 <emphasis>efficient</emphasis>. And just as importantly, if it's |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
16 easy for me to retain a good idea of what the software is doing |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
17 when I perform a revision control task, I'm less likely to be |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
18 surprised by its behaviour.</para> |
109
1b67dc96f27a
Snapshot of concepts chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
108
diff
changeset
|
19 |
683
c838b3975bc6
Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents:
682
diff
changeset
|
20 <para id="x_2ea">In this chapter, we'll initially cover the core concepts |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
21 behind Mercurial's design, then continue to discuss some of the |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
22 interesting details of its implementation.</para> |
112 | 23 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
24 <sect1> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
25 <title>Mercurial's historical record</title> |
109
1b67dc96f27a
Snapshot of concepts chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
108
diff
changeset
|
26 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
27 <sect2> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
28 <title>Tracking the history of a single file</title> |
56
b8539d91c84d
Begining of concepts chapter
Josef "Jeff" Sipek <jeffpc@josefsipek.net>
parents:
diff
changeset
|
29 |
683
c838b3975bc6
Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents:
682
diff
changeset
|
30 <para id="x_2eb">When Mercurial tracks modifications to a file, it stores |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
31 the history of that file in a metadata object called a |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
32 <emphasis>filelog</emphasis>. Each entry in the filelog |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
33 contains enough information to reconstruct one revision of the |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
34 file that is being tracked. Filelogs are stored as files in |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
35 the <filename role="special" |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
36 class="directory">.hg/store/data</filename> directory. A |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
37 filelog contains two kinds of information: revision data, and |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
38 an index to help Mercurial to find a revision |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
39 efficiently.</para> |
56
b8539d91c84d
Begining of concepts chapter
Josef "Jeff" Sipek <jeffpc@josefsipek.net>
parents:
diff
changeset
|
40 |
683
c838b3975bc6
Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents:
682
diff
changeset
|
41 <para id="x_2ec">A file that is large, or has a lot of history, has its |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
42 filelog stored in separate data |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
43 (<quote><literal>.d</literal></quote> suffix) and index |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
44 (<quote><literal>.i</literal></quote> suffix) files. For |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
45 small files without much history, the revision data and index |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
46 are combined in a single <quote><literal>.i</literal></quote> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
47 file. The correspondence between a file in the working |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
48 directory and the filelog that tracks its history in the |
691
4ce9d0754af3
Remove the words "section", "chapter", etc from in front of xref tags.
Bryan O'Sullivan <bos@serpentine.com>
parents:
690
diff
changeset
|
49 repository is illustrated in <xref |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
50 linkend="fig:concepts:filelog"/>.</para> |
56
b8539d91c84d
Begining of concepts chapter
Josef "Jeff" Sipek <jeffpc@josefsipek.net>
parents:
diff
changeset
|
51 |
690
b788b405e141
Replace uses of <informalfigure> with <figure>
Bryan O'Sullivan <bos@serpentine.com>
parents:
683
diff
changeset
|
52 <figure id="fig:concepts:filelog"> |
b788b405e141
Replace uses of <informalfigure> with <figure>
Bryan O'Sullivan <bos@serpentine.com>
parents:
683
diff
changeset
|
53 <title>Relationships between files in working directory and |
b788b405e141
Replace uses of <informalfigure> with <figure>
Bryan O'Sullivan <bos@serpentine.com>
parents:
683
diff
changeset
|
54 filelogs in repository</title> |
b788b405e141
Replace uses of <informalfigure> with <figure>
Bryan O'Sullivan <bos@serpentine.com>
parents:
683
diff
changeset
|
55 <mediaobject> |
693
0b45854f0b7b
Generate and include images properly.
Bryan O'Sullivan <bos@serpentine.com>
parents:
691
diff
changeset
|
56 <imageobject><imagedata fileref="figs/filelog.png"/></imageobject> |
690
b788b405e141
Replace uses of <informalfigure> with <figure>
Bryan O'Sullivan <bos@serpentine.com>
parents:
683
diff
changeset
|
57 <textobject><phrase>XXX add text</phrase></textobject> |
b788b405e141
Replace uses of <informalfigure> with <figure>
Bryan O'Sullivan <bos@serpentine.com>
parents:
683
diff
changeset
|
58 </mediaobject> |
b788b405e141
Replace uses of <informalfigure> with <figure>
Bryan O'Sullivan <bos@serpentine.com>
parents:
683
diff
changeset
|
59 </figure> |
109
1b67dc96f27a
Snapshot of concepts chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
108
diff
changeset
|
60 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
61 </sect2> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
62 <sect2> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
63 <title>Managing tracked files</title> |
109
1b67dc96f27a
Snapshot of concepts chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
108
diff
changeset
|
64 |
683
c838b3975bc6
Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents:
682
diff
changeset
|
65 <para id="x_2ee">Mercurial uses a structure called a |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
66 <emphasis>manifest</emphasis> to collect together information |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
67 about the files that it tracks. Each entry in the manifest |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
68 contains information about the files present in a single |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
69 changeset. An entry records which files are present in the |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
70 changeset, the revision of each file, and a few other pieces |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
71 of file metadata.</para> |
109
1b67dc96f27a
Snapshot of concepts chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
108
diff
changeset
|
72 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
73 </sect2> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
74 <sect2> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
75 <title>Recording changeset information</title> |
109
1b67dc96f27a
Snapshot of concepts chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
108
diff
changeset
|
76 |
683
c838b3975bc6
Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents:
682
diff
changeset
|
77 <para id="x_2ef">The <emphasis>changelog</emphasis> contains information |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
78 about each changeset. Each revision records who committed a |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
79 change, the changeset comment, other pieces of |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
80 changeset-related information, and the revision of the |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
81 manifest to use.</para> |
109
1b67dc96f27a
Snapshot of concepts chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
108
diff
changeset
|
82 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
83 </sect2> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
84 <sect2> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
85 <title>Relationships between revisions</title> |
109
1b67dc96f27a
Snapshot of concepts chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
108
diff
changeset
|
86 |
683
c838b3975bc6
Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents:
682
diff
changeset
|
87 <para id="x_2f0">Within a changelog, a manifest, or a filelog, each |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
88 revision stores a pointer to its immediate parent (or to its |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
89 two parents, if it's a merge revision). As I mentioned above, |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
90 there are also relationships between revisions |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
91 <emphasis>across</emphasis> these structures, and they are |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
92 hierarchical in nature.</para> |
109
1b67dc96f27a
Snapshot of concepts chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
108
diff
changeset
|
93 |
683
c838b3975bc6
Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents:
682
diff
changeset
|
94 <para id="x_2f1">For every changeset in a repository, there is exactly one |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
95 revision stored in the changelog. Each revision of the |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
96 changelog contains a pointer to a single revision of the |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
97 manifest. A revision of the manifest stores a pointer to a |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
98 single revision of each filelog tracked when that changeset |
691
4ce9d0754af3
Remove the words "section", "chapter", etc from in front of xref tags.
Bryan O'Sullivan <bos@serpentine.com>
parents:
690
diff
changeset
|
99 was created. These relationships are illustrated in |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
100 <xref linkend="fig:concepts:metadata"/>.</para> |
109
1b67dc96f27a
Snapshot of concepts chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
108
diff
changeset
|
101 |
690
b788b405e141
Replace uses of <informalfigure> with <figure>
Bryan O'Sullivan <bos@serpentine.com>
parents:
683
diff
changeset
|
102 <figure id="fig:concepts:metadata"> |
b788b405e141
Replace uses of <informalfigure> with <figure>
Bryan O'Sullivan <bos@serpentine.com>
parents:
683
diff
changeset
|
103 <title>Metadata relationships</title> |
b788b405e141
Replace uses of <informalfigure> with <figure>
Bryan O'Sullivan <bos@serpentine.com>
parents:
683
diff
changeset
|
104 <mediaobject> |
693
0b45854f0b7b
Generate and include images properly.
Bryan O'Sullivan <bos@serpentine.com>
parents:
691
diff
changeset
|
105 <imageobject><imagedata fileref="figs/metadata.png"/></imageobject> |
690
b788b405e141
Replace uses of <informalfigure> with <figure>
Bryan O'Sullivan <bos@serpentine.com>
parents:
683
diff
changeset
|
106 <textobject><phrase>XXX add text</phrase></textobject> |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
107 </mediaobject> |
690
b788b405e141
Replace uses of <informalfigure> with <figure>
Bryan O'Sullivan <bos@serpentine.com>
parents:
683
diff
changeset
|
108 </figure> |
109
1b67dc96f27a
Snapshot of concepts chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
108
diff
changeset
|
109 |
683
c838b3975bc6
Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents:
682
diff
changeset
|
110 <para id="x_2f3">As the illustration shows, there is |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
111 <emphasis>not</emphasis> a <quote>one to one</quote> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
112 relationship between revisions in the changelog, manifest, or |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
113 filelog. If the manifest hasn't changed between two |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
114 changesets, the changelog entries for those changesets will |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
115 point to the same revision of the manifest. If a file that |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
116 Mercurial tracks hasn't changed between two changesets, the |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
117 entry for that file in the two revisions of the manifest will |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
118 point to the same revision of its filelog.</para> |
109
1b67dc96f27a
Snapshot of concepts chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
108
diff
changeset
|
119 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
120 </sect2> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
121 </sect1> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
122 <sect1> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
123 <title>Safe, efficient storage</title> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
124 |
683
c838b3975bc6
Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents:
682
diff
changeset
|
125 <para id="x_2f4">The underpinnings of changelogs, manifests, and filelogs are |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
126 provided by a single structure called the |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
127 <emphasis>revlog</emphasis>.</para> |
109
1b67dc96f27a
Snapshot of concepts chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
108
diff
changeset
|
128 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
129 <sect2> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
130 <title>Efficient storage</title> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
131 |
683
c838b3975bc6
Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents:
682
diff
changeset
|
132 <para id="x_2f5">The revlog provides efficient storage of revisions using a |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
133 <emphasis>delta</emphasis> mechanism. Instead of storing a |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
134 complete copy of a file for each revision, it stores the |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
135 changes needed to transform an older revision into the new |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
136 revision. For many kinds of file data, these deltas are |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
137 typically a fraction of a percent of the size of a full copy |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
138 of a file.</para> |
109
1b67dc96f27a
Snapshot of concepts chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
108
diff
changeset
|
139 |
683
c838b3975bc6
Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents:
682
diff
changeset
|
140 <para id="x_2f6">Some obsolete revision control systems can only work with |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
141 deltas of text files. They must either store binary files as |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
142 complete snapshots or encoded into a text representation, both |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
143 of which are wasteful approaches. Mercurial can efficiently |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
144 handle deltas of files with arbitrary binary contents; it |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
145 doesn't need to treat text as special.</para> |
109
1b67dc96f27a
Snapshot of concepts chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
108
diff
changeset
|
146 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
147 </sect2> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
148 <sect2 id="sec:concepts:txn"> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
149 <title>Safe operation</title> |
109
1b67dc96f27a
Snapshot of concepts chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
108
diff
changeset
|
150 |
683
c838b3975bc6
Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents:
682
diff
changeset
|
151 <para id="x_2f7">Mercurial only ever <emphasis>appends</emphasis> data to |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
152 the end of a revlog file. It never modifies a section of a |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
153 file after it has written it. This is both more robust and |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
154 efficient than schemes that need to modify or rewrite |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
155 data.</para> |
109
1b67dc96f27a
Snapshot of concepts chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
108
diff
changeset
|
156 |
683
c838b3975bc6
Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents:
682
diff
changeset
|
157 <para id="x_2f8">In addition, Mercurial treats every write as part of a |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
158 <emphasis>transaction</emphasis> that can span a number of |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
159 files. A transaction is <emphasis>atomic</emphasis>: either |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
160 the entire transaction succeeds and its effects are all |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
161 visible to readers in one go, or the whole thing is undone. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
162 This guarantee of atomicity means that if you're running two |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
163 copies of Mercurial, where one is reading data and one is |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
164 writing it, the reader will never see a partially written |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
165 result that might confuse it.</para> |
109
1b67dc96f27a
Snapshot of concepts chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
108
diff
changeset
|
166 |
683
c838b3975bc6
Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents:
682
diff
changeset
|
167 <para id="x_2f9">The fact that Mercurial only appends to files makes it |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
168 easier to provide this transactional guarantee. The easier it |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
169 is to do stuff like this, the more confident you should be |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
170 that it's done correctly.</para> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
171 |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
172 </sect2> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
173 <sect2> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
174 <title>Fast retrieval</title> |
109
1b67dc96f27a
Snapshot of concepts chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
108
diff
changeset
|
175 |
683
c838b3975bc6
Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents:
682
diff
changeset
|
176 <para id="x_2fa">Mercurial cleverly avoids a pitfall common to all earlier |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
177 revision control systems: the problem of <emphasis>inefficient |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
178 retrieval</emphasis>. Most revision control systems store |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
179 the contents of a revision as an incremental series of |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
180 modifications against a <quote>snapshot</quote>. To |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
181 reconstruct a specific revision, you must first read the |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
182 snapshot, and then every one of the revisions between the |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
183 snapshot and your target revision. The more history that a |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
184 file accumulates, the more revisions you must read, hence the |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
185 longer it takes to reconstruct a particular revision.</para> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
186 |
690
b788b405e141
Replace uses of <informalfigure> with <figure>
Bryan O'Sullivan <bos@serpentine.com>
parents:
683
diff
changeset
|
187 <figure id="fig:concepts:snapshot"> |
b788b405e141
Replace uses of <informalfigure> with <figure>
Bryan O'Sullivan <bos@serpentine.com>
parents:
683
diff
changeset
|
188 <title>Snapshot of a revlog, with incremental deltas</title> |
b788b405e141
Replace uses of <informalfigure> with <figure>
Bryan O'Sullivan <bos@serpentine.com>
parents:
683
diff
changeset
|
189 <mediaobject> |
693
0b45854f0b7b
Generate and include images properly.
Bryan O'Sullivan <bos@serpentine.com>
parents:
691
diff
changeset
|
190 <imageobject><imagedata fileref="figs/snapshot.png"/></imageobject> |
690
b788b405e141
Replace uses of <informalfigure> with <figure>
Bryan O'Sullivan <bos@serpentine.com>
parents:
683
diff
changeset
|
191 <textobject><phrase>XXX add text</phrase></textobject> |
b788b405e141
Replace uses of <informalfigure> with <figure>
Bryan O'Sullivan <bos@serpentine.com>
parents:
683
diff
changeset
|
192 </mediaobject> |
b788b405e141
Replace uses of <informalfigure> with <figure>
Bryan O'Sullivan <bos@serpentine.com>
parents:
683
diff
changeset
|
193 </figure> |
110 | 194 |
683
c838b3975bc6
Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents:
682
diff
changeset
|
195 <para id="x_2fc">The innovation that Mercurial applies to this problem is |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
196 simple but effective. Once the cumulative amount of delta |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
197 information stored since the last snapshot exceeds a fixed |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
198 threshold, it stores a new snapshot (compressed, of course), |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
199 instead of another delta. This makes it possible to |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
200 reconstruct <emphasis>any</emphasis> revision of a file |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
201 quickly. This approach works so well that it has since been |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
202 copied by several other revision control systems.</para> |
110 | 203 |
691
4ce9d0754af3
Remove the words "section", "chapter", etc from in front of xref tags.
Bryan O'Sullivan <bos@serpentine.com>
parents:
690
diff
changeset
|
204 <para id="x_2fd"><xref linkend="fig:concepts:snapshot"/> illustrates |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
205 the idea. In an entry in a revlog's index file, Mercurial |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
206 stores the range of entries from the data file that it must |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
207 read to reconstruct a particular revision.</para> |
109
1b67dc96f27a
Snapshot of concepts chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
108
diff
changeset
|
208 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
209 <sect3> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
210 <title>Aside: the influence of video compression</title> |
109
1b67dc96f27a
Snapshot of concepts chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
108
diff
changeset
|
211 |
683
c838b3975bc6
Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents:
682
diff
changeset
|
212 <para id="x_2fe">If you're familiar with video compression or have ever |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
213 watched a TV feed through a digital cable or satellite |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
214 service, you may know that most video compression schemes |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
215 store each frame of video as a delta against its predecessor |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
216 frame. In addition, these schemes use <quote>lossy</quote> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
217 compression techniques to increase the compression ratio, so |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
218 visual errors accumulate over the course of a number of |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
219 inter-frame deltas.</para> |
109
1b67dc96f27a
Snapshot of concepts chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
108
diff
changeset
|
220 |
683
c838b3975bc6
Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents:
682
diff
changeset
|
221 <para id="x_2ff">Because it's possible for a video stream to <quote>drop |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
222 out</quote> occasionally due to signal glitches, and to |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
223 limit the accumulation of artefacts introduced by the lossy |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
224 compression process, video encoders periodically insert a |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
225 complete frame (called a <quote>key frame</quote>) into the |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
226 video stream; the next delta is generated against that |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
227 frame. This means that if the video signal gets |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
228 interrupted, it will resume once the next key frame is |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
229 received. Also, the accumulation of encoding errors |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
230 restarts anew with each key frame.</para> |
109
1b67dc96f27a
Snapshot of concepts chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
108
diff
changeset
|
231 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
232 </sect3> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
233 </sect2> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
234 <sect2> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
235 <title>Identification and strong integrity</title> |
110 | 236 |
683
c838b3975bc6
Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents:
682
diff
changeset
|
237 <para id="x_300">Along with delta or snapshot information, a revlog entry |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
238 contains a cryptographic hash of the data that it represents. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
239 This makes it difficult to forge the contents of a revision, |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
240 and easy to detect accidental corruption.</para> |
112 | 241 |
683
c838b3975bc6
Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents:
682
diff
changeset
|
242 <para id="x_301">Hashes provide more than a mere check against corruption; |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
243 they are used as the identifiers for revisions. The changeset |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
244 identification hashes that you see as an end user are from |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
245 revisions of the changelog. Although filelogs and the |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
246 manifest also use hashes, Mercurial only uses these behind the |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
247 scenes.</para> |
110 | 248 |
683
c838b3975bc6
Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents:
682
diff
changeset
|
249 <para id="x_302">Mercurial verifies that hashes are correct when it |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
250 retrieves file revisions and when it pulls changes from |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
251 another repository. If it encounters an integrity problem, it |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
252 will complain and stop whatever it's doing.</para> |
110 | 253 |
683
c838b3975bc6
Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents:
682
diff
changeset
|
254 <para id="x_303">In addition to the effect it has on retrieval efficiency, |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
255 Mercurial's use of periodic snapshots makes it more robust |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
256 against partial data corruption. If a revlog becomes partly |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
257 corrupted due to a hardware error or system bug, it's often |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
258 possible to reconstruct some or most revisions from the |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
259 uncorrupted sections of the revlog, both before and after the |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
260 corrupted section. This would not be possible with a |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
261 delta-only storage model.</para> |
110 | 262 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
263 </sect2> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
264 </sect1> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
265 <sect1> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
266 <title>Revision history, branching, and merging</title> |
115
b74102b56df5
Wow! Lots more work detailing the working directory, merging, etc.
Bryan O'Sullivan <bos@serpentine.com>
parents:
113
diff
changeset
|
267 |
683
c838b3975bc6
Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents:
682
diff
changeset
|
268 <para id="x_304">Every entry in a Mercurial revlog knows the identity of its |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
269 immediate ancestor revision, usually referred to as its |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
270 <emphasis>parent</emphasis>. In fact, a revision contains room |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
271 for not one parent, but two. Mercurial uses a special hash, |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
272 called the <quote>null ID</quote>, to represent the idea |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
273 <quote>there is no parent here</quote>. This hash is simply a |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
274 string of zeroes.</para> |
115
b74102b56df5
Wow! Lots more work detailing the working directory, merging, etc.
Bryan O'Sullivan <bos@serpentine.com>
parents:
113
diff
changeset
|
275 |
691
4ce9d0754af3
Remove the words "section", "chapter", etc from in front of xref tags.
Bryan O'Sullivan <bos@serpentine.com>
parents:
690
diff
changeset
|
276 <para id="x_305">In <xref linkend="fig:concepts:revlog"/>, you can see |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
277 an example of the conceptual structure of a revlog. Filelogs, |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
278 manifests, and changelogs all have this same structure; they |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
279 differ only in the kind of data stored in each delta or |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
280 snapshot.</para> |
115
b74102b56df5
Wow! Lots more work detailing the working directory, merging, etc.
Bryan O'Sullivan <bos@serpentine.com>
parents:
113
diff
changeset
|
281 |
683
c838b3975bc6
Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents:
682
diff
changeset
|
282 <para id="x_306">The first revision in a revlog (at the bottom of the image) |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
283 has the null ID in both of its parent slots. For a |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
284 <quote>normal</quote> revision, its first parent slot contains |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
285 the ID of its parent revision, and its second contains the null |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
286 ID, indicating that the revision has only one real parent. Any |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
287 two revisions that have the same parent ID are branches. A |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
288 revision that represents a merge between branches has two normal |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
289 revision IDs in its parent slots.</para> |
115
b74102b56df5
Wow! Lots more work detailing the working directory, merging, etc.
Bryan O'Sullivan <bos@serpentine.com>
parents:
113
diff
changeset
|
290 |
690
b788b405e141
Replace uses of <informalfigure> with <figure>
Bryan O'Sullivan <bos@serpentine.com>
parents:
683
diff
changeset
|
291 <figure id="fig:concepts:revlog"> |
b788b405e141
Replace uses of <informalfigure> with <figure>
Bryan O'Sullivan <bos@serpentine.com>
parents:
683
diff
changeset
|
292 <title>The conceptual structure of a revlog</title> |
b788b405e141
Replace uses of <informalfigure> with <figure>
Bryan O'Sullivan <bos@serpentine.com>
parents:
683
diff
changeset
|
293 <mediaobject> |
693
0b45854f0b7b
Generate and include images properly.
Bryan O'Sullivan <bos@serpentine.com>
parents:
691
diff
changeset
|
294 <imageobject><imagedata fileref="figs/revlog.png"/></imageobject> |
690
b788b405e141
Replace uses of <informalfigure> with <figure>
Bryan O'Sullivan <bos@serpentine.com>
parents:
683
diff
changeset
|
295 <textobject><phrase>XXX add text</phrase></textobject> |
b788b405e141
Replace uses of <informalfigure> with <figure>
Bryan O'Sullivan <bos@serpentine.com>
parents:
683
diff
changeset
|
296 </mediaobject> |
b788b405e141
Replace uses of <informalfigure> with <figure>
Bryan O'Sullivan <bos@serpentine.com>
parents:
683
diff
changeset
|
297 </figure> |
110 | 298 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
299 </sect1> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
300 <sect1> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
301 <title>The working directory</title> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
302 |
683
c838b3975bc6
Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents:
682
diff
changeset
|
303 <para id="x_307">In the working directory, Mercurial stores a snapshot of the |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
304 files from the repository as of a particular changeset.</para> |
113
a0f57b3e677e
More concepts, this time working directory stuff.
Bryan O'Sullivan <bos@serpentine.com>
parents:
112
diff
changeset
|
305 |
683
c838b3975bc6
Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents:
682
diff
changeset
|
306 <para id="x_308">The working directory <quote>knows</quote> which changeset |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
307 it contains. When you update the working directory to contain a |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
308 particular changeset, Mercurial looks up the appropriate |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
309 revision of the manifest to find out which files it was tracking |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
310 at the time that changeset was committed, and which revision of |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
311 each file was then current. It then recreates a copy of each of |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
312 those files, with the same contents it had when the changeset |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
313 was committed.</para> |
113
a0f57b3e677e
More concepts, this time working directory stuff.
Bryan O'Sullivan <bos@serpentine.com>
parents:
112
diff
changeset
|
314 |
683
c838b3975bc6
Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents:
682
diff
changeset
|
315 <para id="x_309">The <emphasis>dirstate</emphasis> contains Mercurial's |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
316 knowledge of the working directory. This details which |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
317 changeset the working directory is updated to, and all of the |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
318 files that Mercurial is tracking in the working |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
319 directory.</para> |
113
a0f57b3e677e
More concepts, this time working directory stuff.
Bryan O'Sullivan <bos@serpentine.com>
parents:
112
diff
changeset
|
320 |
683
c838b3975bc6
Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents:
682
diff
changeset
|
321 <para id="x_30a">Just as a revision of a revlog has room for two parents, so |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
322 that it can represent either a normal revision (with one parent) |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
323 or a merge of two earlier revisions, the dirstate has slots for |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
324 two parents. When you use the <command role="hg-cmd">hg |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
325 update</command> command, the changeset that you update to is |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
326 stored in the <quote>first parent</quote> slot, and the null ID |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
327 in the second. When you <command role="hg-cmd">hg |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
328 merge</command> with another changeset, the first parent |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
329 remains unchanged, and the second parent is filled in with the |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
330 changeset you're merging with. The <command role="hg-cmd">hg |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
331 parents</command> command tells you what the parents of the |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
332 dirstate are.</para> |
113
a0f57b3e677e
More concepts, this time working directory stuff.
Bryan O'Sullivan <bos@serpentine.com>
parents:
112
diff
changeset
|
333 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
334 <sect2> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
335 <title>What happens when you commit</title> |
113
a0f57b3e677e
More concepts, this time working directory stuff.
Bryan O'Sullivan <bos@serpentine.com>
parents:
112
diff
changeset
|
336 |
683
c838b3975bc6
Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents:
682
diff
changeset
|
337 <para id="x_30b">The dirstate stores parent information for more than just |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
338 book-keeping purposes. Mercurial uses the parents of the |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
339 dirstate as <emphasis>the parents of a new |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
340 changeset</emphasis> when you perform a commit.</para> |
113
a0f57b3e677e
More concepts, this time working directory stuff.
Bryan O'Sullivan <bos@serpentine.com>
parents:
112
diff
changeset
|
341 |
690
b788b405e141
Replace uses of <informalfigure> with <figure>
Bryan O'Sullivan <bos@serpentine.com>
parents:
683
diff
changeset
|
342 <figure id="fig:concepts:wdir"> |
b788b405e141
Replace uses of <informalfigure> with <figure>
Bryan O'Sullivan <bos@serpentine.com>
parents:
683
diff
changeset
|
343 <title>The working directory can have two parents</title> |
b788b405e141
Replace uses of <informalfigure> with <figure>
Bryan O'Sullivan <bos@serpentine.com>
parents:
683
diff
changeset
|
344 <mediaobject> |
693
0b45854f0b7b
Generate and include images properly.
Bryan O'Sullivan <bos@serpentine.com>
parents:
691
diff
changeset
|
345 <imageobject><imagedata fileref="figs/wdir.png"/></imageobject> |
690
b788b405e141
Replace uses of <informalfigure> with <figure>
Bryan O'Sullivan <bos@serpentine.com>
parents:
683
diff
changeset
|
346 <textobject><phrase>XXX add text</phrase></textobject> |
b788b405e141
Replace uses of <informalfigure> with <figure>
Bryan O'Sullivan <bos@serpentine.com>
parents:
683
diff
changeset
|
347 </mediaobject> |
b788b405e141
Replace uses of <informalfigure> with <figure>
Bryan O'Sullivan <bos@serpentine.com>
parents:
683
diff
changeset
|
348 </figure> |
113
a0f57b3e677e
More concepts, this time working directory stuff.
Bryan O'Sullivan <bos@serpentine.com>
parents:
112
diff
changeset
|
349 |
691
4ce9d0754af3
Remove the words "section", "chapter", etc from in front of xref tags.
Bryan O'Sullivan <bos@serpentine.com>
parents:
690
diff
changeset
|
350 <para id="x_30d"><xref linkend="fig:concepts:wdir"/> shows the |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
351 normal state of the working directory, where it has a single |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
352 changeset as parent. That changeset is the |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
353 <emphasis>tip</emphasis>, the newest changeset in the |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
354 repository that has no children.</para> |
113
a0f57b3e677e
More concepts, this time working directory stuff.
Bryan O'Sullivan <bos@serpentine.com>
parents:
112
diff
changeset
|
355 |
690
b788b405e141
Replace uses of <informalfigure> with <figure>
Bryan O'Sullivan <bos@serpentine.com>
parents:
683
diff
changeset
|
356 <figure id="fig:concepts:wdir-after-commit"> |
b788b405e141
Replace uses of <informalfigure> with <figure>
Bryan O'Sullivan <bos@serpentine.com>
parents:
683
diff
changeset
|
357 <title>The working directory gains new parents after a |
b788b405e141
Replace uses of <informalfigure> with <figure>
Bryan O'Sullivan <bos@serpentine.com>
parents:
683
diff
changeset
|
358 commit</title> |
b788b405e141
Replace uses of <informalfigure> with <figure>
Bryan O'Sullivan <bos@serpentine.com>
parents:
683
diff
changeset
|
359 <mediaobject> |
693
0b45854f0b7b
Generate and include images properly.
Bryan O'Sullivan <bos@serpentine.com>
parents:
691
diff
changeset
|
360 <imageobject><imagedata fileref="figs/wdir-after-commit.png"/></imageobject> |
690
b788b405e141
Replace uses of <informalfigure> with <figure>
Bryan O'Sullivan <bos@serpentine.com>
parents:
683
diff
changeset
|
361 <textobject><phrase>XXX add text</phrase></textobject> |
b788b405e141
Replace uses of <informalfigure> with <figure>
Bryan O'Sullivan <bos@serpentine.com>
parents:
683
diff
changeset
|
362 </mediaobject> |
b788b405e141
Replace uses of <informalfigure> with <figure>
Bryan O'Sullivan <bos@serpentine.com>
parents:
683
diff
changeset
|
363 </figure> |
113
a0f57b3e677e
More concepts, this time working directory stuff.
Bryan O'Sullivan <bos@serpentine.com>
parents:
112
diff
changeset
|
364 |
683
c838b3975bc6
Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents:
682
diff
changeset
|
365 <para id="x_30f">It's useful to think of the working directory as |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
366 <quote>the changeset I'm about to commit</quote>. Any files |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
367 that you tell Mercurial that you've added, removed, renamed, |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
368 or copied will be reflected in that changeset, as will |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
369 modifications to any files that Mercurial is already tracking; |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
370 the new changeset will have the parents of the working |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
371 directory as its parents.</para> |
113
a0f57b3e677e
More concepts, this time working directory stuff.
Bryan O'Sullivan <bos@serpentine.com>
parents:
112
diff
changeset
|
372 |
691
4ce9d0754af3
Remove the words "section", "chapter", etc from in front of xref tags.
Bryan O'Sullivan <bos@serpentine.com>
parents:
690
diff
changeset
|
373 <para id="x_310">After a commit, Mercurial will update the |
4ce9d0754af3
Remove the words "section", "chapter", etc from in front of xref tags.
Bryan O'Sullivan <bos@serpentine.com>
parents:
690
diff
changeset
|
374 parents of the working directory, so that the first parent is |
4ce9d0754af3
Remove the words "section", "chapter", etc from in front of xref tags.
Bryan O'Sullivan <bos@serpentine.com>
parents:
690
diff
changeset
|
375 the ID of the new changeset, and the second is the null ID. |
4ce9d0754af3
Remove the words "section", "chapter", etc from in front of xref tags.
Bryan O'Sullivan <bos@serpentine.com>
parents:
690
diff
changeset
|
376 This is shown in <xref |
4ce9d0754af3
Remove the words "section", "chapter", etc from in front of xref tags.
Bryan O'Sullivan <bos@serpentine.com>
parents:
690
diff
changeset
|
377 linkend="fig:concepts:wdir-after-commit"/>. Mercurial |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
378 doesn't touch any of the files in the working directory when |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
379 you commit; it just modifies the dirstate to note its new |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
380 parents.</para> |
113
a0f57b3e677e
More concepts, this time working directory stuff.
Bryan O'Sullivan <bos@serpentine.com>
parents:
112
diff
changeset
|
381 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
382 </sect2> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
383 <sect2> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
384 <title>Creating a new head</title> |
112 | 385 |
683
c838b3975bc6
Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents:
682
diff
changeset
|
386 <para id="x_311">It's perfectly normal to update the working directory to a |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
387 changeset other than the current tip. For example, you might |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
388 want to know what your project looked like last Tuesday, or |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
389 you could be looking through changesets to see which one |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
390 introduced a bug. In cases like this, the natural thing to do |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
391 is update the working directory to the changeset you're |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
392 interested in, and then examine the files in the working |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
393 directory directly to see their contents as they were when you |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
394 committed that changeset. The effect of this is shown 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
|
395 <xref linkend="fig:concepts:wdir-pre-branch"/>.</para> |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
396 |
690
b788b405e141
Replace uses of <informalfigure> with <figure>
Bryan O'Sullivan <bos@serpentine.com>
parents:
683
diff
changeset
|
397 <figure id="fig:concepts:wdir-pre-branch"> |
b788b405e141
Replace uses of <informalfigure> with <figure>
Bryan O'Sullivan <bos@serpentine.com>
parents:
683
diff
changeset
|
398 <title>The working directory, updated to an older |
b788b405e141
Replace uses of <informalfigure> with <figure>
Bryan O'Sullivan <bos@serpentine.com>
parents:
683
diff
changeset
|
399 changeset</title> |
b788b405e141
Replace uses of <informalfigure> with <figure>
Bryan O'Sullivan <bos@serpentine.com>
parents:
683
diff
changeset
|
400 <mediaobject> |
693
0b45854f0b7b
Generate and include images properly.
Bryan O'Sullivan <bos@serpentine.com>
parents:
691
diff
changeset
|
401 <imageobject><imagedata fileref="figs/wdir-pre-branch.png"/></imageobject> |
690
b788b405e141
Replace uses of <informalfigure> with <figure>
Bryan O'Sullivan <bos@serpentine.com>
parents:
683
diff
changeset
|
402 <textobject><phrase>XXX add text</phrase></textobject> |
b788b405e141
Replace uses of <informalfigure> with <figure>
Bryan O'Sullivan <bos@serpentine.com>
parents:
683
diff
changeset
|
403 </mediaobject> |
b788b405e141
Replace uses of <informalfigure> with <figure>
Bryan O'Sullivan <bos@serpentine.com>
parents:
683
diff
changeset
|
404 </figure> |
112 | 405 |
691
4ce9d0754af3
Remove the words "section", "chapter", etc from in front of xref tags.
Bryan O'Sullivan <bos@serpentine.com>
parents:
690
diff
changeset
|
406 <para id="x_313">Having updated the working directory to an |
4ce9d0754af3
Remove the words "section", "chapter", etc from in front of xref tags.
Bryan O'Sullivan <bos@serpentine.com>
parents:
690
diff
changeset
|
407 older changeset, what happens if you make some changes, and |
4ce9d0754af3
Remove the words "section", "chapter", etc from in front of xref tags.
Bryan O'Sullivan <bos@serpentine.com>
parents:
690
diff
changeset
|
408 then commit? Mercurial behaves in the same way as I outlined |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
409 above. The parents of the working directory become the |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
410 parents of the new changeset. This new changeset has no |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
411 children, so it becomes the new tip. And the repository now |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
412 contains two changesets that have no children; we call these |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
413 <emphasis>heads</emphasis>. You can see the structure that |
691
4ce9d0754af3
Remove the words "section", "chapter", etc from in front of xref tags.
Bryan O'Sullivan <bos@serpentine.com>
parents:
690
diff
changeset
|
414 this creates in <xref |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
415 linkend="fig:concepts:wdir-branch"/>.</para> |
112 | 416 |
690
b788b405e141
Replace uses of <informalfigure> with <figure>
Bryan O'Sullivan <bos@serpentine.com>
parents:
683
diff
changeset
|
417 <figure id="fig:concepts:wdir-branch"> |
b788b405e141
Replace uses of <informalfigure> with <figure>
Bryan O'Sullivan <bos@serpentine.com>
parents:
683
diff
changeset
|
418 <title>After a commit made while synced to an older |
b788b405e141
Replace uses of <informalfigure> with <figure>
Bryan O'Sullivan <bos@serpentine.com>
parents:
683
diff
changeset
|
419 changeset</title> |
b788b405e141
Replace uses of <informalfigure> with <figure>
Bryan O'Sullivan <bos@serpentine.com>
parents:
683
diff
changeset
|
420 <mediaobject> |
693
0b45854f0b7b
Generate and include images properly.
Bryan O'Sullivan <bos@serpentine.com>
parents:
691
diff
changeset
|
421 <imageobject><imagedata fileref="figs/wdir-branch.png"/></imageobject> |
690
b788b405e141
Replace uses of <informalfigure> with <figure>
Bryan O'Sullivan <bos@serpentine.com>
parents:
683
diff
changeset
|
422 <textobject><phrase>XXX add text</phrase></textobject> |
b788b405e141
Replace uses of <informalfigure> with <figure>
Bryan O'Sullivan <bos@serpentine.com>
parents:
683
diff
changeset
|
423 </mediaobject> |
b788b405e141
Replace uses of <informalfigure> with <figure>
Bryan O'Sullivan <bos@serpentine.com>
parents:
683
diff
changeset
|
424 </figure> |
115
b74102b56df5
Wow! Lots more work detailing the working directory, merging, etc.
Bryan O'Sullivan <bos@serpentine.com>
parents:
113
diff
changeset
|
425 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
426 <note> |
683
c838b3975bc6
Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents:
682
diff
changeset
|
427 <para id="x_315"> If you're new to Mercurial, you should keep in mind a |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
428 common <quote>error</quote>, which is to use the <command |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
429 role="hg-cmd">hg pull</command> command without any |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
430 options. By default, the <command role="hg-cmd">hg |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
431 pull</command> command <emphasis>does not</emphasis> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
432 update the working directory, so you'll bring new changesets |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
433 into your repository, but the working directory will stay |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
434 synced at the same changeset as before the pull. If you |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
435 make some changes and commit afterwards, you'll thus create |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
436 a new head, because your working directory isn't synced to |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
437 whatever the current tip is.</para> |
115
b74102b56df5
Wow! Lots more work detailing the working directory, merging, etc.
Bryan O'Sullivan <bos@serpentine.com>
parents:
113
diff
changeset
|
438 |
683
c838b3975bc6
Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents:
682
diff
changeset
|
439 <para id="x_316"> I put the word <quote>error</quote> in quotes because |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
440 all that you need to do to rectify this situation is |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
441 <command role="hg-cmd">hg merge</command>, then <command |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
442 role="hg-cmd">hg commit</command>. In other words, this |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
443 almost never has negative consequences; it just surprises |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
444 people. I'll discuss other ways to avoid this behaviour, |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
445 and why Mercurial behaves in this initially surprising way, |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
446 later on.</para> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
447 </note> |
115
b74102b56df5
Wow! Lots more work detailing the working directory, merging, etc.
Bryan O'Sullivan <bos@serpentine.com>
parents:
113
diff
changeset
|
448 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
449 </sect2> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
450 <sect2> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
451 <title>Merging heads</title> |
115
b74102b56df5
Wow! Lots more work detailing the working directory, merging, etc.
Bryan O'Sullivan <bos@serpentine.com>
parents:
113
diff
changeset
|
452 |
691
4ce9d0754af3
Remove the words "section", "chapter", etc from in front of xref tags.
Bryan O'Sullivan <bos@serpentine.com>
parents:
690
diff
changeset
|
453 <para id="x_317">When you run the <command role="hg-cmd">hg |
4ce9d0754af3
Remove the words "section", "chapter", etc from in front of xref tags.
Bryan O'Sullivan <bos@serpentine.com>
parents:
690
diff
changeset
|
454 merge</command> command, Mercurial leaves the first parent |
4ce9d0754af3
Remove the words "section", "chapter", etc from in front of xref tags.
Bryan O'Sullivan <bos@serpentine.com>
parents:
690
diff
changeset
|
455 of the working directory unchanged, and sets the second parent |
4ce9d0754af3
Remove the words "section", "chapter", etc from in front of xref tags.
Bryan O'Sullivan <bos@serpentine.com>
parents:
690
diff
changeset
|
456 to the changeset you're merging with, as shown in <xref |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
457 linkend="fig:concepts:wdir-merge"/>.</para> |
115
b74102b56df5
Wow! Lots more work detailing the working directory, merging, etc.
Bryan O'Sullivan <bos@serpentine.com>
parents:
113
diff
changeset
|
458 |
690
b788b405e141
Replace uses of <informalfigure> with <figure>
Bryan O'Sullivan <bos@serpentine.com>
parents:
683
diff
changeset
|
459 <figure id="fig:concepts:wdir-merge"> |
b788b405e141
Replace uses of <informalfigure> with <figure>
Bryan O'Sullivan <bos@serpentine.com>
parents:
683
diff
changeset
|
460 <title>Merging two heads</title> |
b788b405e141
Replace uses of <informalfigure> with <figure>
Bryan O'Sullivan <bos@serpentine.com>
parents:
683
diff
changeset
|
461 <mediaobject> |
b788b405e141
Replace uses of <informalfigure> with <figure>
Bryan O'Sullivan <bos@serpentine.com>
parents:
683
diff
changeset
|
462 <imageobject> |
693
0b45854f0b7b
Generate and include images properly.
Bryan O'Sullivan <bos@serpentine.com>
parents:
691
diff
changeset
|
463 <imagedata fileref="figs/wdir-merge.png"/> |
690
b788b405e141
Replace uses of <informalfigure> with <figure>
Bryan O'Sullivan <bos@serpentine.com>
parents:
683
diff
changeset
|
464 </imageobject> |
b788b405e141
Replace uses of <informalfigure> with <figure>
Bryan O'Sullivan <bos@serpentine.com>
parents:
683
diff
changeset
|
465 <textobject><phrase>XXX add text</phrase></textobject> |
b788b405e141
Replace uses of <informalfigure> with <figure>
Bryan O'Sullivan <bos@serpentine.com>
parents:
683
diff
changeset
|
466 </mediaobject> |
b788b405e141
Replace uses of <informalfigure> with <figure>
Bryan O'Sullivan <bos@serpentine.com>
parents:
683
diff
changeset
|
467 </figure> |
112 | 468 |
683
c838b3975bc6
Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents:
682
diff
changeset
|
469 <para id="x_319">Mercurial also has to modify the working directory, to |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
470 merge the files managed in the two changesets. Simplified a |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
471 little, the merging process goes like this, for every file in |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
472 the manifests of both changesets.</para> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
473 <itemizedlist> |
683
c838b3975bc6
Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents:
682
diff
changeset
|
474 <listitem><para id="x_31a">If neither changeset has modified a file, do |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
475 nothing with that file.</para> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
476 </listitem> |
683
c838b3975bc6
Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents:
682
diff
changeset
|
477 <listitem><para id="x_31b">If one changeset has modified a file, and the |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
478 other hasn't, create the modified copy of the file in the |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
479 working directory.</para> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
480 </listitem> |
683
c838b3975bc6
Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents:
682
diff
changeset
|
481 <listitem><para id="x_31c">If one changeset has removed a file, and the |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
482 other hasn't (or has also deleted it), delete the file |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
483 from the working directory.</para> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
484 </listitem> |
683
c838b3975bc6
Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents:
682
diff
changeset
|
485 <listitem><para id="x_31d">If one changeset has removed a file, but the |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
486 other has modified the file, ask the user what to do: keep |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
487 the modified file, or remove it?</para> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
488 </listitem> |
683
c838b3975bc6
Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents:
682
diff
changeset
|
489 <listitem><para id="x_31e">If both changesets have modified a file, |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
490 invoke an external merge program to choose the new |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
491 contents for the merged file. This may require input from |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
492 the user.</para> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
493 </listitem> |
683
c838b3975bc6
Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents:
682
diff
changeset
|
494 <listitem><para id="x_31f">If one changeset has modified a file, and the |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
495 other has renamed or copied the file, make sure that the |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
496 changes follow the new name of the file.</para> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
497 </listitem></itemizedlist> |
683
c838b3975bc6
Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents:
682
diff
changeset
|
498 <para id="x_320">There are more details&emdash;merging has plenty of corner |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
499 cases&emdash;but these are the most common choices that are |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
500 involved in a merge. As you can see, most cases are |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
501 completely automatic, and indeed most merges finish |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
502 automatically, without requiring your input to resolve any |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
503 conflicts.</para> |
115
b74102b56df5
Wow! Lots more work detailing the working directory, merging, etc.
Bryan O'Sullivan <bos@serpentine.com>
parents:
113
diff
changeset
|
504 |
683
c838b3975bc6
Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents:
682
diff
changeset
|
505 <para id="x_321">When you're thinking about what happens when you commit |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
506 after a merge, once again the working directory is <quote>the |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
507 changeset I'm about to commit</quote>. After the <command |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
508 role="hg-cmd">hg merge</command> command completes, the |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
509 working directory has two parents; these will become the |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
510 parents of the new changeset.</para> |
115
b74102b56df5
Wow! Lots more work detailing the working directory, merging, etc.
Bryan O'Sullivan <bos@serpentine.com>
parents:
113
diff
changeset
|
511 |
683
c838b3975bc6
Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents:
682
diff
changeset
|
512 <para id="x_322">Mercurial lets you perform multiple merges, but you must |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
513 commit the results of each individual merge as you go. This |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
514 is necessary because Mercurial only tracks two parents for |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
515 both revisions and the working directory. While it would be |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
516 technically possible to merge multiple changesets at once, the |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
517 prospect of user confusion and making a terrible mess of a |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
518 merge immediately becomes overwhelming.</para> |
115
b74102b56df5
Wow! Lots more work detailing the working directory, merging, etc.
Bryan O'Sullivan <bos@serpentine.com>
parents:
113
diff
changeset
|
519 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
520 </sect2> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
521 </sect1> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
522 <sect1> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
523 <title>Other interesting design features</title> |
110 | 524 |
683
c838b3975bc6
Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents:
682
diff
changeset
|
525 <para id="x_323">In the sections above, I've tried to highlight some of the |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
526 most important aspects of Mercurial's design, to illustrate that |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
527 it pays careful attention to reliability and performance. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
528 However, the attention to detail doesn't stop there. There are |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
529 a number of other aspects of Mercurial's construction that I |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
530 personally find interesting. I'll detail a few of them here, |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
531 separate from the <quote>big ticket</quote> items above, so that |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
532 if you're interested, you can gain a better idea of the amount |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
533 of thinking that goes into a well-designed system.</para> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
534 |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
535 <sect2> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
536 <title>Clever compression</title> |
110 | 537 |
683
c838b3975bc6
Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents:
682
diff
changeset
|
538 <para id="x_324">When appropriate, Mercurial will store both snapshots and |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
539 deltas in compressed form. It does this by always |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
540 <emphasis>trying to</emphasis> compress a snapshot or delta, |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
541 but only storing the compressed version if it's smaller than |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
542 the uncompressed version.</para> |
109
1b67dc96f27a
Snapshot of concepts chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
108
diff
changeset
|
543 |
683
c838b3975bc6
Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents:
682
diff
changeset
|
544 <para id="x_325">This means that Mercurial does <quote>the right |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
545 thing</quote> when storing a file whose native form is |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
546 compressed, such as a <literal>zip</literal> archive or a JPEG |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
547 image. When these types of files are compressed a second |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
548 time, the resulting file is usually bigger than the |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
549 once-compressed form, and so Mercurial will store the plain |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
550 <literal>zip</literal> or JPEG.</para> |
109
1b67dc96f27a
Snapshot of concepts chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
108
diff
changeset
|
551 |
683
c838b3975bc6
Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents:
682
diff
changeset
|
552 <para id="x_326">Deltas between revisions of a compressed file are usually |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
553 larger than snapshots of the file, and Mercurial again does |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
554 <quote>the right thing</quote> in these cases. It finds that |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
555 such a delta exceeds the threshold at which it should store a |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
556 complete snapshot of the file, so it stores the snapshot, |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
557 again saving space compared to a naive delta-only |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
558 approach.</para> |
109
1b67dc96f27a
Snapshot of concepts chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
108
diff
changeset
|
559 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
560 <sect3> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
561 <title>Network recompression</title> |
109
1b67dc96f27a
Snapshot of concepts chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
108
diff
changeset
|
562 |
683
c838b3975bc6
Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents:
682
diff
changeset
|
563 <para id="x_327">When storing revisions on disk, Mercurial uses the |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
564 <quote>deflate</quote> compression algorithm (the same one |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
565 used by the popular <literal>zip</literal> archive format), |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
566 which balances good speed with a respectable compression |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
567 ratio. However, when transmitting revision data over a |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
568 network connection, Mercurial uncompresses the compressed |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
569 revision data.</para> |
109
1b67dc96f27a
Snapshot of concepts chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
108
diff
changeset
|
570 |
683
c838b3975bc6
Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents:
682
diff
changeset
|
571 <para id="x_328">If the connection is over HTTP, Mercurial recompresses |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
572 the entire stream of data using a compression algorithm that |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
573 gives a better compression ratio (the Burrows-Wheeler |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
574 algorithm from the widely used <literal>bzip2</literal> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
575 compression package). This combination of algorithm and |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
576 compression of the entire stream (instead of a revision at a |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
577 time) substantially reduces the number of bytes to be |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
578 transferred, yielding better network performance over almost |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
579 all kinds of network.</para> |
109
1b67dc96f27a
Snapshot of concepts chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
108
diff
changeset
|
580 |
683
c838b3975bc6
Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents:
682
diff
changeset
|
581 <para id="x_329">(If the connection is over <command>ssh</command>, |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
582 Mercurial <emphasis>doesn't</emphasis> recompress the |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
583 stream, because <command>ssh</command> can already do this |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
584 itself.)</para> |
109
1b67dc96f27a
Snapshot of concepts chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
108
diff
changeset
|
585 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
586 </sect3> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
587 </sect2> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
588 <sect2> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
589 <title>Read/write ordering and atomicity</title> |
109
1b67dc96f27a
Snapshot of concepts chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
108
diff
changeset
|
590 |
691
4ce9d0754af3
Remove the words "section", "chapter", etc from in front of xref tags.
Bryan O'Sullivan <bos@serpentine.com>
parents:
690
diff
changeset
|
591 <para id="x_32a">Appending to files isn't the whole story when |
4ce9d0754af3
Remove the words "section", "chapter", etc from in front of xref tags.
Bryan O'Sullivan <bos@serpentine.com>
parents:
690
diff
changeset
|
592 it comes to guaranteeing that a reader won't see a partial |
4ce9d0754af3
Remove the words "section", "chapter", etc from in front of xref tags.
Bryan O'Sullivan <bos@serpentine.com>
parents:
690
diff
changeset
|
593 write. If you recall <xref linkend="fig:concepts:metadata"/>, |
4ce9d0754af3
Remove the words "section", "chapter", etc from in front of xref tags.
Bryan O'Sullivan <bos@serpentine.com>
parents:
690
diff
changeset
|
594 revisions in |
4ce9d0754af3
Remove the words "section", "chapter", etc from in front of xref tags.
Bryan O'Sullivan <bos@serpentine.com>
parents:
690
diff
changeset
|
595 the changelog point to revisions in the manifest, and |
4ce9d0754af3
Remove the words "section", "chapter", etc from in front of xref tags.
Bryan O'Sullivan <bos@serpentine.com>
parents:
690
diff
changeset
|
596 revisions in the manifest point to revisions in filelogs. |
4ce9d0754af3
Remove the words "section", "chapter", etc from in front of xref tags.
Bryan O'Sullivan <bos@serpentine.com>
parents:
690
diff
changeset
|
597 This hierarchy is deliberate.</para> |
109
1b67dc96f27a
Snapshot of concepts chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
108
diff
changeset
|
598 |
683
c838b3975bc6
Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents:
682
diff
changeset
|
599 <para id="x_32b">A writer starts a transaction by writing filelog and |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
600 manifest data, and doesn't write any changelog data until |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
601 those are finished. A reader starts by reading changelog |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
602 data, then manifest data, followed by filelog data.</para> |
109
1b67dc96f27a
Snapshot of concepts chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
108
diff
changeset
|
603 |
683
c838b3975bc6
Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents:
682
diff
changeset
|
604 <para id="x_32c">Since the writer has always finished writing filelog and |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
605 manifest data before it writes to the changelog, a reader will |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
606 never read a pointer to a partially written manifest revision |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
607 from the changelog, and it will never read a pointer to a |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
608 partially written filelog revision from the manifest.</para> |
109
1b67dc96f27a
Snapshot of concepts chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
108
diff
changeset
|
609 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
610 </sect2> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
611 <sect2> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
612 <title>Concurrent access</title> |
109
1b67dc96f27a
Snapshot of concepts chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
108
diff
changeset
|
613 |
683
c838b3975bc6
Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents:
682
diff
changeset
|
614 <para id="x_32d">The read/write ordering and atomicity guarantees mean that |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
615 Mercurial never needs to <emphasis>lock</emphasis> a |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
616 repository when it's reading data, even if the repository is |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
617 being written to while the read is occurring. This has a big |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
618 effect on scalability; you can have an arbitrary number of |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
619 Mercurial processes safely reading data from a repository |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
620 safely all at once, no matter whether it's being written to or |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
621 not.</para> |
109
1b67dc96f27a
Snapshot of concepts chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
108
diff
changeset
|
622 |
683
c838b3975bc6
Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents:
682
diff
changeset
|
623 <para id="x_32e">The lockless nature of reading means that if you're |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
624 sharing a repository on a multi-user system, you don't need to |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
625 grant other local users permission to |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
626 <emphasis>write</emphasis> to your repository in order for |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
627 them to be able to clone it or pull changes from it; they only |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
628 need <emphasis>read</emphasis> permission. (This is |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
629 <emphasis>not</emphasis> a common feature among revision |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
630 control systems, so don't take it for granted! Most require |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
631 readers to be able to lock a repository to access it safely, |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
632 and this requires write permission on at least one directory, |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
633 which of course makes for all kinds of nasty and annoying |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
634 security and administrative problems.)</para> |
109
1b67dc96f27a
Snapshot of concepts chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
108
diff
changeset
|
635 |
683
c838b3975bc6
Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents:
682
diff
changeset
|
636 <para id="x_32f">Mercurial uses locks to ensure that only one process can |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
637 write to a repository at a time (the locking mechanism is safe |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
638 even over filesystems that are notoriously hostile to locking, |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
639 such as NFS). If a repository is locked, a writer will wait |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
640 for a while to retry if the repository becomes unlocked, but |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
641 if the repository remains locked for too long, the process |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
642 attempting to write will time out after a while. This means |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
643 that your daily automated scripts won't get stuck forever and |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
644 pile up if a system crashes unnoticed, for example. (Yes, the |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
645 timeout is configurable, from zero to infinity.)</para> |
110 | 646 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
647 <sect3> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
648 <title>Safe dirstate access</title> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
649 |
683
c838b3975bc6
Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents:
682
diff
changeset
|
650 <para id="x_330">As with revision data, Mercurial doesn't take a lock to |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
651 read the dirstate file; it does acquire a lock to write it. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
652 To avoid the possibility of reading a partially written copy |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
653 of the dirstate file, Mercurial writes to a file with a |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
654 unique name in the same directory as the dirstate file, then |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
655 renames the temporary file atomically to |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
656 <filename>dirstate</filename>. The file named |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
657 <filename>dirstate</filename> is thus guaranteed to be |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
658 complete, not partially written.</para> |
110 | 659 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
660 </sect3> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
661 </sect2> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
662 <sect2> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
663 <title>Avoiding seeks</title> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
664 |
683
c838b3975bc6
Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents:
682
diff
changeset
|
665 <para id="x_331">Critical to Mercurial's performance is the avoidance of |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
666 seeks of the disk head, since any seek is far more expensive |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
667 than even a comparatively large read operation.</para> |
109
1b67dc96f27a
Snapshot of concepts chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
108
diff
changeset
|
668 |
683
c838b3975bc6
Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents:
682
diff
changeset
|
669 <para id="x_332">This is why, for example, the dirstate is stored in a |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
670 single file. If there were a dirstate file per directory that |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
671 Mercurial tracked, the disk would seek once per directory. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
672 Instead, Mercurial reads the entire single dirstate file in |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
673 one step.</para> |
109
1b67dc96f27a
Snapshot of concepts chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
108
diff
changeset
|
674 |
683
c838b3975bc6
Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents:
682
diff
changeset
|
675 <para id="x_333">Mercurial also uses a <quote>copy on write</quote> scheme |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
676 when cloning a repository on local storage. Instead of |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
677 copying every revlog file from the old repository into the new |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
678 repository, it makes a <quote>hard link</quote>, which is a |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
679 shorthand way to say <quote>these two names point to the same |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
680 file</quote>. When Mercurial is about to write to one of a |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
681 revlog's files, it checks to see if the number of names |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
682 pointing at the file is greater than one. If it is, more than |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
683 one repository is using the file, so Mercurial makes a new |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
684 copy of the file that is private to this repository.</para> |
111 | 685 |
683
c838b3975bc6
Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents:
682
diff
changeset
|
686 <para id="x_334">A few revision control developers have pointed out that |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
687 this idea of making a complete private copy of a file is not |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
688 very efficient in its use of storage. While this is true, |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
689 storage is cheap, and this method gives the highest |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
690 performance while deferring most book-keeping to the operating |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
691 system. An alternative scheme would most likely reduce |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
692 performance and increase the complexity of the software, each |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
693 of which is much more important to the <quote>feel</quote> of |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
694 day-to-day use.</para> |
111 | 695 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
696 </sect2> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
697 <sect2> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
698 <title>Other contents of the dirstate</title> |
109
1b67dc96f27a
Snapshot of concepts chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
108
diff
changeset
|
699 |
683
c838b3975bc6
Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents:
682
diff
changeset
|
700 <para id="x_335">Because Mercurial doesn't force you to tell it when you're |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
701 modifying a file, it uses the dirstate to store some extra |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
702 information so it can determine efficiently whether you have |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
703 modified a file. For each file in the working directory, it |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
704 stores the time that it last modified the file itself, and the |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
705 size of the file at that time.</para> |
115
b74102b56df5
Wow! Lots more work detailing the working directory, merging, etc.
Bryan O'Sullivan <bos@serpentine.com>
parents:
113
diff
changeset
|
706 |
683
c838b3975bc6
Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents:
682
diff
changeset
|
707 <para id="x_336">When you explicitly <command role="hg-cmd">hg |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
708 add</command>, <command role="hg-cmd">hg remove</command>, |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
709 <command role="hg-cmd">hg rename</command> or <command |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
710 role="hg-cmd">hg copy</command> files, Mercurial updates the |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
711 dirstate so that it knows what to do with those files when you |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
712 commit.</para> |
115
b74102b56df5
Wow! Lots more work detailing the working directory, merging, etc.
Bryan O'Sullivan <bos@serpentine.com>
parents:
113
diff
changeset
|
713 |
683
c838b3975bc6
Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents:
682
diff
changeset
|
714 <para id="x_337">When Mercurial is checking the states of files in the |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
715 working directory, it first checks a file's modification time. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
716 If that has not changed, the file must not have been modified. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
717 If the file's size has changed, the file must have been |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
718 modified. If the modification time has changed, but the size |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
719 has not, only then does Mercurial need to read the actual |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
720 contents of the file to see if they've changed. Storing these |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
721 few extra pieces of information dramatically reduces the |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
722 amount of data that Mercurial needs to read, which yields |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
723 large performance improvements compared to other revision |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
724 control systems.</para> |
115
b74102b56df5
Wow! Lots more work detailing the working directory, merging, etc.
Bryan O'Sullivan <bos@serpentine.com>
parents:
113
diff
changeset
|
725 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
726 </sect2> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
727 </sect1> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
728 </chapter> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
729 |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
730 <!-- |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
731 local variables: |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
732 sgml-parent-document: ("00book.xml" "book" "chapter") |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
733 end: |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
734 --> |