Mercurial > hgbook
annotate en/ch03-tour-merge.xml @ 741:a4b71115602d
Typo fix
author | Dongsheng Song <dongsheng.song@gmail.com> |
---|---|
date | Tue, 17 Mar 2009 16:09:57 +0800 |
parents | a13813534ccd |
children | d0160b0b1a9e |
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 |
724
cfdb601a3c8b
Fix imagedata fileref in xml files, and replace ':' with '.' in id attribute
Dongsheng Song <dongsheng.song@gmail.com>
parents:
671
diff
changeset
|
3 <chapter id="chap.tour-merge"> |
671
13513d2a128d
Add sensible names to chapters.
Bryan O'Sullivan <bos@serpentine.com>
parents:
666
diff
changeset
|
4 <?dbhtml filename="a-tour-of-mercurial-merging-work.html"?> |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
5 <title>A tour of Mercurial: merging work</title> |
94 | 6 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
7 <para>We've now covered cloning a repository, making changes in a |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
8 repository, and pulling or pushing changes from one repository |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
9 into another. Our next step is <emphasis>merging</emphasis> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
10 changes from separate repositories.</para> |
94 | 11 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
12 <sect1> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
13 <title>Merging streams of work</title> |
95
47ea206351d5
Split tour into two sections.
Bryan O'Sullivan <bos@serpentine.com>
parents:
94
diff
changeset
|
14 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
15 <para>Merging is a fundamental part of working with a distributed |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
16 revision control tool.</para> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
17 <itemizedlist> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
18 <listitem><para>Alice and Bob each have a personal copy of a |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
19 repository for a project they're collaborating on. Alice |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
20 fixes a bug in her repository; Bob adds a new feature in |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
21 his. They want the shared repository to contain both the |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
22 bug fix and the new feature.</para> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
23 </listitem> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
24 <listitem><para>I frequently work on several different tasks for |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
25 a single project at once, each safely isolated in its own |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
26 repository. Working this way means that I often need to |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
27 merge one piece of my own work with another.</para> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
28 </listitem></itemizedlist> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
29 |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
30 <para>Because merging is such a common thing to need to do, |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
31 Mercurial makes it easy. Let's walk through the process. We'll |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
32 begin by cloning yet another repository (see how often they |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
33 spring up?) and making a change in it.</para> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
34 |
666
8fcd44708f41
Uncomment all the mangled interaction examples.
Bryan O'Sullivan <bos@serpentine.com>
parents:
658
diff
changeset
|
35 &interaction.tour.merge.clone; |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
36 |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
37 <para>We should now have two copies of |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
38 <filename>hello.c</filename> with different contents. The |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
39 histories of the two repositories have also diverged, as |
739
a13813534ccd
Fix all xref to figs
Dongsheng Song <dongsheng.song@gmail.com>
parents:
724
diff
changeset
|
40 illustrated in figure <xref endterm="fig.tour-merge.sep-repos.caption" |
724
cfdb601a3c8b
Fix imagedata fileref in xml files, and replace ':' with '.' in id attribute
Dongsheng Song <dongsheng.song@gmail.com>
parents:
671
diff
changeset
|
41 linkend="fig.tour-merge.sep-repos"/>.</para> |
94 | 42 |
666
8fcd44708f41
Uncomment all the mangled interaction examples.
Bryan O'Sullivan <bos@serpentine.com>
parents:
658
diff
changeset
|
43 &interaction.tour.merge.cat; |
94 | 44 |
724
cfdb601a3c8b
Fix imagedata fileref in xml files, and replace ':' with '.' in id attribute
Dongsheng Song <dongsheng.song@gmail.com>
parents:
671
diff
changeset
|
45 <informalfigure id="fig.tour-merge.sep-repos"> |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
46 <mediaobject> |
724
cfdb601a3c8b
Fix imagedata fileref in xml files, and replace ':' with '.' in id attribute
Dongsheng Song <dongsheng.song@gmail.com>
parents:
671
diff
changeset
|
47 <imageobject><imagedata fileref="images/tour-merge-sep-repos.png"/></imageobject> |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
48 <textobject><phrase>XXX add text</phrase></textobject> |
739
a13813534ccd
Fix all xref to figs
Dongsheng Song <dongsheng.song@gmail.com>
parents:
724
diff
changeset
|
49 <caption><para id="fig.tour-merge.sep-repos.caption">Divergent recent |
a13813534ccd
Fix all xref to figs
Dongsheng Song <dongsheng.song@gmail.com>
parents:
724
diff
changeset
|
50 histories of the <filename |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
51 class="directory">my-hello</filename> and <filename |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
52 class="directory">my-new-hello</filename> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
53 repositories</para></caption> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
54 </mediaobject> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
55 </informalfigure> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
56 |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
57 <para>We already know that pulling changes from our <filename |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
58 class="directory">my-hello</filename> repository will have no |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
59 effect on the working directory.</para> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
60 |
666
8fcd44708f41
Uncomment all the mangled interaction examples.
Bryan O'Sullivan <bos@serpentine.com>
parents:
658
diff
changeset
|
61 &interaction.tour.merge.pull; |
99 | 62 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
63 <para>However, the <command role="hg-cmd">hg pull</command> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
64 command says something about <quote>heads</quote>.</para> |
94 | 65 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
66 <sect2> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
67 <title>Head changesets</title> |
102 | 68 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
69 <para>A head is a change that has no descendants, or children, |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
70 as they're also known. The tip revision is thus a head, |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
71 because the newest revision in a repository doesn't have any |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
72 children, but a repository can contain more than one |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
73 head.</para> |
99 | 74 |
724
cfdb601a3c8b
Fix imagedata fileref in xml files, and replace ':' with '.' in id attribute
Dongsheng Song <dongsheng.song@gmail.com>
parents:
671
diff
changeset
|
75 <informalfigure id="fig.tour-merge.pull"> |
739
a13813534ccd
Fix all xref to figs
Dongsheng Song <dongsheng.song@gmail.com>
parents:
724
diff
changeset
|
76 <mediaobject> |
a13813534ccd
Fix all xref to figs
Dongsheng Song <dongsheng.song@gmail.com>
parents:
724
diff
changeset
|
77 <imageobject><imagedata fileref="images/tour-merge-pull.png"/></imageobject> |
a13813534ccd
Fix all xref to figs
Dongsheng Song <dongsheng.song@gmail.com>
parents:
724
diff
changeset
|
78 <textobject><phrase>XXX add text</phrase></textobject> |
a13813534ccd
Fix all xref to figs
Dongsheng Song <dongsheng.song@gmail.com>
parents:
724
diff
changeset
|
79 <caption><para id="fig.tour-merge.pull.caption">Repository contents after |
a13813534ccd
Fix all xref to figs
Dongsheng Song <dongsheng.song@gmail.com>
parents:
724
diff
changeset
|
80 pulling from <filename class="directory">my-hello</filename> into |
a13813534ccd
Fix all xref to figs
Dongsheng Song <dongsheng.song@gmail.com>
parents:
724
diff
changeset
|
81 <filename class="directory">my-new-hello</filename></para></caption> |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
82 </mediaobject> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
83 </informalfigure> |
99 | 84 |
739
a13813534ccd
Fix all xref to figs
Dongsheng Song <dongsheng.song@gmail.com>
parents:
724
diff
changeset
|
85 <para>In figure <xref endterm="fig.tour-merge.pull.caption" |
a13813534ccd
Fix all xref to figs
Dongsheng Song <dongsheng.song@gmail.com>
parents:
724
diff
changeset
|
86 linkend="fig.tour-merge.pull"/>, you can |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
87 see the effect of the pull from <filename |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
88 class="directory">my-hello</filename> into <filename |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
89 class="directory">my-new-hello</filename>. The history that |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
90 was already present in <filename |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
91 class="directory">my-new-hello</filename> is untouched, but |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
92 a new revision has been added. By referring to figure <xref |
739
a13813534ccd
Fix all xref to figs
Dongsheng Song <dongsheng.song@gmail.com>
parents:
724
diff
changeset
|
93 endterm="fig.tour-merge.sep-repos.caption" |
724
cfdb601a3c8b
Fix imagedata fileref in xml files, and replace ':' with '.' in id attribute
Dongsheng Song <dongsheng.song@gmail.com>
parents:
671
diff
changeset
|
94 linkend="fig.tour-merge.sep-repos"/>, we can see that the |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
95 <emphasis>changeset ID</emphasis> remains the same in the new |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
96 repository, but the <emphasis>revision number</emphasis> has |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
97 changed. (This, incidentally, is a fine example of why it's |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
98 not safe to use revision numbers when discussing changesets.) |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
99 We can view the heads in a repository using the <command |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
100 role="hg-cmd">hg heads</command> command.</para> |
102 | 101 |
666
8fcd44708f41
Uncomment all the mangled interaction examples.
Bryan O'Sullivan <bos@serpentine.com>
parents:
658
diff
changeset
|
102 &interaction.tour.merge.heads; |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
103 |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
104 </sect2> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
105 <sect2> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
106 <title>Performing the merge</title> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
107 |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
108 <para>What happens if we try to use the normal <command |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
109 role="hg-cmd">hg update</command> command to update to the |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
110 new tip?</para> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
111 |
666
8fcd44708f41
Uncomment all the mangled interaction examples.
Bryan O'Sullivan <bos@serpentine.com>
parents:
658
diff
changeset
|
112 &interaction.tour.merge.update; |
102 | 113 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
114 <para>Mercurial is telling us that 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
|
115 update</command> command won't do a merge; it won't update |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
116 the working directory when it thinks we might be wanting to do |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
117 a merge, unless we force it to do so. Instead, we use the |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
118 <command role="hg-cmd">hg merge</command> command to merge the |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
119 two heads.</para> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
120 |
666
8fcd44708f41
Uncomment all the mangled interaction examples.
Bryan O'Sullivan <bos@serpentine.com>
parents:
658
diff
changeset
|
121 &interaction.tour.merge.merge; |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
122 |
724
cfdb601a3c8b
Fix imagedata fileref in xml files, and replace ':' with '.' in id attribute
Dongsheng Song <dongsheng.song@gmail.com>
parents:
671
diff
changeset
|
123 <informalfigure id="fig.tour-merge.merge"> |
739
a13813534ccd
Fix all xref to figs
Dongsheng Song <dongsheng.song@gmail.com>
parents:
724
diff
changeset
|
124 <mediaobject> |
a13813534ccd
Fix all xref to figs
Dongsheng Song <dongsheng.song@gmail.com>
parents:
724
diff
changeset
|
125 <imageobject><imagedata fileref="images/tour-merge-merge.png"/></imageobject> |
a13813534ccd
Fix all xref to figs
Dongsheng Song <dongsheng.song@gmail.com>
parents:
724
diff
changeset
|
126 <textobject><phrase>XXX add text</phrase></textobject> |
a13813534ccd
Fix all xref to figs
Dongsheng Song <dongsheng.song@gmail.com>
parents:
724
diff
changeset
|
127 <caption><para id="fig.tour-merge.merge.caption">Working directory and |
a13813534ccd
Fix all xref to figs
Dongsheng Song <dongsheng.song@gmail.com>
parents:
724
diff
changeset
|
128 repository during merge, and following commit</para></caption> |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
129 </mediaobject> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
130 </informalfigure> |
100
272146fab009
Add yet another illustration of the merge process.
Bryan O'Sullivan <bos@serpentine.com>
parents:
99
diff
changeset
|
131 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
132 <para>This updates the working directory so that it contains |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
133 changes from <emphasis>both</emphasis> heads, which is |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
134 reflected in both the output of <command role="hg-cmd">hg |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
135 parents</command> and the contents of |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
136 <filename>hello.c</filename>.</para> |
102 | 137 |
666
8fcd44708f41
Uncomment all the mangled interaction examples.
Bryan O'Sullivan <bos@serpentine.com>
parents:
658
diff
changeset
|
138 &interaction.tour.merge.parents; |
102 | 139 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
140 </sect2> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
141 <sect2> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
142 <title>Committing the results of the merge</title> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
143 |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
144 <para>Whenever we've done a merge, <command role="hg-cmd">hg |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
145 parents</command> will display two parents until we <command |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
146 role="hg-cmd">hg commit</command> the results of the |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
147 merge.</para> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
148 |
666
8fcd44708f41
Uncomment all the mangled interaction examples.
Bryan O'Sullivan <bos@serpentine.com>
parents:
658
diff
changeset
|
149 &interaction.tour.merge.commit; |
94 | 150 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
151 <para>We now have a new tip revision; notice that it has |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
152 <emphasis>both</emphasis> of our former heads as its parents. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
153 These are the same revisions that were previously displayed by |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
154 <command role="hg-cmd">hg parents</command>.</para> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
155 |
666
8fcd44708f41
Uncomment all the mangled interaction examples.
Bryan O'Sullivan <bos@serpentine.com>
parents:
658
diff
changeset
|
156 &interaction.tour.merge.tip; |
102 | 157 |
739
a13813534ccd
Fix all xref to figs
Dongsheng Song <dongsheng.song@gmail.com>
parents:
724
diff
changeset
|
158 <para>In figure <xref endterm="fig.tour-merge.merge.caption" |
724
cfdb601a3c8b
Fix imagedata fileref in xml files, and replace ':' with '.' in id attribute
Dongsheng Song <dongsheng.song@gmail.com>
parents:
671
diff
changeset
|
159 linkend="fig.tour-merge.merge"/>, you can see a |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
160 representation of what happens to the working directory during |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
161 the merge, and how this affects the repository when the commit |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
162 happens. During the merge, the working directory has two |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
163 parent changesets, and these become the parents of the new |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
164 changeset.</para> |
103 | 165 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
166 </sect2> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
167 </sect1> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
168 <sect1> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
169 <title>Merging conflicting changes</title> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
170 |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
171 <para>Most merges are simple affairs, but sometimes you'll find |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
172 yourself merging changes where each modifies the same portions |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
173 of the same files. Unless both modifications are identical, |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
174 this results in a <emphasis>conflict</emphasis>, where you have |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
175 to decide how to reconcile the different changes into something |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
176 coherent.</para> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
177 |
739
a13813534ccd
Fix all xref to figs
Dongsheng Song <dongsheng.song@gmail.com>
parents:
724
diff
changeset
|
178 <informalfigure id="fig.tour-merge.conflict"> |
a13813534ccd
Fix all xref to figs
Dongsheng Song <dongsheng.song@gmail.com>
parents:
724
diff
changeset
|
179 <mediaobject> |
a13813534ccd
Fix all xref to figs
Dongsheng Song <dongsheng.song@gmail.com>
parents:
724
diff
changeset
|
180 <imageobject><imagedata fileref="images/tour-merge-conflict.png"/> |
a13813534ccd
Fix all xref to figs
Dongsheng Song <dongsheng.song@gmail.com>
parents:
724
diff
changeset
|
181 </imageobject> |
a13813534ccd
Fix all xref to figs
Dongsheng Song <dongsheng.song@gmail.com>
parents:
724
diff
changeset
|
182 <textobject><phrase>XXX add text</phrase></textobject> |
a13813534ccd
Fix all xref to figs
Dongsheng Song <dongsheng.song@gmail.com>
parents:
724
diff
changeset
|
183 <caption><para id="fig.tour-merge.conflict.caption">Conflicting |
a13813534ccd
Fix all xref to figs
Dongsheng Song <dongsheng.song@gmail.com>
parents:
724
diff
changeset
|
184 changes to a document</para></caption> |
a13813534ccd
Fix all xref to figs
Dongsheng Song <dongsheng.song@gmail.com>
parents:
724
diff
changeset
|
185 </mediaobject> |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
186 </informalfigure> |
103 | 187 |
739
a13813534ccd
Fix all xref to figs
Dongsheng Song <dongsheng.song@gmail.com>
parents:
724
diff
changeset
|
188 <para>Figure <xref endterm="fig.tour-merge.conflict.caption" |
a13813534ccd
Fix all xref to figs
Dongsheng Song <dongsheng.song@gmail.com>
parents:
724
diff
changeset
|
189 linkend="fig.tour-merge.conflict"/> illustrates |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
190 an instance of two conflicting changes to a document. We |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
191 started with a single version of the file; then we made some |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
192 changes; while someone else made different changes to the same |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
193 text. Our task in resolving the conflicting changes is to |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
194 decide what the file should look like.</para> |
103 | 195 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
196 <para>Mercurial doesn't have a built-in facility for handling |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
197 conflicts. Instead, it runs an external program called |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
198 <command>hgmerge</command>. This is a shell script that is |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
199 bundled with Mercurial; you can change it to behave however you |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
200 please. What it does by default is try to find one of several |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
201 different merging tools that are likely to be installed on your |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
202 system. It first tries a few fully automatic merging tools; if |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
203 these don't succeed (because the resolution process requires |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
204 human guidance) or aren't present, the script tries a few |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
205 different graphical merging tools.</para> |
103 | 206 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
207 <para>It's also possible to get Mercurial to run another program |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
208 or script instead of <command>hgmerge</command>, by setting the |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
209 <envar>HGMERGE</envar> environment variable to the name of your |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
210 preferred program.</para> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
211 |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
212 <sect2> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
213 <title>Using a graphical merge tool</title> |
103 | 214 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
215 <para>My preferred graphical merge tool is |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
216 <command>kdiff3</command>, which I'll use to describe the |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
217 features that are common to graphical file merging tools. You |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
218 can see a screenshot of <command>kdiff3</command> in action in |
739
a13813534ccd
Fix all xref to figs
Dongsheng Song <dongsheng.song@gmail.com>
parents:
724
diff
changeset
|
219 figure <xref endterm="fig.tour-merge.kdiff3.caption" |
a13813534ccd
Fix all xref to figs
Dongsheng Song <dongsheng.song@gmail.com>
parents:
724
diff
changeset
|
220 linkend="fig.tour-merge.kdiff3"/>. The kind of |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
221 merge it is performing is called a <emphasis>three-way |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
222 merge</emphasis>, because there are three different versions |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
223 of the file of interest to us. The tool thus splits the upper |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
224 portion of the window into three panes:</para> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
225 <itemizedlist> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
226 <listitem><para>At the left is the <emphasis>base</emphasis> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
227 version of the file, i.e. the most recent version from |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
228 which the two versions we're trying to merge are |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
229 descended.</para> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
230 </listitem> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
231 <listitem><para>In the middle is <quote>our</quote> version of |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
232 the file, with the contents that we modified.</para> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
233 </listitem> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
234 <listitem><para>On the right is <quote>their</quote> version |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
235 of the file, the one that from the changeset that we're |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
236 trying to merge with.</para> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
237 </listitem></itemizedlist> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
238 <para>In the pane below these is the current |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
239 <emphasis>result</emphasis> of the merge. Our task is to |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
240 replace all of the red text, which indicates unresolved |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
241 conflicts, with some sensible merger of the |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
242 <quote>ours</quote> and <quote>theirs</quote> versions of the |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
243 file.</para> |
102 | 244 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
245 <para>All four of these panes are <emphasis>locked |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
246 together</emphasis>; if we scroll vertically or horizontally |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
247 in any of them, the others are updated to display the |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
248 corresponding sections of their respective files.</para> |
103 | 249 |
724
cfdb601a3c8b
Fix imagedata fileref in xml files, and replace ':' with '.' in id attribute
Dongsheng Song <dongsheng.song@gmail.com>
parents:
671
diff
changeset
|
250 <informalfigure id="fig.tour-merge.kdiff3"> |
739
a13813534ccd
Fix all xref to figs
Dongsheng Song <dongsheng.song@gmail.com>
parents:
724
diff
changeset
|
251 <mediaobject> |
a13813534ccd
Fix all xref to figs
Dongsheng Song <dongsheng.song@gmail.com>
parents:
724
diff
changeset
|
252 <imageobject><imagedata width="100%" fileref="images/kdiff3.png"/> |
a13813534ccd
Fix all xref to figs
Dongsheng Song <dongsheng.song@gmail.com>
parents:
724
diff
changeset
|
253 </imageobject> |
a13813534ccd
Fix all xref to figs
Dongsheng Song <dongsheng.song@gmail.com>
parents:
724
diff
changeset
|
254 <textobject><phrase>XXX add text</phrase></textobject> |
a13813534ccd
Fix all xref to figs
Dongsheng Song <dongsheng.song@gmail.com>
parents:
724
diff
changeset
|
255 <caption><para id="fig.tour-merge.kdiff3.caption">Using |
a13813534ccd
Fix all xref to figs
Dongsheng Song <dongsheng.song@gmail.com>
parents:
724
diff
changeset
|
256 <command>kdiff3</command> to merge versions of a file</para> |
a13813534ccd
Fix all xref to figs
Dongsheng Song <dongsheng.song@gmail.com>
parents:
724
diff
changeset
|
257 </caption> |
a13813534ccd
Fix all xref to figs
Dongsheng Song <dongsheng.song@gmail.com>
parents:
724
diff
changeset
|
258 </mediaobject> |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
259 </informalfigure> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
260 |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
261 <para>For each conflicting portion of the file, we can choose to |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
262 resolve the conflict using some combination of text from the |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
263 base version, ours, or theirs. We can also manually edit the |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
264 merged file at any time, in case we need to make further |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
265 modifications.</para> |
103 | 266 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
267 <para>There are <emphasis>many</emphasis> file merging tools |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
268 available, too many to cover here. They vary in which |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
269 platforms they are available for, and in their particular |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
270 strengths and weaknesses. Most are tuned for merging files |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
271 containing plain text, while a few are aimed at specialised |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
272 file formats (generally XML).</para> |
103 | 273 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
274 </sect2> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
275 <sect2> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
276 <title>A worked example</title> |
103 | 277 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
278 <para>In this example, we will reproduce the file modification |
739
a13813534ccd
Fix all xref to figs
Dongsheng Song <dongsheng.song@gmail.com>
parents:
724
diff
changeset
|
279 history of figure <xref endterm="fig.tour-merge.conflict.caption" |
a13813534ccd
Fix all xref to figs
Dongsheng Song <dongsheng.song@gmail.com>
parents:
724
diff
changeset
|
280 linkend="fig.tour-merge.conflict"/> |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
281 above. Let's begin by creating a repository with a base |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
282 version of our document.</para> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
283 |
666
8fcd44708f41
Uncomment all the mangled interaction examples.
Bryan O'Sullivan <bos@serpentine.com>
parents:
658
diff
changeset
|
284 &interaction.tour-merge-conflict.wife; |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
285 |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
286 <para>We'll clone the repository and make a change to the |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
287 file.</para> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
288 |
666
8fcd44708f41
Uncomment all the mangled interaction examples.
Bryan O'Sullivan <bos@serpentine.com>
parents:
658
diff
changeset
|
289 &interaction.tour-merge-conflict.cousin; |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
290 |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
291 <para>And another clone, to simulate someone else making a |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
292 change to the file. (This hints at the idea that it's not all |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
293 that unusual to merge with yourself when you isolate tasks in |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
294 separate repositories, and indeed to find and resolve |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
295 conflicts while doing so.)</para> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
296 |
666
8fcd44708f41
Uncomment all the mangled interaction examples.
Bryan O'Sullivan <bos@serpentine.com>
parents:
658
diff
changeset
|
297 &interaction.tour-merge-conflict.son; |
103 | 298 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
299 <para>Having created two |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
300 different versions of the file, we'll set up an environment |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
301 suitable for running our merge.</para> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
302 |
666
8fcd44708f41
Uncomment all the mangled interaction examples.
Bryan O'Sullivan <bos@serpentine.com>
parents:
658
diff
changeset
|
303 &interaction.tour-merge-conflict.pull; |
649
5cd47f721686
Rename LaTeX input files to have numeric prefixes
Bryan O'Sullivan <bos@serpentine.com>
parents:
481
diff
changeset
|
304 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
305 <para>In this example, I won't use Mercurial's normal |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
306 <command>hgmerge</command> program to do the merge, because it |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
307 would drop my nice automated example-running tool into a |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
308 graphical user interface. Instead, I'll set |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
309 <envar>HGMERGE</envar> to tell Mercurial to use the |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
310 non-interactive <command>merge</command> command. This is |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
311 bundled with many Unix-like systems. If you're following this |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
312 example on your computer, don't bother setting |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
313 <envar>HGMERGE</envar>.</para> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
314 |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
315 <para><emphasis role="bold">XXX FIX THIS |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
316 EXAMPLE.</emphasis></para> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
317 |
666
8fcd44708f41
Uncomment all the mangled interaction examples.
Bryan O'Sullivan <bos@serpentine.com>
parents:
658
diff
changeset
|
318 &interaction.tour-merge-conflict.merge; |
649
5cd47f721686
Rename LaTeX input files to have numeric prefixes
Bryan O'Sullivan <bos@serpentine.com>
parents:
481
diff
changeset
|
319 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
320 <para>Because <command>merge</command> can't resolve the |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
321 conflicting changes, it leaves <emphasis>merge |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
322 markers</emphasis> inside the file that has conflicts, |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
323 indicating which lines have conflicts, and whether they came |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
324 from our version of the file or theirs.</para> |
103 | 325 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
326 <para>Mercurial can tell from the way <command>merge</command> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
327 exits that it wasn't able to merge successfully, so it tells |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
328 us what commands we'll need to run if we want to redo the |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
329 merging operation. This could be useful if, for example, we |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
330 were running a graphical merge tool and quit because we were |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
331 confused or realised we had made a mistake.</para> |
103 | 332 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
333 <para>If automatic or manual merges fail, there's nothing to |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
334 prevent us from <quote>fixing up</quote> the affected files |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
335 ourselves, and committing the results of our merge:</para> |
103 | 336 |
666
8fcd44708f41
Uncomment all the mangled interaction examples.
Bryan O'Sullivan <bos@serpentine.com>
parents:
658
diff
changeset
|
337 &interaction.tour-merge-conflict.commit; |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
338 |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
339 </sect2> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
340 </sect1> |
724
cfdb601a3c8b
Fix imagedata fileref in xml files, and replace ':' with '.' in id attribute
Dongsheng Song <dongsheng.song@gmail.com>
parents:
671
diff
changeset
|
341 <sect1 id="sec.tour-merge.fetch"> |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
342 <title>Simplifying the pull-merge-commit sequence</title> |
102 | 343 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
344 <para>The process of merging changes as outlined above is |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
345 straightforward, but requires running three commands in |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
346 sequence.</para> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
347 <programlisting> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
348 hg pull hg merge hg commit -m 'Merged remote changes' |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
349 </programlisting> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
350 <para>In the case of the final commit, you also need to enter a |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
351 commit message, which is almost always going to be a piece of |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
352 uninteresting <quote>boilerplate</quote> text.</para> |
102 | 353 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
354 <para>It would be nice to reduce the number of steps needed, if |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
355 this were possible. Indeed, Mercurial is distributed with an |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
356 extension called <literal role="hg-ext">fetch</literal> that |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
357 does just this.</para> |
102 | 358 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
359 <para>Mercurial provides a flexible extension mechanism that lets |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
360 people extend its functionality, while keeping the core of |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
361 Mercurial small and easy to deal with. Some extensions add new |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
362 commands that you can use from the command line, while others |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
363 work <quote>behind the scenes,</quote> for example adding |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
364 capabilities to the server.</para> |
102 | 365 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
366 <para>The <literal role="hg-ext">fetch</literal> extension adds a |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
367 new command called, not surprisingly, <command role="hg-cmd">hg |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
368 fetch</command>. This extension acts as a combination of |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
369 <command role="hg-cmd">hg pull</command>, <command |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
370 role="hg-cmd">hg update</command> and <command |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
371 role="hg-cmd">hg merge</command>. It begins by pulling |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
372 changes from another repository into the current repository. If |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
373 it finds that the changes added a new head to the repository, it |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
374 begins a merge, then commits the result of the merge with an |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
375 automatically-generated commit message. If no new heads were |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
376 added, it updates the working directory to the new tip |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
377 changeset.</para> |
102 | 378 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
379 <para>Enabling the <literal role="hg-ext">fetch</literal> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
380 extension is easy. Edit your <filename |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
381 role="special">.hgrc</filename>, and either go to the <literal |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
382 role="rc-extensions">extensions</literal> section or create an |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
383 <literal role="rc-extensions">extensions</literal> section. Then |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
384 add a line that simply reads <quote><literal>fetch |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
385 </literal></quote>.</para> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
386 <programlisting> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
387 [extensions] fetch = |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
388 </programlisting> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
389 <para>(Normally, on the right-hand side of the |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
390 <quote><literal>=</literal></quote> would appear the location of |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
391 the extension, but since the <literal |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
392 role="hg-ext">fetch</literal> extension is in the standard |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
393 distribution, Mercurial knows where to search for it.)</para> |
102 | 394 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
395 </sect1> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
396 </chapter> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
397 |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
398 <!-- |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
399 local variables: |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
400 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
|
401 end: |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
650
diff
changeset
|
402 --> |