comparison en/ch03-tour-merge.xml @ 739:a13813534ccd

Fix all xref to figs
author Dongsheng Song <dongsheng.song@gmail.com>
date Tue, 17 Mar 2009 10:43:45 +0800
parents cfdb601a3c8b
children d0160b0b1a9e
comparison
equal deleted inserted replaced
738:1a3d882149fd 739:a13813534ccd
35 &interaction.tour.merge.clone; 35 &interaction.tour.merge.clone;
36 36
37 <para>We should now have two copies of 37 <para>We should now have two copies of
38 <filename>hello.c</filename> with different contents. The 38 <filename>hello.c</filename> with different contents. The
39 histories of the two repositories have also diverged, as 39 histories of the two repositories have also diverged, as
40 illustrated in figure <xref 40 illustrated in figure <xref endterm="fig.tour-merge.sep-repos.caption"
41 linkend="fig.tour-merge.sep-repos"/>.</para> 41 linkend="fig.tour-merge.sep-repos"/>.</para>
42 42
43 &interaction.tour.merge.cat; 43 &interaction.tour.merge.cat;
44 44
45 <informalfigure id="fig.tour-merge.sep-repos"> 45 <informalfigure id="fig.tour-merge.sep-repos">
46 <mediaobject> 46 <mediaobject>
47 <imageobject><imagedata fileref="images/tour-merge-sep-repos.png"/></imageobject> 47 <imageobject><imagedata fileref="images/tour-merge-sep-repos.png"/></imageobject>
48 <textobject><phrase>XXX add text</phrase></textobject> 48 <textobject><phrase>XXX add text</phrase></textobject>
49 <caption><para>Divergent recent histories of the <filename 49 <caption><para id="fig.tour-merge.sep-repos.caption">Divergent recent
50 histories of the <filename
50 class="directory">my-hello</filename> and <filename 51 class="directory">my-hello</filename> and <filename
51 class="directory">my-new-hello</filename> 52 class="directory">my-new-hello</filename>
52 repositories</para></caption> 53 repositories</para></caption>
53 </mediaobject> 54 </mediaobject>
54 </informalfigure> 55 </informalfigure>
70 because the newest revision in a repository doesn't have any 71 because the newest revision in a repository doesn't have any
71 children, but a repository can contain more than one 72 children, but a repository can contain more than one
72 head.</para> 73 head.</para>
73 74
74 <informalfigure id="fig.tour-merge.pull"> 75 <informalfigure id="fig.tour-merge.pull">
75 <mediaobject><imageobject><imagedata 76 <mediaobject>
76 fileref="images/tour-merge-pull.png"/></imageobject><textobject><phrase>XXX 77 <imageobject><imagedata fileref="images/tour-merge-pull.png"/></imageobject>
77 add text</phrase></textobject> 78 <textobject><phrase>XXX add text</phrase></textobject>
78 <caption><para>Repository contents after pulling from 79 <caption><para id="fig.tour-merge.pull.caption">Repository contents after
79 <filename class="directory">my-hello</filename> into 80 pulling from <filename class="directory">my-hello</filename> into
80 <filename 81 <filename class="directory">my-new-hello</filename></para></caption>
81 class="directory">my-new-hello</filename></para></caption>
82 </mediaobject> 82 </mediaobject>
83 </informalfigure> 83 </informalfigure>
84 84
85 <para>In figure <xref linkend="fig.tour-merge.pull"/>, you can 85 <para>In figure <xref endterm="fig.tour-merge.pull.caption"
86 linkend="fig.tour-merge.pull"/>, you can
86 see the effect of the pull from <filename 87 see the effect of the pull from <filename
87 class="directory">my-hello</filename> into <filename 88 class="directory">my-hello</filename> into <filename
88 class="directory">my-new-hello</filename>. The history that 89 class="directory">my-new-hello</filename>. The history that
89 was already present in <filename 90 was already present in <filename
90 class="directory">my-new-hello</filename> is untouched, but 91 class="directory">my-new-hello</filename> is untouched, but
91 a new revision has been added. By referring to figure <xref 92 a new revision has been added. By referring to figure <xref
93 endterm="fig.tour-merge.sep-repos.caption"
92 linkend="fig.tour-merge.sep-repos"/>, we can see that the 94 linkend="fig.tour-merge.sep-repos"/>, we can see that the
93 <emphasis>changeset ID</emphasis> remains the same in the new 95 <emphasis>changeset ID</emphasis> remains the same in the new
94 repository, but the <emphasis>revision number</emphasis> has 96 repository, but the <emphasis>revision number</emphasis> has
95 changed. (This, incidentally, is a fine example of why it's 97 changed. (This, incidentally, is a fine example of why it's
96 not safe to use revision numbers when discussing changesets.) 98 not safe to use revision numbers when discussing changesets.)
117 two heads.</para> 119 two heads.</para>
118 120
119 &interaction.tour.merge.merge; 121 &interaction.tour.merge.merge;
120 122
121 <informalfigure id="fig.tour-merge.merge"> 123 <informalfigure id="fig.tour-merge.merge">
122 124 <mediaobject>
123 <mediaobject><imageobject><imagedata 125 <imageobject><imagedata fileref="images/tour-merge-merge.png"/></imageobject>
124 fileref="images/tour-merge-merge.png"/></imageobject><textobject><phrase>XXX 126 <textobject><phrase>XXX add text</phrase></textobject>
125 add text</phrase></textobject> 127 <caption><para id="fig.tour-merge.merge.caption">Working directory and
126 <caption><para>Working directory and repository during 128 repository during merge, and following commit</para></caption>
127 merge, and following commit</para></caption>
128 </mediaobject> 129 </mediaobject>
129 </informalfigure> 130 </informalfigure>
130 131
131 <para>This updates the working directory so that it contains 132 <para>This updates the working directory so that it contains
132 changes from <emphasis>both</emphasis> heads, which is 133 changes from <emphasis>both</emphasis> heads, which is
152 These are the same revisions that were previously displayed by 153 These are the same revisions that were previously displayed by
153 <command role="hg-cmd">hg parents</command>.</para> 154 <command role="hg-cmd">hg parents</command>.</para>
154 155
155 &interaction.tour.merge.tip; 156 &interaction.tour.merge.tip;
156 157
157 <para>In figure <xref 158 <para>In figure <xref endterm="fig.tour-merge.merge.caption"
158 linkend="fig.tour-merge.merge"/>, you can see a 159 linkend="fig.tour-merge.merge"/>, you can see a
159 representation of what happens to the working directory during 160 representation of what happens to the working directory during
160 the merge, and how this affects the repository when the commit 161 the merge, and how this affects the repository when the commit
161 happens. During the merge, the working directory has two 162 happens. During the merge, the working directory has two
162 parent changesets, and these become the parents of the new 163 parent changesets, and these become the parents of the new
172 of the same files. Unless both modifications are identical, 173 of the same files. Unless both modifications are identical,
173 this results in a <emphasis>conflict</emphasis>, where you have 174 this results in a <emphasis>conflict</emphasis>, where you have
174 to decide how to reconcile the different changes into something 175 to decide how to reconcile the different changes into something
175 coherent.</para> 176 coherent.</para>
176 177
177 <informalfigure> 178 <informalfigure id="fig.tour-merge.conflict">
178 179 <mediaobject>
179 <mediaobject id="fig.tour-merge.conflict"> 180 <imageobject><imagedata fileref="images/tour-merge-conflict.png"/>
180 <imageobject><imagedata fileref="images/tour-merge-conflict.png"/></imageobject> 181 </imageobject>
181 <textobject><phrase>XXX add text</phrase></textobject> 182 <textobject><phrase>XXX add text</phrase></textobject>
182 <caption><para>Conflicting changes to a 183 <caption><para id="fig.tour-merge.conflict.caption">Conflicting
183 document</para></caption> </mediaobject> 184 changes to a document</para></caption>
185 </mediaobject>
184 </informalfigure> 186 </informalfigure>
185 187
186 <para>Figure <xref linkend="fig.tour-merge.conflict"/> illustrates 188 <para>Figure <xref endterm="fig.tour-merge.conflict.caption"
189 linkend="fig.tour-merge.conflict"/> illustrates
187 an instance of two conflicting changes to a document. We 190 an instance of two conflicting changes to a document. We
188 started with a single version of the file; then we made some 191 started with a single version of the file; then we made some
189 changes; while someone else made different changes to the same 192 changes; while someone else made different changes to the same
190 text. Our task in resolving the conflicting changes is to 193 text. Our task in resolving the conflicting changes is to
191 decide what the file should look like.</para> 194 decide what the file should look like.</para>
211 214
212 <para>My preferred graphical merge tool is 215 <para>My preferred graphical merge tool is
213 <command>kdiff3</command>, which I'll use to describe the 216 <command>kdiff3</command>, which I'll use to describe the
214 features that are common to graphical file merging tools. You 217 features that are common to graphical file merging tools. You
215 can see a screenshot of <command>kdiff3</command> in action in 218 can see a screenshot of <command>kdiff3</command> in action in
216 figure <xref linkend="fig.tour-merge.kdiff3"/>. The kind of 219 figure <xref endterm="fig.tour-merge.kdiff3.caption"
220 linkend="fig.tour-merge.kdiff3"/>. The kind of
217 merge it is performing is called a <emphasis>three-way 221 merge it is performing is called a <emphasis>three-way
218 merge</emphasis>, because there are three different versions 222 merge</emphasis>, because there are three different versions
219 of the file of interest to us. The tool thus splits the upper 223 of the file of interest to us. The tool thus splits the upper
220 portion of the window into three panes:</para> 224 portion of the window into three panes:</para>
221 <itemizedlist> 225 <itemizedlist>
242 together</emphasis>; if we scroll vertically or horizontally 246 together</emphasis>; if we scroll vertically or horizontally
243 in any of them, the others are updated to display the 247 in any of them, the others are updated to display the
244 corresponding sections of their respective files.</para> 248 corresponding sections of their respective files.</para>
245 249
246 <informalfigure id="fig.tour-merge.kdiff3"> 250 <informalfigure id="fig.tour-merge.kdiff3">
247 <mediaobject><imageobject><imagedata width="100%" 251 <mediaobject>
248 fileref="images/kdiff3.png"/></imageobject><textobject><phrase>XXX 252 <imageobject><imagedata width="100%" fileref="images/kdiff3.png"/>
249 add text</phrase></textobject> 253 </imageobject>
250 <caption><para>Using <command>kdiff3</command> to merge 254 <textobject><phrase>XXX add text</phrase></textobject>
251 versions of a file</para></caption> 255 <caption><para id="fig.tour-merge.kdiff3.caption">Using
252 </mediaobject> 256 <command>kdiff3</command> to merge versions of a file</para>
257 </caption>
258 </mediaobject>
253 </informalfigure> 259 </informalfigure>
254 260
255 <para>For each conflicting portion of the file, we can choose to 261 <para>For each conflicting portion of the file, we can choose to
256 resolve the conflict using some combination of text from the 262 resolve the conflict using some combination of text from the
257 base version, ours, or theirs. We can also manually edit the 263 base version, ours, or theirs. We can also manually edit the
268 </sect2> 274 </sect2>
269 <sect2> 275 <sect2>
270 <title>A worked example</title> 276 <title>A worked example</title>
271 277
272 <para>In this example, we will reproduce the file modification 278 <para>In this example, we will reproduce the file modification
273 history of figure <xref linkend="fig.tour-merge.conflict"/> 279 history of figure <xref endterm="fig.tour-merge.conflict.caption"
280 linkend="fig.tour-merge.conflict"/>
274 above. Let's begin by creating a repository with a base 281 above. Let's begin by creating a repository with a base
275 version of our document.</para> 282 version of our document.</para>
276 283
277 &interaction.tour-merge-conflict.wife; 284 &interaction.tour-merge-conflict.wife;
278 285