annotate en/ch04-daily.xml @ 828:477d6a3e5023

Many final changes.
author Bryan O'Sullivan <bos@serpentine.com>
date Mon, 04 May 2009 23:52:38 -0700
parents 6b7818eb3d8e
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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 : -->
42
cbfa08bcf181 Start the "Mercurial in daily use" chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
2
812
6b7818eb3d8e Fix bogons
Bryan O'Sullivan <bos@serpentine.com>
parents: 811
diff changeset
3 <chapter id="chap:daily">
671
13513d2a128d Add sensible names to chapters.
Bryan O'Sullivan <bos@serpentine.com>
parents: 666
diff changeset
4 <?dbhtml filename="mercurial-in-daily-use.html"?>
658
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
5 <title>Mercurial in daily use</title>
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
6
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
7 <sect1>
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
8 <title>Telling Mercurial which files to track</title>
42
cbfa08bcf181 Start the "Mercurial in daily use" chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
9
683
c838b3975bc6 Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents: 682
diff changeset
10 <para id="x_1a3">Mercurial does not work with files in your repository unless
658
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
11 you tell it to manage them. 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
12 status</command> command will tell you which files Mercurial
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
13 doesn't know about; it uses a
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
14 <quote><literal>?</literal></quote> to display such
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
15 files.</para>
42
cbfa08bcf181 Start the "Mercurial in daily use" chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
16
683
c838b3975bc6 Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents: 682
diff changeset
17 <para id="x_1a4">To tell Mercurial to track a file, use the <command
658
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
18 role="hg-cmd">hg add</command> command. Once you have added a
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
19 file, the entry in 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
20 status</command> for that file changes from
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
21 <quote><literal>?</literal></quote> to
666
8fcd44708f41 Uncomment all the mangled interaction examples.
Bryan O'Sullivan <bos@serpentine.com>
parents: 658
diff changeset
22 <quote><literal>A</literal></quote>.</para>
8fcd44708f41 Uncomment all the mangled interaction examples.
Bryan O'Sullivan <bos@serpentine.com>
parents: 658
diff changeset
23
8fcd44708f41 Uncomment all the mangled interaction examples.
Bryan O'Sullivan <bos@serpentine.com>
parents: 658
diff changeset
24 &interaction.daily.files.add;
42
cbfa08bcf181 Start the "Mercurial in daily use" chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
25
683
c838b3975bc6 Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents: 682
diff changeset
26 <para id="x_1a5">After you run a <command role="hg-cmd">hg commit</command>,
658
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
27 the files that you added before the commit will no longer be
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
28 listed in the output of <command role="hg-cmd">hg
773
3b640272a966 Progres on resolve
Bryan O'Sullivan <bos@serpentine.com>
parents: 771
diff changeset
29 status</command>. The reason for this is that by default, <command
658
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
30 role="hg-cmd">hg status</command> only tells you about
773
3b640272a966 Progres on resolve
Bryan O'Sullivan <bos@serpentine.com>
parents: 771
diff changeset
31 <quote>interesting</quote> files&emdash;those that you have (for
3b640272a966 Progres on resolve
Bryan O'Sullivan <bos@serpentine.com>
parents: 771
diff changeset
32 example) modified, removed, or renamed. If you have a repository
3b640272a966 Progres on resolve
Bryan O'Sullivan <bos@serpentine.com>
parents: 771
diff changeset
33 that contains thousands of files, you will rarely want to know
3b640272a966 Progres on resolve
Bryan O'Sullivan <bos@serpentine.com>
parents: 771
diff changeset
34 about files that Mercurial is tracking, but that have not
3b640272a966 Progres on resolve
Bryan O'Sullivan <bos@serpentine.com>
parents: 771
diff changeset
35 changed. (You can still get this information; we'll return to
3b640272a966 Progres on resolve
Bryan O'Sullivan <bos@serpentine.com>
parents: 771
diff changeset
36 this later.)</para>
117
6b0f4498569e Beef up daily routine material. Focus on merge-across-copy.
Bryan O'Sullivan <bos@serpentine.com>
parents: 43
diff changeset
37
683
c838b3975bc6 Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents: 682
diff changeset
38 <para id="x_1a6">Once you add a file, Mercurial doesn't do anything with it
658
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
39 immediately. Instead, it will take a snapshot of the file's
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
40 state the next time you perform a commit. It will then continue
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
41 to track the changes you make to the file every time you commit,
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
42 until you remove the file.</para>
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
43
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
44 <sect2>
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
45 <title>Explicit versus implicit file naming</title>
42
cbfa08bcf181 Start the "Mercurial in daily use" chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
46
771
b338f5490029 Americanize spellings :-(
Bryan O'Sullivan <bos@serpentine.com>
parents: 753
diff changeset
47 <para id="x_1a7">A useful behavior that Mercurial has is that if you pass
658
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
48 the name of a directory to a command, every Mercurial command
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
49 will treat this as <quote>I want to operate on every file in
666
8fcd44708f41 Uncomment all the mangled interaction examples.
Bryan O'Sullivan <bos@serpentine.com>
parents: 658
diff changeset
50 this directory and its subdirectories</quote>.</para>
8fcd44708f41 Uncomment all the mangled interaction examples.
Bryan O'Sullivan <bos@serpentine.com>
parents: 658
diff changeset
51
8fcd44708f41 Uncomment all the mangled interaction examples.
Bryan O'Sullivan <bos@serpentine.com>
parents: 658
diff changeset
52 &interaction.daily.files.add-dir;
8fcd44708f41 Uncomment all the mangled interaction examples.
Bryan O'Sullivan <bos@serpentine.com>
parents: 658
diff changeset
53
773
3b640272a966 Progres on resolve
Bryan O'Sullivan <bos@serpentine.com>
parents: 771
diff changeset
54 <para id="x_1a8">Notice in this example that Mercurial printed
3b640272a966 Progres on resolve
Bryan O'Sullivan <bos@serpentine.com>
parents: 771
diff changeset
55 the names of the files it added, whereas it didn't do so when
3b640272a966 Progres on resolve
Bryan O'Sullivan <bos@serpentine.com>
parents: 771
diff changeset
56 we added the file named <filename>myfile.txt</filename> in the
3b640272a966 Progres on resolve
Bryan O'Sullivan <bos@serpentine.com>
parents: 771
diff changeset
57 earlier example.</para>
117
6b0f4498569e Beef up daily routine material. Focus on merge-across-copy.
Bryan O'Sullivan <bos@serpentine.com>
parents: 43
diff changeset
58
683
c838b3975bc6 Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents: 682
diff changeset
59 <para id="x_1a9">What's going on is that in the former case, we explicitly
773
3b640272a966 Progres on resolve
Bryan O'Sullivan <bos@serpentine.com>
parents: 771
diff changeset
60 named the file to add on the command line. The assumption
3b640272a966 Progres on resolve
Bryan O'Sullivan <bos@serpentine.com>
parents: 771
diff changeset
61 that Mercurial makes in such cases is that we know what we
3b640272a966 Progres on resolve
Bryan O'Sullivan <bos@serpentine.com>
parents: 771
diff changeset
62 are doing, and it doesn't print any output.</para>
117
6b0f4498569e Beef up daily routine material. Focus on merge-across-copy.
Bryan O'Sullivan <bos@serpentine.com>
parents: 43
diff changeset
63
683
c838b3975bc6 Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents: 682
diff changeset
64 <para id="x_1aa">However, when we <emphasis>imply</emphasis> the names of
658
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
65 files by giving the name of a directory, Mercurial takes the
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
66 extra step of printing the name of each file that it does
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
67 something with. This makes it more clear what is happening,
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
68 and reduces the likelihood of a silent and nasty surprise.
771
b338f5490029 Americanize spellings :-(
Bryan O'Sullivan <bos@serpentine.com>
parents: 753
diff changeset
69 This behavior is common to most Mercurial commands.</para>
773
3b640272a966 Progres on resolve
Bryan O'Sullivan <bos@serpentine.com>
parents: 771
diff changeset
70 </sect2>
42
cbfa08bcf181 Start the "Mercurial in daily use" chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
71
658
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
72 <sect2>
771
b338f5490029 Americanize spellings :-(
Bryan O'Sullivan <bos@serpentine.com>
parents: 753
diff changeset
73 <title>Mercurial tracks files, not directories</title>
42
cbfa08bcf181 Start the "Mercurial in daily use" chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
74
683
c838b3975bc6 Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents: 682
diff changeset
75 <para id="x_1ab">Mercurial does not track directory information. Instead,
658
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
76 it tracks the path to a file. Before creating a file, it
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
77 first creates any missing directory components of the path.
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
78 After it deletes a file, it then deletes any empty directories
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
79 that were in the deleted file's path. This sounds like a
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
80 trivial distinction, but it has one minor practical
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
81 consequence: it is not possible to represent a completely
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
82 empty directory in Mercurial.</para>
42
cbfa08bcf181 Start the "Mercurial in daily use" chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
83
683
c838b3975bc6 Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents: 682
diff changeset
84 <para id="x_1ac">Empty directories are rarely useful, and there are
658
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
85 unintrusive workarounds that you can use to achieve an
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
86 appropriate effect. The developers of Mercurial thus felt
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
87 that the complexity that would be required to manage empty
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
88 directories was not worth the limited benefit this feature
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
89 would bring.</para>
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
90
683
c838b3975bc6 Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents: 682
diff changeset
91 <para id="x_1ad">If you need an empty directory in your repository, there
658
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
92 are a few ways to achieve this. One is to create a directory,
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
93 then <command role="hg-cmd">hg add</command> a
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
94 <quote>hidden</quote> file to that directory. On Unix-like
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
95 systems, any file name that begins with a period
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
96 (<quote><literal>.</literal></quote>) is treated as hidden by
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
97 most commands and GUI tools. This approach is illustrated
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
98 below.</para>
42
cbfa08bcf181 Start the "Mercurial in daily use" chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
99
666
8fcd44708f41 Uncomment all the mangled interaction examples.
Bryan O'Sullivan <bos@serpentine.com>
parents: 658
diff changeset
100 &interaction.daily.files.hidden;
658
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
101
683
c838b3975bc6 Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents: 682
diff changeset
102 <para id="x_1ae">Another way to tackle a need for an empty directory is to
658
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
103 simply create one in your automated build scripts before they
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
104 will need it.</para>
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 </sect1>
773
3b640272a966 Progres on resolve
Bryan O'Sullivan <bos@serpentine.com>
parents: 771
diff changeset
107
658
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
108 <sect1>
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
109 <title>How to stop tracking a file</title>
42
cbfa08bcf181 Start the "Mercurial in daily use" chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
110
828
477d6a3e5023 Many final changes.
Bryan O'Sullivan <bos@serpentine.com>
parents: 812
diff changeset
111 <para id="x_1af">Once you decide that a file no longer belongs in
477d6a3e5023 Many final changes.
Bryan O'Sullivan <bos@serpentine.com>
parents: 812
diff changeset
112 your repository, use the <command role="hg-cmd">hg
477d6a3e5023 Many final changes.
Bryan O'Sullivan <bos@serpentine.com>
parents: 812
diff changeset
113 remove</command> command. This deletes the file, and tells
477d6a3e5023 Many final changes.
Bryan O'Sullivan <bos@serpentine.com>
parents: 812
diff changeset
114 Mercurial to stop tracking it (which will occur at the next
477d6a3e5023 Many final changes.
Bryan O'Sullivan <bos@serpentine.com>
parents: 812
diff changeset
115 commit). A removed file is represented in the output of
658
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
116 <command role="hg-cmd">hg status</command> with a
666
8fcd44708f41 Uncomment all the mangled interaction examples.
Bryan O'Sullivan <bos@serpentine.com>
parents: 658
diff changeset
117 <quote><literal>R</literal></quote>.</para>
8fcd44708f41 Uncomment all the mangled interaction examples.
Bryan O'Sullivan <bos@serpentine.com>
parents: 658
diff changeset
118
8fcd44708f41 Uncomment all the mangled interaction examples.
Bryan O'Sullivan <bos@serpentine.com>
parents: 658
diff changeset
119 &interaction.daily.files.remove;
42
cbfa08bcf181 Start the "Mercurial in daily use" chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
120
683
c838b3975bc6 Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents: 682
diff changeset
121 <para id="x_1b0">After you <command role="hg-cmd">hg remove</command> a file,
658
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
122 Mercurial will no longer track changes to that file, even if you
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
123 recreate a file with the same name in your working directory.
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
124 If you do recreate a file with the same name and want Mercurial
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
125 to track the new file, simply <command role="hg-cmd">hg
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
126 add</command> it. Mercurial will know that the newly added
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
127 file is not related to the old file of the same name.</para>
118
1ee53cb37a99 More progress on daily work.
Bryan O'Sullivan <bos@serpentine.com>
parents: 117
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>Removing a file does not affect its history</title>
118
1ee53cb37a99 More progress on daily work.
Bryan O'Sullivan <bos@serpentine.com>
parents: 117
diff changeset
131
683
c838b3975bc6 Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents: 682
diff changeset
132 <para id="x_1b1">It is important to understand that removing a file has
658
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
133 only two effects.</para>
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
134 <itemizedlist>
683
c838b3975bc6 Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents: 682
diff changeset
135 <listitem><para id="x_1b2">It removes the current version of the file
658
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
136 from the working directory.</para>
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
137 </listitem>
683
c838b3975bc6 Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents: 682
diff changeset
138 <listitem><para id="x_1b3">It stops Mercurial from tracking changes to
658
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
139 the file, from the time of the next commit.</para>
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
140 </listitem></itemizedlist>
683
c838b3975bc6 Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents: 682
diff changeset
141 <para id="x_1b4">Removing a file <emphasis>does not</emphasis> in any way
658
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
142 alter the <emphasis>history</emphasis> of the file.</para>
118
1ee53cb37a99 More progress on daily work.
Bryan O'Sullivan <bos@serpentine.com>
parents: 117
diff changeset
143
773
3b640272a966 Progres on resolve
Bryan O'Sullivan <bos@serpentine.com>
parents: 771
diff changeset
144 <para id="x_1b5">If you update the working directory to a
3b640272a966 Progres on resolve
Bryan O'Sullivan <bos@serpentine.com>
parents: 771
diff changeset
145 changeset that was committed when it was still tracking a file
3b640272a966 Progres on resolve
Bryan O'Sullivan <bos@serpentine.com>
parents: 771
diff changeset
146 that you later removed, the file will reappear in the working
3b640272a966 Progres on resolve
Bryan O'Sullivan <bos@serpentine.com>
parents: 771
diff changeset
147 directory, with the contents it had when you committed that
3b640272a966 Progres on resolve
Bryan O'Sullivan <bos@serpentine.com>
parents: 771
diff changeset
148 changeset. If you then update the working directory to a
3b640272a966 Progres on resolve
Bryan O'Sullivan <bos@serpentine.com>
parents: 771
diff changeset
149 later changeset, in which the file had been removed, Mercurial
3b640272a966 Progres on resolve
Bryan O'Sullivan <bos@serpentine.com>
parents: 771
diff changeset
150 will once again remove the file from the working
3b640272a966 Progres on resolve
Bryan O'Sullivan <bos@serpentine.com>
parents: 771
diff changeset
151 directory.</para>
3b640272a966 Progres on resolve
Bryan O'Sullivan <bos@serpentine.com>
parents: 771
diff changeset
152 </sect2>
118
1ee53cb37a99 More progress on daily work.
Bryan O'Sullivan <bos@serpentine.com>
parents: 117
diff changeset
153
658
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
154 <sect2>
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
155 <title>Missing files</title>
42
cbfa08bcf181 Start the "Mercurial in daily use" chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
156
683
c838b3975bc6 Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents: 682
diff changeset
157 <para id="x_1b6">Mercurial considers a file that you have deleted, but not
658
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
158 used <command role="hg-cmd">hg remove</command> to delete, to
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
159 be <emphasis>missing</emphasis>. A missing file is
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
160 represented with <quote><literal>!</literal></quote> in the
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
161 output of <command role="hg-cmd">hg status</command>.
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
162 Mercurial commands will not generally do anything with missing
666
8fcd44708f41 Uncomment all the mangled interaction examples.
Bryan O'Sullivan <bos@serpentine.com>
parents: 658
diff changeset
163 files.</para>
8fcd44708f41 Uncomment all the mangled interaction examples.
Bryan O'Sullivan <bos@serpentine.com>
parents: 658
diff changeset
164
8fcd44708f41 Uncomment all the mangled interaction examples.
Bryan O'Sullivan <bos@serpentine.com>
parents: 658
diff changeset
165 &interaction.daily.files.missing;
117
6b0f4498569e Beef up daily routine material. Focus on merge-across-copy.
Bryan O'Sullivan <bos@serpentine.com>
parents: 43
diff changeset
166
683
c838b3975bc6 Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents: 682
diff changeset
167 <para id="x_1b7">If your repository contains a file that <command
658
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
168 role="hg-cmd">hg status</command> reports as missing, and
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
169 you want the file to stay gone, you can run <command
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
170 role="hg-cmd">hg remove <option
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
171 role="hg-opt-remove">--after</option></command> at any
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
172 time later on, to tell Mercurial that you really did mean to
666
8fcd44708f41 Uncomment all the mangled interaction examples.
Bryan O'Sullivan <bos@serpentine.com>
parents: 658
diff changeset
173 remove the file.</para>
8fcd44708f41 Uncomment all the mangled interaction examples.
Bryan O'Sullivan <bos@serpentine.com>
parents: 658
diff changeset
174
8fcd44708f41 Uncomment all the mangled interaction examples.
Bryan O'Sullivan <bos@serpentine.com>
parents: 658
diff changeset
175 &interaction.daily.files.remove-after;
43
7ac85766db0f Rename, remove.
Bryan O'Sullivan <bos@serpentine.com>
parents: 42
diff changeset
176
683
c838b3975bc6 Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents: 682
diff changeset
177 <para id="x_1b8">On the other hand, if you deleted the missing file by
658
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
178 accident, give <command role="hg-cmd">hg revert</command> the
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
179 name of the file to recover. It will reappear, in unmodified
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
180 form.</para>
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
181
773
3b640272a966 Progres on resolve
Bryan O'Sullivan <bos@serpentine.com>
parents: 771
diff changeset
182 &interaction.daily.files.recover-missing;
3b640272a966 Progres on resolve
Bryan O'Sullivan <bos@serpentine.com>
parents: 771
diff changeset
183 </sect2>
117
6b0f4498569e Beef up daily routine material. Focus on merge-across-copy.
Bryan O'Sullivan <bos@serpentine.com>
parents: 43
diff changeset
184
658
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
185 <sect2>
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
186 <title>Aside: why tell Mercurial explicitly to remove a
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
187 file?</title>
42
cbfa08bcf181 Start the "Mercurial in daily use" chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
188
683
c838b3975bc6 Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents: 682
diff changeset
189 <para id="x_1b9">You might wonder why Mercurial requires you to explicitly
658
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
190 tell it that you are deleting a file. Early during the
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
191 development of Mercurial, it let you delete a file however you
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
192 pleased; Mercurial would notice the absence of the file
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
193 automatically when you next ran a <command role="hg-cmd">hg
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
194 commit</command>, and stop tracking the file. In practice,
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
195 this made it too easy to accidentally remove a file without
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
196 noticing.</para>
773
3b640272a966 Progres on resolve
Bryan O'Sullivan <bos@serpentine.com>
parents: 771
diff changeset
197 </sect2>
117
6b0f4498569e Beef up daily routine material. Focus on merge-across-copy.
Bryan O'Sullivan <bos@serpentine.com>
parents: 43
diff changeset
198
658
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
199 <sect2>
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
200 <title>Useful shorthand&emdash;adding and removing files in one
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
201 step</title>
42
cbfa08bcf181 Start the "Mercurial in daily use" chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
202
683
c838b3975bc6 Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents: 682
diff changeset
203 <para id="x_1ba">Mercurial offers a combination command, <command
658
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
204 role="hg-cmd">hg addremove</command>, that adds untracked
666
8fcd44708f41 Uncomment all the mangled interaction examples.
Bryan O'Sullivan <bos@serpentine.com>
parents: 658
diff changeset
205 files and marks missing files as removed.</para>
8fcd44708f41 Uncomment all the mangled interaction examples.
Bryan O'Sullivan <bos@serpentine.com>
parents: 658
diff changeset
206
8fcd44708f41 Uncomment all the mangled interaction examples.
Bryan O'Sullivan <bos@serpentine.com>
parents: 658
diff changeset
207 &interaction.daily.files.addremove;
8fcd44708f41 Uncomment all the mangled interaction examples.
Bryan O'Sullivan <bos@serpentine.com>
parents: 658
diff changeset
208
683
c838b3975bc6 Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents: 682
diff changeset
209 <para id="x_1bb">The <command role="hg-cmd">hg commit</command> command
666
8fcd44708f41 Uncomment all the mangled interaction examples.
Bryan O'Sullivan <bos@serpentine.com>
parents: 658
diff changeset
210 also provides a <option role="hg-opt-commit">-A</option>
8fcd44708f41 Uncomment all the mangled interaction examples.
Bryan O'Sullivan <bos@serpentine.com>
parents: 658
diff changeset
211 option that performs this same add-and-remove, immediately
8fcd44708f41 Uncomment all the mangled interaction examples.
Bryan O'Sullivan <bos@serpentine.com>
parents: 658
diff changeset
212 followed by a commit.</para>
8fcd44708f41 Uncomment all the mangled interaction examples.
Bryan O'Sullivan <bos@serpentine.com>
parents: 658
diff changeset
213
8fcd44708f41 Uncomment all the mangled interaction examples.
Bryan O'Sullivan <bos@serpentine.com>
parents: 658
diff changeset
214 &interaction.daily.files.commit-addremove;
658
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
215 </sect2>
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
216 </sect1>
773
3b640272a966 Progres on resolve
Bryan O'Sullivan <bos@serpentine.com>
parents: 771
diff changeset
217
828
477d6a3e5023 Many final changes.
Bryan O'Sullivan <bos@serpentine.com>
parents: 812
diff changeset
218 <sect1 id="chap:daily.copy">
658
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
219 <title>Copying files</title>
117
6b0f4498569e Beef up daily routine material. Focus on merge-across-copy.
Bryan O'Sullivan <bos@serpentine.com>
parents: 43
diff changeset
220
683
c838b3975bc6 Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents: 682
diff changeset
221 <para id="x_1bc">Mercurial provides a <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
222 copy</command> command that lets you make a new copy of a
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
223 file. When you copy a file using this command, Mercurial makes
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
224 a record of the fact that the new file is a copy of the original
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
225 file. It treats these copied files specially when you merge
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
226 your work with someone else's.</para>
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
227
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
228 <sect2>
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
229 <title>The results of copying during a merge</title>
121
9094c9fda8ec Start chapter on error recovery.
Bryan O'Sullivan <bos@serpentine.com>
parents: 118
diff changeset
230
683
c838b3975bc6 Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents: 682
diff changeset
231 <para id="x_1bd">What happens during a merge is that changes
658
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
232 <quote>follow</quote> a copy. To best illustrate what this
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
233 means, let's create an example. We'll start with the usual
666
8fcd44708f41 Uncomment all the mangled interaction examples.
Bryan O'Sullivan <bos@serpentine.com>
parents: 658
diff changeset
234 tiny repository that contains a single file.</para>
8fcd44708f41 Uncomment all the mangled interaction examples.
Bryan O'Sullivan <bos@serpentine.com>
parents: 658
diff changeset
235
8fcd44708f41 Uncomment all the mangled interaction examples.
Bryan O'Sullivan <bos@serpentine.com>
parents: 658
diff changeset
236 &interaction.daily.copy.init;
8fcd44708f41 Uncomment all the mangled interaction examples.
Bryan O'Sullivan <bos@serpentine.com>
parents: 658
diff changeset
237
683
c838b3975bc6 Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents: 682
diff changeset
238 <para id="x_1be">We need to do some work in
658
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
239 parallel, so that we'll have something to merge. So let's
666
8fcd44708f41 Uncomment all the mangled interaction examples.
Bryan O'Sullivan <bos@serpentine.com>
parents: 658
diff changeset
240 clone our repository.</para>
8fcd44708f41 Uncomment all the mangled interaction examples.
Bryan O'Sullivan <bos@serpentine.com>
parents: 658
diff changeset
241
8fcd44708f41 Uncomment all the mangled interaction examples.
Bryan O'Sullivan <bos@serpentine.com>
parents: 658
diff changeset
242 &interaction.daily.copy.clone;
8fcd44708f41 Uncomment all the mangled interaction examples.
Bryan O'Sullivan <bos@serpentine.com>
parents: 658
diff changeset
243
683
c838b3975bc6 Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents: 682
diff changeset
244 <para id="x_1bf">Back in our initial repository, let's use the <command
658
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
245 role="hg-cmd">hg copy</command> command to make a copy of
666
8fcd44708f41 Uncomment all the mangled interaction examples.
Bryan O'Sullivan <bos@serpentine.com>
parents: 658
diff changeset
246 the first file we created.</para>
8fcd44708f41 Uncomment all the mangled interaction examples.
Bryan O'Sullivan <bos@serpentine.com>
parents: 658
diff changeset
247
8fcd44708f41 Uncomment all the mangled interaction examples.
Bryan O'Sullivan <bos@serpentine.com>
parents: 658
diff changeset
248 &interaction.daily.copy.copy;
117
6b0f4498569e Beef up daily routine material. Focus on merge-across-copy.
Bryan O'Sullivan <bos@serpentine.com>
parents: 43
diff changeset
249
683
c838b3975bc6 Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents: 682
diff changeset
250 <para id="x_1c0">If we look at the output of the <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
251 status</command> command afterwards, the copied file looks
666
8fcd44708f41 Uncomment all the mangled interaction examples.
Bryan O'Sullivan <bos@serpentine.com>
parents: 658
diff changeset
252 just like a normal added file.</para>
8fcd44708f41 Uncomment all the mangled interaction examples.
Bryan O'Sullivan <bos@serpentine.com>
parents: 658
diff changeset
253
8fcd44708f41 Uncomment all the mangled interaction examples.
Bryan O'Sullivan <bos@serpentine.com>
parents: 658
diff changeset
254 &interaction.daily.copy.status;
8fcd44708f41 Uncomment all the mangled interaction examples.
Bryan O'Sullivan <bos@serpentine.com>
parents: 658
diff changeset
255
683
c838b3975bc6 Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents: 682
diff changeset
256 <para id="x_1c1">But if we pass the <option
658
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
257 role="hg-opt-status">-C</option> option to <command
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
258 role="hg-cmd">hg status</command>, it prints another line of
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
259 output: this is the file that our newly-added file was copied
666
8fcd44708f41 Uncomment all the mangled interaction examples.
Bryan O'Sullivan <bos@serpentine.com>
parents: 658
diff changeset
260 <emphasis>from</emphasis>.</para>
8fcd44708f41 Uncomment all the mangled interaction examples.
Bryan O'Sullivan <bos@serpentine.com>
parents: 658
diff changeset
261
8fcd44708f41 Uncomment all the mangled interaction examples.
Bryan O'Sullivan <bos@serpentine.com>
parents: 658
diff changeset
262 &interaction.daily.copy.status-copy;
117
6b0f4498569e Beef up daily routine material. Focus on merge-across-copy.
Bryan O'Sullivan <bos@serpentine.com>
parents: 43
diff changeset
263
683
c838b3975bc6 Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents: 682
diff changeset
264 <para id="x_1c2">Now, back in the repository we cloned, let's make a change
658
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
265 in parallel. We'll add a line of content to the original file
666
8fcd44708f41 Uncomment all the mangled interaction examples.
Bryan O'Sullivan <bos@serpentine.com>
parents: 658
diff changeset
266 that we created.</para>
8fcd44708f41 Uncomment all the mangled interaction examples.
Bryan O'Sullivan <bos@serpentine.com>
parents: 658
diff changeset
267
8fcd44708f41 Uncomment all the mangled interaction examples.
Bryan O'Sullivan <bos@serpentine.com>
parents: 658
diff changeset
268 &interaction.daily.copy.other;
8fcd44708f41 Uncomment all the mangled interaction examples.
Bryan O'Sullivan <bos@serpentine.com>
parents: 658
diff changeset
269
683
c838b3975bc6 Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents: 682
diff changeset
270 <para id="x_1c3">Now we have a modified <filename>file</filename> in this
658
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
271 repository. When we pull the changes from the first
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
272 repository, and merge the two heads, Mercurial will propagate
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
273 the changes that we made locally to <filename>file</filename>
666
8fcd44708f41 Uncomment all the mangled interaction examples.
Bryan O'Sullivan <bos@serpentine.com>
parents: 658
diff changeset
274 into its copy, <filename>new-file</filename>.</para>
8fcd44708f41 Uncomment all the mangled interaction examples.
Bryan O'Sullivan <bos@serpentine.com>
parents: 658
diff changeset
275
8fcd44708f41 Uncomment all the mangled interaction examples.
Bryan O'Sullivan <bos@serpentine.com>
parents: 658
diff changeset
276 &interaction.daily.copy.merge;
773
3b640272a966 Progres on resolve
Bryan O'Sullivan <bos@serpentine.com>
parents: 771
diff changeset
277 </sect2>
658
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
278
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
279 <sect2 id="sec:daily:why-copy">
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
280 <title>Why should changes follow copies?</title>
117
6b0f4498569e Beef up daily routine material. Focus on merge-across-copy.
Bryan O'Sullivan <bos@serpentine.com>
parents: 43
diff changeset
281
773
3b640272a966 Progres on resolve
Bryan O'Sullivan <bos@serpentine.com>
parents: 771
diff changeset
282 <para id="x_1c4">This behavior&emdash;of changes to a file
3b640272a966 Progres on resolve
Bryan O'Sullivan <bos@serpentine.com>
parents: 771
diff changeset
283 propagating out to copies of the file&emdash;might seem
3b640272a966 Progres on resolve
Bryan O'Sullivan <bos@serpentine.com>
parents: 771
diff changeset
284 esoteric, but in most cases it's highly desirable.</para>
117
6b0f4498569e Beef up daily routine material. Focus on merge-across-copy.
Bryan O'Sullivan <bos@serpentine.com>
parents: 43
diff changeset
285
683
c838b3975bc6 Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents: 682
diff changeset
286 <para id="x_1c5">First of all, remember that this propagation
658
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
287 <emphasis>only</emphasis> happens when you merge. So if you
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
288 <command role="hg-cmd">hg copy</command> a file, and
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
289 subsequently modify the original file during the normal course
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
290 of your work, nothing will happen.</para>
117
6b0f4498569e Beef up daily routine material. Focus on merge-across-copy.
Bryan O'Sullivan <bos@serpentine.com>
parents: 43
diff changeset
291
683
c838b3975bc6 Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents: 682
diff changeset
292 <para id="x_1c6">The second thing to know is that modifications will only
773
3b640272a966 Progres on resolve
Bryan O'Sullivan <bos@serpentine.com>
parents: 771
diff changeset
293 propagate across a copy as long as the changeset that you're
3b640272a966 Progres on resolve
Bryan O'Sullivan <bos@serpentine.com>
parents: 771
diff changeset
294 merging changes from <emphasis>hasn't yet seen</emphasis>
658
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
295 the copy.</para>
42
cbfa08bcf181 Start the "Mercurial in daily use" chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
296
683
c838b3975bc6 Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents: 682
diff changeset
297 <para id="x_1c7">The reason that Mercurial does this is as follows. Let's
658
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
298 say I make an important bug fix in a source file, and commit
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
299 my changes. Meanwhile, you've decided to <command
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
300 role="hg-cmd">hg copy</command> the file in your repository,
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
301 without knowing about the bug or having seen the fix, and you
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
302 have started hacking on your copy of the file.</para>
117
6b0f4498569e Beef up daily routine material. Focus on merge-across-copy.
Bryan O'Sullivan <bos@serpentine.com>
parents: 43
diff changeset
303
683
c838b3975bc6 Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents: 682
diff changeset
304 <para id="x_1c8">If you pulled and merged my changes, and Mercurial
658
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
305 <emphasis>didn't</emphasis> propagate changes across copies,
773
3b640272a966 Progres on resolve
Bryan O'Sullivan <bos@serpentine.com>
parents: 771
diff changeset
306 your new source file would now contain the bug, and unless you
3b640272a966 Progres on resolve
Bryan O'Sullivan <bos@serpentine.com>
parents: 771
diff changeset
307 knew to propagate the bug fix by hand, the bug would
658
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
308 <emphasis>remain</emphasis> in your copy of the file.</para>
117
6b0f4498569e Beef up daily routine material. Focus on merge-across-copy.
Bryan O'Sullivan <bos@serpentine.com>
parents: 43
diff changeset
309
683
c838b3975bc6 Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents: 682
diff changeset
310 <para id="x_1c9">By automatically propagating the change that fixed the bug
658
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
311 from the original file to the copy, Mercurial prevents this
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
312 class of problem. To my knowledge, Mercurial is the
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
313 <emphasis>only</emphasis> revision control system that
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
314 propagates changes across copies like this.</para>
117
6b0f4498569e Beef up daily routine material. Focus on merge-across-copy.
Bryan O'Sullivan <bos@serpentine.com>
parents: 43
diff changeset
315
683
c838b3975bc6 Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents: 682
diff changeset
316 <para id="x_1ca">Once your change history has a record that the copy and
658
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
317 subsequent merge occurred, there's usually no further need to
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
318 propagate changes from the original file to the copied file,
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
319 and that's why Mercurial only propagates changes across copies
773
3b640272a966 Progres on resolve
Bryan O'Sullivan <bos@serpentine.com>
parents: 771
diff changeset
320 at the first merge, and not afterwards.</para>
3b640272a966 Progres on resolve
Bryan O'Sullivan <bos@serpentine.com>
parents: 771
diff changeset
321 </sect2>
117
6b0f4498569e Beef up daily routine material. Focus on merge-across-copy.
Bryan O'Sullivan <bos@serpentine.com>
parents: 43
diff changeset
322
658
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
323 <sect2>
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
324 <title>How to make changes <emphasis>not</emphasis> follow a
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
325 copy</title>
117
6b0f4498569e Beef up daily routine material. Focus on merge-across-copy.
Bryan O'Sullivan <bos@serpentine.com>
parents: 43
diff changeset
326
683
c838b3975bc6 Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents: 682
diff changeset
327 <para id="x_1cb">If, for some reason, you decide that this business of
658
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
328 automatically propagating changes across copies is not for
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
329 you, simply use your system's normal file copy command (on
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
330 Unix-like systems, that's <command>cp</command>) to make a
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
331 copy of a file, then <command role="hg-cmd">hg add</command>
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
332 the new copy by hand. Before you do so, though, please do
691
4ce9d0754af3 Remove the words "section", "chapter", etc from in front of xref tags.
Bryan O'Sullivan <bos@serpentine.com>
parents: 683
diff changeset
333 reread <xref linkend="sec:daily:why-copy"/>, and make
658
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
334 an informed
771
b338f5490029 Americanize spellings :-(
Bryan O'Sullivan <bos@serpentine.com>
parents: 753
diff changeset
335 decision that this behavior is not appropriate to your
658
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
336 specific case.</para>
117
6b0f4498569e Beef up daily routine material. Focus on merge-across-copy.
Bryan O'Sullivan <bos@serpentine.com>
parents: 43
diff changeset
337
658
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
338 </sect2>
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
339 <sect2>
773
3b640272a966 Progres on resolve
Bryan O'Sullivan <bos@serpentine.com>
parents: 771
diff changeset
340 <title>Behavior of the <command role="hg-cmd">hg copy</command>
658
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
341 command</title>
117
6b0f4498569e Beef up daily routine material. Focus on merge-across-copy.
Bryan O'Sullivan <bos@serpentine.com>
parents: 43
diff changeset
342
683
c838b3975bc6 Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents: 682
diff changeset
343 <para id="x_1cc">When you use the <command role="hg-cmd">hg copy</command>
658
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
344 command, Mercurial makes a copy of each source file as it
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
345 currently stands in the working directory. This means that if
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
346 you make some modifications to a file, then <command
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
347 role="hg-cmd">hg copy</command> it without first having
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
348 committed those changes, the new copy will also contain the
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
349 modifications you have made up until that point. (I find this
771
b338f5490029 Americanize spellings :-(
Bryan O'Sullivan <bos@serpentine.com>
parents: 753
diff changeset
350 behavior a little counterintuitive, which is why I mention it
658
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
351 here.)</para>
118
1ee53cb37a99 More progress on daily work.
Bryan O'Sullivan <bos@serpentine.com>
parents: 117
diff changeset
352
773
3b640272a966 Progres on resolve
Bryan O'Sullivan <bos@serpentine.com>
parents: 771
diff changeset
353 <para id="x_1cd">The <command role="hg-cmd">hg copy</command>
3b640272a966 Progres on resolve
Bryan O'Sullivan <bos@serpentine.com>
parents: 771
diff changeset
354 command acts similarly to the Unix <command>cp</command>
3b640272a966 Progres on resolve
Bryan O'Sullivan <bos@serpentine.com>
parents: 771
diff changeset
355 command (you can use the <command role="hg-cmd">hg
3b640272a966 Progres on resolve
Bryan O'Sullivan <bos@serpentine.com>
parents: 771
diff changeset
356 cp</command> alias if you prefer). We must supply two or
3b640272a966 Progres on resolve
Bryan O'Sullivan <bos@serpentine.com>
parents: 771
diff changeset
357 more arguments, of which the last is treated as the
3b640272a966 Progres on resolve
Bryan O'Sullivan <bos@serpentine.com>
parents: 771
diff changeset
358 <emphasis>destination</emphasis>, and all others are
3b640272a966 Progres on resolve
Bryan O'Sullivan <bos@serpentine.com>
parents: 771
diff changeset
359 <emphasis>sources</emphasis>.</para>
3b640272a966 Progres on resolve
Bryan O'Sullivan <bos@serpentine.com>
parents: 771
diff changeset
360
775
29f0f79cf614 Update paragraph IDs
Bryan O'Sullivan <bos@serpentine.com>
parents: 773
diff changeset
361 <para id="x_685">If you pass <command role="hg-cmd">hg copy</command> a
773
3b640272a966 Progres on resolve
Bryan O'Sullivan <bos@serpentine.com>
parents: 771
diff changeset
362 single file as the source, and the destination does not exist,
3b640272a966 Progres on resolve
Bryan O'Sullivan <bos@serpentine.com>
parents: 771
diff changeset
363 it creates a new file with that name.</para>
666
8fcd44708f41 Uncomment all the mangled interaction examples.
Bryan O'Sullivan <bos@serpentine.com>
parents: 658
diff changeset
364
8fcd44708f41 Uncomment all the mangled interaction examples.
Bryan O'Sullivan <bos@serpentine.com>
parents: 658
diff changeset
365 &interaction.daily.copy.simple;
8fcd44708f41 Uncomment all the mangled interaction examples.
Bryan O'Sullivan <bos@serpentine.com>
parents: 658
diff changeset
366
683
c838b3975bc6 Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents: 682
diff changeset
367 <para id="x_1ce">If the destination is a directory, Mercurial copies its
666
8fcd44708f41 Uncomment all the mangled interaction examples.
Bryan O'Sullivan <bos@serpentine.com>
parents: 658
diff changeset
368 sources into that directory.</para>
8fcd44708f41 Uncomment all the mangled interaction examples.
Bryan O'Sullivan <bos@serpentine.com>
parents: 658
diff changeset
369
8fcd44708f41 Uncomment all the mangled interaction examples.
Bryan O'Sullivan <bos@serpentine.com>
parents: 658
diff changeset
370 &interaction.daily.copy.dir-dest;
8fcd44708f41 Uncomment all the mangled interaction examples.
Bryan O'Sullivan <bos@serpentine.com>
parents: 658
diff changeset
371
683
c838b3975bc6 Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents: 682
diff changeset
372 <para id="x_1cf">Copying a directory is
658
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
373 recursive, and preserves the directory structure of the
666
8fcd44708f41 Uncomment all the mangled interaction examples.
Bryan O'Sullivan <bos@serpentine.com>
parents: 658
diff changeset
374 source.</para>
8fcd44708f41 Uncomment all the mangled interaction examples.
Bryan O'Sullivan <bos@serpentine.com>
parents: 658
diff changeset
375
8fcd44708f41 Uncomment all the mangled interaction examples.
Bryan O'Sullivan <bos@serpentine.com>
parents: 658
diff changeset
376 &interaction.daily.copy.dir-src;
8fcd44708f41 Uncomment all the mangled interaction examples.
Bryan O'Sullivan <bos@serpentine.com>
parents: 658
diff changeset
377
683
c838b3975bc6 Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents: 682
diff changeset
378 <para id="x_1d0">If the source and destination are both directories, the
666
8fcd44708f41 Uncomment all the mangled interaction examples.
Bryan O'Sullivan <bos@serpentine.com>
parents: 658
diff changeset
379 source tree is recreated in the destination directory.</para>
8fcd44708f41 Uncomment all the mangled interaction examples.
Bryan O'Sullivan <bos@serpentine.com>
parents: 658
diff changeset
380
8fcd44708f41 Uncomment all the mangled interaction examples.
Bryan O'Sullivan <bos@serpentine.com>
parents: 658
diff changeset
381 &interaction.daily.copy.dir-src-dest;
117
6b0f4498569e Beef up daily routine material. Focus on merge-across-copy.
Bryan O'Sullivan <bos@serpentine.com>
parents: 43
diff changeset
382
773
3b640272a966 Progres on resolve
Bryan O'Sullivan <bos@serpentine.com>
parents: 771
diff changeset
383 <para id="x_1d1">As with the <command role="hg-cmd">hg remove</command>
658
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
384 command, if you copy a file manually and then want Mercurial
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
385 to know that you've copied the file, simply use the <option
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
386 role="hg-opt-copy">--after</option> option to <command
666
8fcd44708f41 Uncomment all the mangled interaction examples.
Bryan O'Sullivan <bos@serpentine.com>
parents: 658
diff changeset
387 role="hg-cmd">hg copy</command>.</para>
8fcd44708f41 Uncomment all the mangled interaction examples.
Bryan O'Sullivan <bos@serpentine.com>
parents: 658
diff changeset
388
8fcd44708f41 Uncomment all the mangled interaction examples.
Bryan O'Sullivan <bos@serpentine.com>
parents: 658
diff changeset
389 &interaction.daily.copy.after;
658
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
390 </sect2>
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
391 </sect1>
773
3b640272a966 Progres on resolve
Bryan O'Sullivan <bos@serpentine.com>
parents: 771
diff changeset
392
658
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
393 <sect1>
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
394 <title>Renaming files</title>
43
7ac85766db0f Rename, remove.
Bryan O'Sullivan <bos@serpentine.com>
parents: 42
diff changeset
395
683
c838b3975bc6 Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents: 682
diff changeset
396 <para id="x_1d2">It's rather more common to need to rename a file than to
658
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
397 make a copy of it. The reason I discussed the <command
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
398 role="hg-cmd">hg copy</command> command before talking about
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
399 renaming files is that Mercurial treats a rename in essentially
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
400 the same way as a copy. Therefore, knowing what Mercurial does
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
401 when you copy a file tells you what to expect when you rename a
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
402 file.</para>
43
7ac85766db0f Rename, remove.
Bryan O'Sullivan <bos@serpentine.com>
parents: 42
diff changeset
403
683
c838b3975bc6 Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents: 682
diff changeset
404 <para id="x_1d3">When you use the <command role="hg-cmd">hg rename</command>
658
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
405 command, Mercurial makes a copy of each source file, then
666
8fcd44708f41 Uncomment all the mangled interaction examples.
Bryan O'Sullivan <bos@serpentine.com>
parents: 658
diff changeset
406 deletes it and marks the file as removed.</para>
8fcd44708f41 Uncomment all the mangled interaction examples.
Bryan O'Sullivan <bos@serpentine.com>
parents: 658
diff changeset
407
8fcd44708f41 Uncomment all the mangled interaction examples.
Bryan O'Sullivan <bos@serpentine.com>
parents: 658
diff changeset
408 &interaction.daily.rename.rename;
8fcd44708f41 Uncomment all the mangled interaction examples.
Bryan O'Sullivan <bos@serpentine.com>
parents: 658
diff changeset
409
683
c838b3975bc6 Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents: 682
diff changeset
410 <para id="x_1d4">The <command role="hg-cmd">hg status</command> command shows
666
8fcd44708f41 Uncomment all the mangled interaction examples.
Bryan O'Sullivan <bos@serpentine.com>
parents: 658
diff changeset
411 the newly copied file as added, and the copied-from file as
8fcd44708f41 Uncomment all the mangled interaction examples.
Bryan O'Sullivan <bos@serpentine.com>
parents: 658
diff changeset
412 removed.</para>
8fcd44708f41 Uncomment all the mangled interaction examples.
Bryan O'Sullivan <bos@serpentine.com>
parents: 658
diff changeset
413
8fcd44708f41 Uncomment all the mangled interaction examples.
Bryan O'Sullivan <bos@serpentine.com>
parents: 658
diff changeset
414 &interaction.daily.rename.status;
8fcd44708f41 Uncomment all the mangled interaction examples.
Bryan O'Sullivan <bos@serpentine.com>
parents: 658
diff changeset
415
683
c838b3975bc6 Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents: 682
diff changeset
416 <para id="x_1d5">As with the results of a <command role="hg-cmd">hg
666
8fcd44708f41 Uncomment all the mangled interaction examples.
Bryan O'Sullivan <bos@serpentine.com>
parents: 658
diff changeset
417 copy</command>, we must use the <option
8fcd44708f41 Uncomment all the mangled interaction examples.
Bryan O'Sullivan <bos@serpentine.com>
parents: 658
diff changeset
418 role="hg-opt-status">-C</option> option to <command
658
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
419 role="hg-cmd">hg status</command> to see that the added file
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
420 is really being tracked by Mercurial as a copy of the original,
666
8fcd44708f41 Uncomment all the mangled interaction examples.
Bryan O'Sullivan <bos@serpentine.com>
parents: 658
diff changeset
421 now removed, file.</para>
8fcd44708f41 Uncomment all the mangled interaction examples.
Bryan O'Sullivan <bos@serpentine.com>
parents: 658
diff changeset
422
8fcd44708f41 Uncomment all the mangled interaction examples.
Bryan O'Sullivan <bos@serpentine.com>
parents: 658
diff changeset
423 &interaction.daily.rename.status-copy;
118
1ee53cb37a99 More progress on daily work.
Bryan O'Sullivan <bos@serpentine.com>
parents: 117
diff changeset
424
683
c838b3975bc6 Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents: 682
diff changeset
425 <para id="x_1d6">As with <command role="hg-cmd">hg remove</command> and
658
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
426 <command role="hg-cmd">hg copy</command>, you can tell Mercurial
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
427 about a rename after the fact using the <option
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
428 role="hg-opt-rename">--after</option> option. In most other
771
b338f5490029 Americanize spellings :-(
Bryan O'Sullivan <bos@serpentine.com>
parents: 753
diff changeset
429 respects, the behavior of the <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
430 rename</command> command, and the options it accepts, are
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
431 similar to the <command role="hg-cmd">hg copy</command>
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
432 command.</para>
118
1ee53cb37a99 More progress on daily work.
Bryan O'Sullivan <bos@serpentine.com>
parents: 117
diff changeset
433
775
29f0f79cf614 Update paragraph IDs
Bryan O'Sullivan <bos@serpentine.com>
parents: 773
diff changeset
434 <para id="x_686">If you're familiar with the Unix command line, you'll be
773
3b640272a966 Progres on resolve
Bryan O'Sullivan <bos@serpentine.com>
parents: 771
diff changeset
435 glad to know that <command role="hg-cmd">hg rename</command>
3b640272a966 Progres on resolve
Bryan O'Sullivan <bos@serpentine.com>
parents: 771
diff changeset
436 command can be invoked as <command role="hg-cmd">hg
3b640272a966 Progres on resolve
Bryan O'Sullivan <bos@serpentine.com>
parents: 771
diff changeset
437 mv</command>.</para>
3b640272a966 Progres on resolve
Bryan O'Sullivan <bos@serpentine.com>
parents: 771
diff changeset
438
658
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
439 <sect2>
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
440 <title>Renaming files and merging changes</title>
118
1ee53cb37a99 More progress on daily work.
Bryan O'Sullivan <bos@serpentine.com>
parents: 117
diff changeset
441
683
c838b3975bc6 Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents: 682
diff changeset
442 <para id="x_1d7">Since Mercurial's rename is implemented as
658
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
443 copy-and-remove, the same propagation of changes happens when
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
444 you merge after a rename as after a copy.</para>
118
1ee53cb37a99 More progress on daily work.
Bryan O'Sullivan <bos@serpentine.com>
parents: 117
diff changeset
445
683
c838b3975bc6 Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents: 682
diff changeset
446 <para id="x_1d8">If I modify a file, and you rename it to a new name, and
658
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
447 then we merge our respective changes, my modifications to the
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
448 file under its original name will be propagated into the file
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
449 under its new name. (This is something you might expect to
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
450 <quote>simply work,</quote> but not all revision control
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
451 systems actually do this.)</para>
43
7ac85766db0f Rename, remove.
Bryan O'Sullivan <bos@serpentine.com>
parents: 42
diff changeset
452
683
c838b3975bc6 Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents: 682
diff changeset
453 <para id="x_1d9">Whereas having changes follow a copy is a feature where
658
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
454 you can perhaps nod and say <quote>yes, that might be
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
455 useful,</quote> it should be clear that having them follow a
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
456 rename is definitely important. Without this facility, it
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
457 would simply be too easy for changes to become orphaned when
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
458 files are renamed.</para>
773
3b640272a966 Progres on resolve
Bryan O'Sullivan <bos@serpentine.com>
parents: 771
diff changeset
459 </sect2>
121
9094c9fda8ec Start chapter on error recovery.
Bryan O'Sullivan <bos@serpentine.com>
parents: 118
diff changeset
460
658
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
461 <sect2>
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
462 <title>Divergent renames and merging</title>
156
91a936be78b8 Document merge behaviour with file names.
Bryan O'Sullivan <bos@serpentine.com>
parents: 121
diff changeset
463
683
c838b3975bc6 Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents: 682
diff changeset
464 <para id="x_1da">The case of diverging names occurs when two developers
658
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
465 start with a file&emdash;let's call it
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
466 <filename>foo</filename>&emdash;in their respective
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
467 repositories.</para>
156
91a936be78b8 Document merge behaviour with file names.
Bryan O'Sullivan <bos@serpentine.com>
parents: 121
diff changeset
468
666
8fcd44708f41 Uncomment all the mangled interaction examples.
Bryan O'Sullivan <bos@serpentine.com>
parents: 658
diff changeset
469 &interaction.rename.divergent.clone;
8fcd44708f41 Uncomment all the mangled interaction examples.
Bryan O'Sullivan <bos@serpentine.com>
parents: 658
diff changeset
470
683
c838b3975bc6 Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents: 682
diff changeset
471 <para id="x_1db">Anne renames the file to <filename>bar</filename>.</para>
666
8fcd44708f41 Uncomment all the mangled interaction examples.
Bryan O'Sullivan <bos@serpentine.com>
parents: 658
diff changeset
472
8fcd44708f41 Uncomment all the mangled interaction examples.
Bryan O'Sullivan <bos@serpentine.com>
parents: 658
diff changeset
473 &interaction.rename.divergent.rename.anne;
8fcd44708f41 Uncomment all the mangled interaction examples.
Bryan O'Sullivan <bos@serpentine.com>
parents: 658
diff changeset
474
683
c838b3975bc6 Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents: 682
diff changeset
475 <para id="x_1dc">Meanwhile, Bob renames it to
773
3b640272a966 Progres on resolve
Bryan O'Sullivan <bos@serpentine.com>
parents: 771
diff changeset
476 <filename>quux</filename>. (Remember that <command
3b640272a966 Progres on resolve
Bryan O'Sullivan <bos@serpentine.com>
parents: 771
diff changeset
477 role="hg-cmd">hg mv</command> is an alias for <command
3b640272a966 Progres on resolve
Bryan O'Sullivan <bos@serpentine.com>
parents: 771
diff changeset
478 role="hg-cmd">hg rename</command>.)</para>
666
8fcd44708f41 Uncomment all the mangled interaction examples.
Bryan O'Sullivan <bos@serpentine.com>
parents: 658
diff changeset
479
8fcd44708f41 Uncomment all the mangled interaction examples.
Bryan O'Sullivan <bos@serpentine.com>
parents: 658
diff changeset
480 &interaction.rename.divergent.rename.bob;
658
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
481
683
c838b3975bc6 Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents: 682
diff changeset
482 <para id="x_1dd">I like to think of this as a conflict because each
658
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
483 developer has expressed different intentions about what the
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
484 file ought to be named.</para>
156
91a936be78b8 Document merge behaviour with file names.
Bryan O'Sullivan <bos@serpentine.com>
parents: 121
diff changeset
485
683
c838b3975bc6 Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents: 682
diff changeset
486 <para id="x_1de">What do you think should happen when they merge their
771
b338f5490029 Americanize spellings :-(
Bryan O'Sullivan <bos@serpentine.com>
parents: 753
diff changeset
487 work? Mercurial's actual behavior is that it always preserves
658
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
488 <emphasis>both</emphasis> names when it merges changesets that
666
8fcd44708f41 Uncomment all the mangled interaction examples.
Bryan O'Sullivan <bos@serpentine.com>
parents: 658
diff changeset
489 contain divergent renames.</para>
8fcd44708f41 Uncomment all the mangled interaction examples.
Bryan O'Sullivan <bos@serpentine.com>
parents: 658
diff changeset
490
8fcd44708f41 Uncomment all the mangled interaction examples.
Bryan O'Sullivan <bos@serpentine.com>
parents: 658
diff changeset
491 &interaction.rename.divergent.merge;
156
91a936be78b8 Document merge behaviour with file names.
Bryan O'Sullivan <bos@serpentine.com>
parents: 121
diff changeset
492
773
3b640272a966 Progres on resolve
Bryan O'Sullivan <bos@serpentine.com>
parents: 771
diff changeset
493 <para id="x_1df">Notice that while Mercurial warns about the divergent
3b640272a966 Progres on resolve
Bryan O'Sullivan <bos@serpentine.com>
parents: 771
diff changeset
494 renames, it leaves it up to you to do something about the
658
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
495 divergence after the merge.</para>
773
3b640272a966 Progres on resolve
Bryan O'Sullivan <bos@serpentine.com>
parents: 771
diff changeset
496 </sect2>
156
91a936be78b8 Document merge behaviour with file names.
Bryan O'Sullivan <bos@serpentine.com>
parents: 121
diff changeset
497
658
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
498 <sect2>
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
499 <title>Convergent renames and merging</title>
156
91a936be78b8 Document merge behaviour with file names.
Bryan O'Sullivan <bos@serpentine.com>
parents: 121
diff changeset
500
683
c838b3975bc6 Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents: 682
diff changeset
501 <para id="x_1e0">Another kind of rename conflict occurs when two people
658
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
502 choose to rename different <emphasis>source</emphasis> files
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
503 to the same <emphasis>destination</emphasis>. In this case,
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
504 Mercurial runs its normal merge machinery, and lets you guide
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
505 it to a suitable resolution.</para>
773
3b640272a966 Progres on resolve
Bryan O'Sullivan <bos@serpentine.com>
parents: 771
diff changeset
506 </sect2>
156
91a936be78b8 Document merge behaviour with file names.
Bryan O'Sullivan <bos@serpentine.com>
parents: 121
diff changeset
507
658
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
508 <sect2>
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
509 <title>Other name-related corner cases</title>
156
91a936be78b8 Document merge behaviour with file names.
Bryan O'Sullivan <bos@serpentine.com>
parents: 121
diff changeset
510
683
c838b3975bc6 Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents: 682
diff changeset
511 <para id="x_1e1">Mercurial has a longstanding bug in which it fails to
658
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
512 handle a merge where one side has a file with a given name,
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
513 while another has a directory with the same name. This is
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
514 documented as <ulink role="hg-bug"
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
515 url="http://www.selenic.com/mercurial/bts/issue29">issue
666
8fcd44708f41 Uncomment all the mangled interaction examples.
Bryan O'Sullivan <bos@serpentine.com>
parents: 658
diff changeset
516 29</ulink>.</para>
8fcd44708f41 Uncomment all the mangled interaction examples.
Bryan O'Sullivan <bos@serpentine.com>
parents: 658
diff changeset
517
8fcd44708f41 Uncomment all the mangled interaction examples.
Bryan O'Sullivan <bos@serpentine.com>
parents: 658
diff changeset
518 &interaction.issue29.go;
121
9094c9fda8ec Start chapter on error recovery.
Bryan O'Sullivan <bos@serpentine.com>
parents: 118
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>
773
3b640272a966 Progres on resolve
Bryan O'Sullivan <bos@serpentine.com>
parents: 771
diff changeset
522
658
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
523 <sect1>
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
524 <title>Recovering from mistakes</title>
180
6413f88338df Point to chapter on undoing mistakes.
Bryan O'Sullivan <bos@serpentine.com>
parents: 178
diff changeset
525
683
c838b3975bc6 Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents: 682
diff changeset
526 <para id="x_1e2">Mercurial has some useful commands that will help you to
658
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
527 recover from some common mistakes.</para>
180
6413f88338df Point to chapter on undoing mistakes.
Bryan O'Sullivan <bos@serpentine.com>
parents: 178
diff changeset
528
683
c838b3975bc6 Add IDs to paragraphs.
Bryan O'Sullivan <bos@serpentine.com>
parents: 682
diff changeset
529 <para id="x_1e3">The <command role="hg-cmd">hg revert</command> command lets
658
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
530 you undo changes that you have made to your working directory.
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
531 For example, if you <command role="hg-cmd">hg add</command> a
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
532 file by accident, just run <command role="hg-cmd">hg
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
533 revert</command> with the name of the file you added, and
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
534 while the file won't be touched in any way, it won't be tracked
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
535 for adding by Mercurial any longer, either. You can also use
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
536 <command role="hg-cmd">hg revert</command> to get rid of
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
537 erroneous changes to a file.</para>
180
6413f88338df Point to chapter on undoing mistakes.
Bryan O'Sullivan <bos@serpentine.com>
parents: 178
diff changeset
538
828
477d6a3e5023 Many final changes.
Bryan O'Sullivan <bos@serpentine.com>
parents: 812
diff changeset
539 <para id="x_1e4">It is helpful to remember that the <command
477d6a3e5023 Many final changes.
Bryan O'Sullivan <bos@serpentine.com>
parents: 812
diff changeset
540 role="hg-cmd">hg revert</command> command is useful for
477d6a3e5023 Many final changes.
Bryan O'Sullivan <bos@serpentine.com>
parents: 812
diff changeset
541 changes that you have not yet committed. Once you've committed
477d6a3e5023 Many final changes.
Bryan O'Sullivan <bos@serpentine.com>
parents: 812
diff changeset
542 a change, if you decide it was a mistake, you can still do
477d6a3e5023 Many final changes.
Bryan O'Sullivan <bos@serpentine.com>
parents: 812
diff changeset
543 something about it, though your options may be more
477d6a3e5023 Many final changes.
Bryan O'Sullivan <bos@serpentine.com>
parents: 812
diff changeset
544 limited.</para>
180
6413f88338df Point to chapter on undoing mistakes.
Bryan O'Sullivan <bos@serpentine.com>
parents: 178
diff changeset
545
691
4ce9d0754af3 Remove the words "section", "chapter", etc from in front of xref tags.
Bryan O'Sullivan <bos@serpentine.com>
parents: 683
diff changeset
546 <para id="x_1e5">For more information about the <command
4ce9d0754af3 Remove the words "section", "chapter", etc from in front of xref tags.
Bryan O'Sullivan <bos@serpentine.com>
parents: 683
diff changeset
547 role="hg-cmd">hg revert</command> command, and details about
4ce9d0754af3 Remove the words "section", "chapter", etc from in front of xref tags.
Bryan O'Sullivan <bos@serpentine.com>
parents: 683
diff changeset
548 how to deal with changes you have already committed, see <xref
658
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
549 linkend="chap:undo"/>.</para>
773
3b640272a966 Progres on resolve
Bryan O'Sullivan <bos@serpentine.com>
parents: 771
diff changeset
550 </sect1>
180
6413f88338df Point to chapter on undoing mistakes.
Bryan O'Sullivan <bos@serpentine.com>
parents: 178
diff changeset
551
773
3b640272a966 Progres on resolve
Bryan O'Sullivan <bos@serpentine.com>
parents: 771
diff changeset
552 <sect1>
3b640272a966 Progres on resolve
Bryan O'Sullivan <bos@serpentine.com>
parents: 771
diff changeset
553 <title>Dealing with tricky merges</title>
3b640272a966 Progres on resolve
Bryan O'Sullivan <bos@serpentine.com>
parents: 771
diff changeset
554
775
29f0f79cf614 Update paragraph IDs
Bryan O'Sullivan <bos@serpentine.com>
parents: 773
diff changeset
555 <para id="x_687">In a complicated or large project, it's not unusual for a
773
3b640272a966 Progres on resolve
Bryan O'Sullivan <bos@serpentine.com>
parents: 771
diff changeset
556 merge of two changesets to result in some headaches. Suppose
3b640272a966 Progres on resolve
Bryan O'Sullivan <bos@serpentine.com>
parents: 771
diff changeset
557 there's a big source file that's been extensively edited by each
3b640272a966 Progres on resolve
Bryan O'Sullivan <bos@serpentine.com>
parents: 771
diff changeset
558 side of a merge: this is almost inevitably going to result in
3b640272a966 Progres on resolve
Bryan O'Sullivan <bos@serpentine.com>
parents: 771
diff changeset
559 conflicts, some of which can take a few tries to sort
3b640272a966 Progres on resolve
Bryan O'Sullivan <bos@serpentine.com>
parents: 771
diff changeset
560 out.</para>
3b640272a966 Progres on resolve
Bryan O'Sullivan <bos@serpentine.com>
parents: 771
diff changeset
561
775
29f0f79cf614 Update paragraph IDs
Bryan O'Sullivan <bos@serpentine.com>
parents: 773
diff changeset
562 <para id="x_688">Let's develop a simple case of this and see how to deal with
773
3b640272a966 Progres on resolve
Bryan O'Sullivan <bos@serpentine.com>
parents: 771
diff changeset
563 it. We'll start off with a repository containing one file, and
3b640272a966 Progres on resolve
Bryan O'Sullivan <bos@serpentine.com>
parents: 771
diff changeset
564 clone it twice.</para>
3b640272a966 Progres on resolve
Bryan O'Sullivan <bos@serpentine.com>
parents: 771
diff changeset
565
3b640272a966 Progres on resolve
Bryan O'Sullivan <bos@serpentine.com>
parents: 771
diff changeset
566 &interaction.ch04-resolve.init;
3b640272a966 Progres on resolve
Bryan O'Sullivan <bos@serpentine.com>
parents: 771
diff changeset
567
775
29f0f79cf614 Update paragraph IDs
Bryan O'Sullivan <bos@serpentine.com>
parents: 773
diff changeset
568 <para id="x_689">In one clone, we'll modify the file in one way.</para>
773
3b640272a966 Progres on resolve
Bryan O'Sullivan <bos@serpentine.com>
parents: 771
diff changeset
569
3b640272a966 Progres on resolve
Bryan O'Sullivan <bos@serpentine.com>
parents: 771
diff changeset
570 &interaction.ch04-resolve.left;
3b640272a966 Progres on resolve
Bryan O'Sullivan <bos@serpentine.com>
parents: 771
diff changeset
571
775
29f0f79cf614 Update paragraph IDs
Bryan O'Sullivan <bos@serpentine.com>
parents: 773
diff changeset
572 <para id="x_68a">In another, we'll modify the file differently.</para>
773
3b640272a966 Progres on resolve
Bryan O'Sullivan <bos@serpentine.com>
parents: 771
diff changeset
573
3b640272a966 Progres on resolve
Bryan O'Sullivan <bos@serpentine.com>
parents: 771
diff changeset
574 &interaction.ch04-resolve.right;
3b640272a966 Progres on resolve
Bryan O'Sullivan <bos@serpentine.com>
parents: 771
diff changeset
575
775
29f0f79cf614 Update paragraph IDs
Bryan O'Sullivan <bos@serpentine.com>
parents: 773
diff changeset
576 <para id="x_68b">Next, we'll pull each set of changes into our original
773
3b640272a966 Progres on resolve
Bryan O'Sullivan <bos@serpentine.com>
parents: 771
diff changeset
577 repo.</para>
3b640272a966 Progres on resolve
Bryan O'Sullivan <bos@serpentine.com>
parents: 771
diff changeset
578
3b640272a966 Progres on resolve
Bryan O'Sullivan <bos@serpentine.com>
parents: 771
diff changeset
579 &interaction.ch04-resolve.pull;
3b640272a966 Progres on resolve
Bryan O'Sullivan <bos@serpentine.com>
parents: 771
diff changeset
580
775
29f0f79cf614 Update paragraph IDs
Bryan O'Sullivan <bos@serpentine.com>
parents: 773
diff changeset
581 <para id="x_68c">We expect our repository to now contain two heads.</para>
773
3b640272a966 Progres on resolve
Bryan O'Sullivan <bos@serpentine.com>
parents: 771
diff changeset
582
3b640272a966 Progres on resolve
Bryan O'Sullivan <bos@serpentine.com>
parents: 771
diff changeset
583 &interaction.ch04-resolve.heads;
3b640272a966 Progres on resolve
Bryan O'Sullivan <bos@serpentine.com>
parents: 771
diff changeset
584
775
29f0f79cf614 Update paragraph IDs
Bryan O'Sullivan <bos@serpentine.com>
parents: 773
diff changeset
585 <para id="x_68d">Normally, if we run <command role="hg-cmd">hg
773
3b640272a966 Progres on resolve
Bryan O'Sullivan <bos@serpentine.com>
parents: 771
diff changeset
586 merge</command> at this point, it will drop us into a GUI that
3b640272a966 Progres on resolve
Bryan O'Sullivan <bos@serpentine.com>
parents: 771
diff changeset
587 will let us manually resolve the conflicting edits to
3b640272a966 Progres on resolve
Bryan O'Sullivan <bos@serpentine.com>
parents: 771
diff changeset
588 <filename>myfile.txt</filename>. However, to simplify things
3b640272a966 Progres on resolve
Bryan O'Sullivan <bos@serpentine.com>
parents: 771
diff changeset
589 for presentation here, we'd like the merge to fail immediately
3b640272a966 Progres on resolve
Bryan O'Sullivan <bos@serpentine.com>
parents: 771
diff changeset
590 instead. Here's one way we can do so.</para>
3b640272a966 Progres on resolve
Bryan O'Sullivan <bos@serpentine.com>
parents: 771
diff changeset
591
3b640272a966 Progres on resolve
Bryan O'Sullivan <bos@serpentine.com>
parents: 771
diff changeset
592 &interaction.ch04-resolve.export;
3b640272a966 Progres on resolve
Bryan O'Sullivan <bos@serpentine.com>
parents: 771
diff changeset
593
775
29f0f79cf614 Update paragraph IDs
Bryan O'Sullivan <bos@serpentine.com>
parents: 773
diff changeset
594 <para id="x_68e">We've told Mercurial's merge machinery to run the command
773
3b640272a966 Progres on resolve
Bryan O'Sullivan <bos@serpentine.com>
parents: 771
diff changeset
595 <command>false</command> (which, as we desire, fails
3b640272a966 Progres on resolve
Bryan O'Sullivan <bos@serpentine.com>
parents: 771
diff changeset
596 immediately) if it detects a merge that it can't sort out
3b640272a966 Progres on resolve
Bryan O'Sullivan <bos@serpentine.com>
parents: 771
diff changeset
597 automatically.</para>
3b640272a966 Progres on resolve
Bryan O'Sullivan <bos@serpentine.com>
parents: 771
diff changeset
598
775
29f0f79cf614 Update paragraph IDs
Bryan O'Sullivan <bos@serpentine.com>
parents: 773
diff changeset
599 <para id="x_68f">If we now fire up <command role="hg-cmd">hg
773
3b640272a966 Progres on resolve
Bryan O'Sullivan <bos@serpentine.com>
parents: 771
diff changeset
600 merge</command>, it should grind to a halt and report a
3b640272a966 Progres on resolve
Bryan O'Sullivan <bos@serpentine.com>
parents: 771
diff changeset
601 failure.</para>
3b640272a966 Progres on resolve
Bryan O'Sullivan <bos@serpentine.com>
parents: 771
diff changeset
602
3b640272a966 Progres on resolve
Bryan O'Sullivan <bos@serpentine.com>
parents: 771
diff changeset
603 &interaction.ch04-resolve.merge;
3b640272a966 Progres on resolve
Bryan O'Sullivan <bos@serpentine.com>
parents: 771
diff changeset
604
775
29f0f79cf614 Update paragraph IDs
Bryan O'Sullivan <bos@serpentine.com>
parents: 773
diff changeset
605 <para id="x_690">Even if we don't notice that the merge failed, Mercurial
773
3b640272a966 Progres on resolve
Bryan O'Sullivan <bos@serpentine.com>
parents: 771
diff changeset
606 will prevent us from accidentally committing the result of a
3b640272a966 Progres on resolve
Bryan O'Sullivan <bos@serpentine.com>
parents: 771
diff changeset
607 failed merge.</para>
3b640272a966 Progres on resolve
Bryan O'Sullivan <bos@serpentine.com>
parents: 771
diff changeset
608
3b640272a966 Progres on resolve
Bryan O'Sullivan <bos@serpentine.com>
parents: 771
diff changeset
609 &interaction.ch04-resolve.cifail;
3b640272a966 Progres on resolve
Bryan O'Sullivan <bos@serpentine.com>
parents: 771
diff changeset
610
775
29f0f79cf614 Update paragraph IDs
Bryan O'Sullivan <bos@serpentine.com>
parents: 773
diff changeset
611 <para id="x_691">When <command role="hg-cmd">hg commit</command> fails in
773
3b640272a966 Progres on resolve
Bryan O'Sullivan <bos@serpentine.com>
parents: 771
diff changeset
612 this case, it suggests that we use the unfamiliar <command
3b640272a966 Progres on resolve
Bryan O'Sullivan <bos@serpentine.com>
parents: 771
diff changeset
613 role="hg-cmd">hg resolve</command> command. As usual,
3b640272a966 Progres on resolve
Bryan O'Sullivan <bos@serpentine.com>
parents: 771
diff changeset
614 <command role="hg-cmd">hg help resolve</command> will print a
3b640272a966 Progres on resolve
Bryan O'Sullivan <bos@serpentine.com>
parents: 771
diff changeset
615 helpful synopsis.</para>
3b640272a966 Progres on resolve
Bryan O'Sullivan <bos@serpentine.com>
parents: 771
diff changeset
616
3b640272a966 Progres on resolve
Bryan O'Sullivan <bos@serpentine.com>
parents: 771
diff changeset
617 <sect2>
3b640272a966 Progres on resolve
Bryan O'Sullivan <bos@serpentine.com>
parents: 771
diff changeset
618 <title>File resolution states</title>
3b640272a966 Progres on resolve
Bryan O'Sullivan <bos@serpentine.com>
parents: 771
diff changeset
619
775
29f0f79cf614 Update paragraph IDs
Bryan O'Sullivan <bos@serpentine.com>
parents: 773
diff changeset
620 <para id="x_692">When a merge occurs, most files will usually remain
773
3b640272a966 Progres on resolve
Bryan O'Sullivan <bos@serpentine.com>
parents: 771
diff changeset
621 unmodified. For each file where Mercurial has to do
3b640272a966 Progres on resolve
Bryan O'Sullivan <bos@serpentine.com>
parents: 771
diff changeset
622 something, it tracks the state of the file.</para>
3b640272a966 Progres on resolve
Bryan O'Sullivan <bos@serpentine.com>
parents: 771
diff changeset
623
3b640272a966 Progres on resolve
Bryan O'Sullivan <bos@serpentine.com>
parents: 771
diff changeset
624 <itemizedlist>
3b640272a966 Progres on resolve
Bryan O'Sullivan <bos@serpentine.com>
parents: 771
diff changeset
625 <listitem>
775
29f0f79cf614 Update paragraph IDs
Bryan O'Sullivan <bos@serpentine.com>
parents: 773
diff changeset
626 <para id="x_693">A <emphasis>resolved</emphasis> file has been
773
3b640272a966 Progres on resolve
Bryan O'Sullivan <bos@serpentine.com>
parents: 771
diff changeset
627 successfully merged, either automatically by Mercurial or
3b640272a966 Progres on resolve
Bryan O'Sullivan <bos@serpentine.com>
parents: 771
diff changeset
628 manually with human intervention.</para>
3b640272a966 Progres on resolve
Bryan O'Sullivan <bos@serpentine.com>
parents: 771
diff changeset
629 </listitem>
3b640272a966 Progres on resolve
Bryan O'Sullivan <bos@serpentine.com>
parents: 771
diff changeset
630 <listitem>
775
29f0f79cf614 Update paragraph IDs
Bryan O'Sullivan <bos@serpentine.com>
parents: 773
diff changeset
631 <para id="x_694">An <emphasis>unresolved</emphasis> file was not merged
773
3b640272a966 Progres on resolve
Bryan O'Sullivan <bos@serpentine.com>
parents: 771
diff changeset
632 successfully, and needs more attention.</para>
3b640272a966 Progres on resolve
Bryan O'Sullivan <bos@serpentine.com>
parents: 771
diff changeset
633 </listitem>
3b640272a966 Progres on resolve
Bryan O'Sullivan <bos@serpentine.com>
parents: 771
diff changeset
634 </itemizedlist>
3b640272a966 Progres on resolve
Bryan O'Sullivan <bos@serpentine.com>
parents: 771
diff changeset
635
775
29f0f79cf614 Update paragraph IDs
Bryan O'Sullivan <bos@serpentine.com>
parents: 773
diff changeset
636 <para id="x_695">If Mercurial sees <emphasis>any</emphasis> file in the
773
3b640272a966 Progres on resolve
Bryan O'Sullivan <bos@serpentine.com>
parents: 771
diff changeset
637 unresolved state after a merge, it considers the merge to have
3b640272a966 Progres on resolve
Bryan O'Sullivan <bos@serpentine.com>
parents: 771
diff changeset
638 failed. Fortunately, we do not need to restart the entire
3b640272a966 Progres on resolve
Bryan O'Sullivan <bos@serpentine.com>
parents: 771
diff changeset
639 merge from scratch.</para>
3b640272a966 Progres on resolve
Bryan O'Sullivan <bos@serpentine.com>
parents: 771
diff changeset
640
775
29f0f79cf614 Update paragraph IDs
Bryan O'Sullivan <bos@serpentine.com>
parents: 773
diff changeset
641 <para id="x_696">The <option role="hg-opt-resolve">--list</option> or
773
3b640272a966 Progres on resolve
Bryan O'Sullivan <bos@serpentine.com>
parents: 771
diff changeset
642 <option role="hg-opt-resolve">-l</option> option to <command
3b640272a966 Progres on resolve
Bryan O'Sullivan <bos@serpentine.com>
parents: 771
diff changeset
643 role="hg-cmd">hg resolve</command> prints out the state of
3b640272a966 Progres on resolve
Bryan O'Sullivan <bos@serpentine.com>
parents: 771
diff changeset
644 each merged file.</para>
3b640272a966 Progres on resolve
Bryan O'Sullivan <bos@serpentine.com>
parents: 771
diff changeset
645
3b640272a966 Progres on resolve
Bryan O'Sullivan <bos@serpentine.com>
parents: 771
diff changeset
646 &interaction.ch04-resolve.list;
3b640272a966 Progres on resolve
Bryan O'Sullivan <bos@serpentine.com>
parents: 771
diff changeset
647
775
29f0f79cf614 Update paragraph IDs
Bryan O'Sullivan <bos@serpentine.com>
parents: 773
diff changeset
648 <para id="x_697">In the output from <command role="hg-cmd">hg
773
3b640272a966 Progres on resolve
Bryan O'Sullivan <bos@serpentine.com>
parents: 771
diff changeset
649 resolve</command>, a resolved file is marked with
3b640272a966 Progres on resolve
Bryan O'Sullivan <bos@serpentine.com>
parents: 771
diff changeset
650 <literal>R</literal>, while an unresolved file is marked with
3b640272a966 Progres on resolve
Bryan O'Sullivan <bos@serpentine.com>
parents: 771
diff changeset
651 <literal>U</literal>. If any files are listed with
3b640272a966 Progres on resolve
Bryan O'Sullivan <bos@serpentine.com>
parents: 771
diff changeset
652 <literal>U</literal>, we know that an attempt to commit the
3b640272a966 Progres on resolve
Bryan O'Sullivan <bos@serpentine.com>
parents: 771
diff changeset
653 results of the merge will fail.</para>
3b640272a966 Progres on resolve
Bryan O'Sullivan <bos@serpentine.com>
parents: 771
diff changeset
654 </sect2>
3b640272a966 Progres on resolve
Bryan O'Sullivan <bos@serpentine.com>
parents: 771
diff changeset
655
3b640272a966 Progres on resolve
Bryan O'Sullivan <bos@serpentine.com>
parents: 771
diff changeset
656 <sect2>
3b640272a966 Progres on resolve
Bryan O'Sullivan <bos@serpentine.com>
parents: 771
diff changeset
657 <title>Resolving a file merge</title>
3b640272a966 Progres on resolve
Bryan O'Sullivan <bos@serpentine.com>
parents: 771
diff changeset
658
775
29f0f79cf614 Update paragraph IDs
Bryan O'Sullivan <bos@serpentine.com>
parents: 773
diff changeset
659 <para id="x_698">We have several options to move a file from the unresolved
773
3b640272a966 Progres on resolve
Bryan O'Sullivan <bos@serpentine.com>
parents: 771
diff changeset
660 into the resolved state. By far the most common is to rerun
3b640272a966 Progres on resolve
Bryan O'Sullivan <bos@serpentine.com>
parents: 771
diff changeset
661 <command role="hg-cmd">hg resolve</command>. If we pass the
3b640272a966 Progres on resolve
Bryan O'Sullivan <bos@serpentine.com>
parents: 771
diff changeset
662 names of individual files or directories, it will retry the
3b640272a966 Progres on resolve
Bryan O'Sullivan <bos@serpentine.com>
parents: 771
diff changeset
663 merges of any unresolved files present in those locations. We
3b640272a966 Progres on resolve
Bryan O'Sullivan <bos@serpentine.com>
parents: 771
diff changeset
664 can also pass the <option role="hg-opt-resolve">--all</option>
3b640272a966 Progres on resolve
Bryan O'Sullivan <bos@serpentine.com>
parents: 771
diff changeset
665 or <option role="hg-opt-resolve">-a</option> option, which
3b640272a966 Progres on resolve
Bryan O'Sullivan <bos@serpentine.com>
parents: 771
diff changeset
666 will retry the merges of <emphasis>all</emphasis> unresolved
3b640272a966 Progres on resolve
Bryan O'Sullivan <bos@serpentine.com>
parents: 771
diff changeset
667 files.</para>
3b640272a966 Progres on resolve
Bryan O'Sullivan <bos@serpentine.com>
parents: 771
diff changeset
668
775
29f0f79cf614 Update paragraph IDs
Bryan O'Sullivan <bos@serpentine.com>
parents: 773
diff changeset
669 <para id="x_699">Mercurial also lets us modify the resolution state of a
773
3b640272a966 Progres on resolve
Bryan O'Sullivan <bos@serpentine.com>
parents: 771
diff changeset
670 file directly. We can manually mark a file as resolved using
3b640272a966 Progres on resolve
Bryan O'Sullivan <bos@serpentine.com>
parents: 771
diff changeset
671 the <option role="hg-opt-resolve">--mark</option> option, or
3b640272a966 Progres on resolve
Bryan O'Sullivan <bos@serpentine.com>
parents: 771
diff changeset
672 as unresolved using the <option
3b640272a966 Progres on resolve
Bryan O'Sullivan <bos@serpentine.com>
parents: 771
diff changeset
673 role="hg-opt-resolve">--unmark</option> option. This allows
3b640272a966 Progres on resolve
Bryan O'Sullivan <bos@serpentine.com>
parents: 771
diff changeset
674 us to clean up a particularly messy merge by hand, and to keep
3b640272a966 Progres on resolve
Bryan O'Sullivan <bos@serpentine.com>
parents: 771
diff changeset
675 track of our progress with each file as we go.</para>
3b640272a966 Progres on resolve
Bryan O'Sullivan <bos@serpentine.com>
parents: 771
diff changeset
676 </sect2>
658
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
677 </sect1>
810
1a0a78e197c3 Incorporate feedback from Greg Lindahl.
Bryan O'Sullivan <bos@serpentine.com>
parents: 775
diff changeset
678
1a0a78e197c3 Incorporate feedback from Greg Lindahl.
Bryan O'Sullivan <bos@serpentine.com>
parents: 775
diff changeset
679 <sect1>
1a0a78e197c3 Incorporate feedback from Greg Lindahl.
Bryan O'Sullivan <bos@serpentine.com>
parents: 775
diff changeset
680 <title>More useful diffs</title>
1a0a78e197c3 Incorporate feedback from Greg Lindahl.
Bryan O'Sullivan <bos@serpentine.com>
parents: 775
diff changeset
681
811
a66f6d499afa Add paragraph IDs
Bryan O'Sullivan <bos@serpentine.com>
parents: 810
diff changeset
682 <para id="x_6c7">The default output of the <command role="hg-cmd">hg
810
1a0a78e197c3 Incorporate feedback from Greg Lindahl.
Bryan O'Sullivan <bos@serpentine.com>
parents: 775
diff changeset
683 diff</command> command is backwards compatible with the
1a0a78e197c3 Incorporate feedback from Greg Lindahl.
Bryan O'Sullivan <bos@serpentine.com>
parents: 775
diff changeset
684 regular <command>diff</command> command, but this has some
1a0a78e197c3 Incorporate feedback from Greg Lindahl.
Bryan O'Sullivan <bos@serpentine.com>
parents: 775
diff changeset
685 drawbacks.</para>
1a0a78e197c3 Incorporate feedback from Greg Lindahl.
Bryan O'Sullivan <bos@serpentine.com>
parents: 775
diff changeset
686
811
a66f6d499afa Add paragraph IDs
Bryan O'Sullivan <bos@serpentine.com>
parents: 810
diff changeset
687 <para id="x_6c8">Consider the case where we use <command role="hg-cmd">hg
810
1a0a78e197c3 Incorporate feedback from Greg Lindahl.
Bryan O'Sullivan <bos@serpentine.com>
parents: 775
diff changeset
688 rename</command> to rename a file.</para>
1a0a78e197c3 Incorporate feedback from Greg Lindahl.
Bryan O'Sullivan <bos@serpentine.com>
parents: 775
diff changeset
689
1a0a78e197c3 Incorporate feedback from Greg Lindahl.
Bryan O'Sullivan <bos@serpentine.com>
parents: 775
diff changeset
690 &interaction.ch04-diff.rename.basic;
1a0a78e197c3 Incorporate feedback from Greg Lindahl.
Bryan O'Sullivan <bos@serpentine.com>
parents: 775
diff changeset
691
811
a66f6d499afa Add paragraph IDs
Bryan O'Sullivan <bos@serpentine.com>
parents: 810
diff changeset
692 <para id="x_6c9">The output of <command role="hg-cmd">hg diff</command> above
810
1a0a78e197c3 Incorporate feedback from Greg Lindahl.
Bryan O'Sullivan <bos@serpentine.com>
parents: 775
diff changeset
693 obscures the fact that we simply renamed a file. The <command
1a0a78e197c3 Incorporate feedback from Greg Lindahl.
Bryan O'Sullivan <bos@serpentine.com>
parents: 775
diff changeset
694 role="hg-cmd">hg diff</command> command accepts an option,
1a0a78e197c3 Incorporate feedback from Greg Lindahl.
Bryan O'Sullivan <bos@serpentine.com>
parents: 775
diff changeset
695 <option>--git</option> or <option>-g</option>, to use a newer
1a0a78e197c3 Incorporate feedback from Greg Lindahl.
Bryan O'Sullivan <bos@serpentine.com>
parents: 775
diff changeset
696 diff format that displays such information in a more readable
1a0a78e197c3 Incorporate feedback from Greg Lindahl.
Bryan O'Sullivan <bos@serpentine.com>
parents: 775
diff changeset
697 form.</para>
1a0a78e197c3 Incorporate feedback from Greg Lindahl.
Bryan O'Sullivan <bos@serpentine.com>
parents: 775
diff changeset
698
1a0a78e197c3 Incorporate feedback from Greg Lindahl.
Bryan O'Sullivan <bos@serpentine.com>
parents: 775
diff changeset
699 &interaction.ch04-diff.rename.git;
1a0a78e197c3 Incorporate feedback from Greg Lindahl.
Bryan O'Sullivan <bos@serpentine.com>
parents: 775
diff changeset
700
811
a66f6d499afa Add paragraph IDs
Bryan O'Sullivan <bos@serpentine.com>
parents: 810
diff changeset
701 <para id="x_6ca">This option also helps with a case that can otherwise be
810
1a0a78e197c3 Incorporate feedback from Greg Lindahl.
Bryan O'Sullivan <bos@serpentine.com>
parents: 775
diff changeset
702 confusing: a file that appears to be modified according to
1a0a78e197c3 Incorporate feedback from Greg Lindahl.
Bryan O'Sullivan <bos@serpentine.com>
parents: 775
diff changeset
703 <command role="hg-cmd">hg status</command>, but for which
1a0a78e197c3 Incorporate feedback from Greg Lindahl.
Bryan O'Sullivan <bos@serpentine.com>
parents: 775
diff changeset
704 <command role="hg-cmd">hg diff</command> prints nothing. This
1a0a78e197c3 Incorporate feedback from Greg Lindahl.
Bryan O'Sullivan <bos@serpentine.com>
parents: 775
diff changeset
705 situation can arise if we change the file's execute
1a0a78e197c3 Incorporate feedback from Greg Lindahl.
Bryan O'Sullivan <bos@serpentine.com>
parents: 775
diff changeset
706 permissions.</para>
1a0a78e197c3 Incorporate feedback from Greg Lindahl.
Bryan O'Sullivan <bos@serpentine.com>
parents: 775
diff changeset
707
1a0a78e197c3 Incorporate feedback from Greg Lindahl.
Bryan O'Sullivan <bos@serpentine.com>
parents: 775
diff changeset
708 &interaction.ch04-diff.chmod;
1a0a78e197c3 Incorporate feedback from Greg Lindahl.
Bryan O'Sullivan <bos@serpentine.com>
parents: 775
diff changeset
709
811
a66f6d499afa Add paragraph IDs
Bryan O'Sullivan <bos@serpentine.com>
parents: 810
diff changeset
710 <para id="x_6cb">The normal <command>diff</command> command pays no attention
810
1a0a78e197c3 Incorporate feedback from Greg Lindahl.
Bryan O'Sullivan <bos@serpentine.com>
parents: 775
diff changeset
711 to file permissions, which is why <command role="hg-cmd">hg
1a0a78e197c3 Incorporate feedback from Greg Lindahl.
Bryan O'Sullivan <bos@serpentine.com>
parents: 775
diff changeset
712 diff</command> prints nothing by default. If we supply it
1a0a78e197c3 Incorporate feedback from Greg Lindahl.
Bryan O'Sullivan <bos@serpentine.com>
parents: 775
diff changeset
713 with the <option>-g</option> option, it tells us what really
1a0a78e197c3 Incorporate feedback from Greg Lindahl.
Bryan O'Sullivan <bos@serpentine.com>
parents: 775
diff changeset
714 happened.</para>
1a0a78e197c3 Incorporate feedback from Greg Lindahl.
Bryan O'Sullivan <bos@serpentine.com>
parents: 775
diff changeset
715
1a0a78e197c3 Incorporate feedback from Greg Lindahl.
Bryan O'Sullivan <bos@serpentine.com>
parents: 775
diff changeset
716 &interaction.ch04-diff.chmod.git;
1a0a78e197c3 Incorporate feedback from Greg Lindahl.
Bryan O'Sullivan <bos@serpentine.com>
parents: 775
diff changeset
717 </sect1>
1a0a78e197c3 Incorporate feedback from Greg Lindahl.
Bryan O'Sullivan <bos@serpentine.com>
parents: 775
diff changeset
718
1a0a78e197c3 Incorporate feedback from Greg Lindahl.
Bryan O'Sullivan <bos@serpentine.com>
parents: 775
diff changeset
719 <sect1>
1a0a78e197c3 Incorporate feedback from Greg Lindahl.
Bryan O'Sullivan <bos@serpentine.com>
parents: 775
diff changeset
720 <title>Which files to manage, and which to avoid</title>
1a0a78e197c3 Incorporate feedback from Greg Lindahl.
Bryan O'Sullivan <bos@serpentine.com>
parents: 775
diff changeset
721
811
a66f6d499afa Add paragraph IDs
Bryan O'Sullivan <bos@serpentine.com>
parents: 810
diff changeset
722 <para id="x_6cc">Revision control systems are generally best at managing text
810
1a0a78e197c3 Incorporate feedback from Greg Lindahl.
Bryan O'Sullivan <bos@serpentine.com>
parents: 775
diff changeset
723 files that are written by humans, such as source code, where the
1a0a78e197c3 Incorporate feedback from Greg Lindahl.
Bryan O'Sullivan <bos@serpentine.com>
parents: 775
diff changeset
724 files do not change much from one revision to the next. Some
1a0a78e197c3 Incorporate feedback from Greg Lindahl.
Bryan O'Sullivan <bos@serpentine.com>
parents: 775
diff changeset
725 centralized revision control systems can also deal tolerably
1a0a78e197c3 Incorporate feedback from Greg Lindahl.
Bryan O'Sullivan <bos@serpentine.com>
parents: 775
diff changeset
726 well with binary files, such as bitmap images.</para>
1a0a78e197c3 Incorporate feedback from Greg Lindahl.
Bryan O'Sullivan <bos@serpentine.com>
parents: 775
diff changeset
727
811
a66f6d499afa Add paragraph IDs
Bryan O'Sullivan <bos@serpentine.com>
parents: 810
diff changeset
728 <para id="x_6cd">For instance, a game development team will typically manage
810
1a0a78e197c3 Incorporate feedback from Greg Lindahl.
Bryan O'Sullivan <bos@serpentine.com>
parents: 775
diff changeset
729 both its source code and all of its binary assets (e.g. geometry
1a0a78e197c3 Incorporate feedback from Greg Lindahl.
Bryan O'Sullivan <bos@serpentine.com>
parents: 775
diff changeset
730 data, textures, map layouts) in a revision control
1a0a78e197c3 Incorporate feedback from Greg Lindahl.
Bryan O'Sullivan <bos@serpentine.com>
parents: 775
diff changeset
731 system.</para>
1a0a78e197c3 Incorporate feedback from Greg Lindahl.
Bryan O'Sullivan <bos@serpentine.com>
parents: 775
diff changeset
732
811
a66f6d499afa Add paragraph IDs
Bryan O'Sullivan <bos@serpentine.com>
parents: 810
diff changeset
733 <para id="x_6ce">Because it is usually impossible to merge two conflicting
810
1a0a78e197c3 Incorporate feedback from Greg Lindahl.
Bryan O'Sullivan <bos@serpentine.com>
parents: 775
diff changeset
734 modifications to a binary file, centralized systems often
1a0a78e197c3 Incorporate feedback from Greg Lindahl.
Bryan O'Sullivan <bos@serpentine.com>
parents: 775
diff changeset
735 provide a file locking mechanism that allow a user to say
1a0a78e197c3 Incorporate feedback from Greg Lindahl.
Bryan O'Sullivan <bos@serpentine.com>
parents: 775
diff changeset
736 <quote>I am the only person who can edit this
1a0a78e197c3 Incorporate feedback from Greg Lindahl.
Bryan O'Sullivan <bos@serpentine.com>
parents: 775
diff changeset
737 file</quote>.</para>
1a0a78e197c3 Incorporate feedback from Greg Lindahl.
Bryan O'Sullivan <bos@serpentine.com>
parents: 775
diff changeset
738
811
a66f6d499afa Add paragraph IDs
Bryan O'Sullivan <bos@serpentine.com>
parents: 810
diff changeset
739 <para id="x_6cf">Compared to a centralized system, a distributed revision
810
1a0a78e197c3 Incorporate feedback from Greg Lindahl.
Bryan O'Sullivan <bos@serpentine.com>
parents: 775
diff changeset
740 control system changes some of the factors that guide decisions
1a0a78e197c3 Incorporate feedback from Greg Lindahl.
Bryan O'Sullivan <bos@serpentine.com>
parents: 775
diff changeset
741 over which files to manage and how.</para>
1a0a78e197c3 Incorporate feedback from Greg Lindahl.
Bryan O'Sullivan <bos@serpentine.com>
parents: 775
diff changeset
742
811
a66f6d499afa Add paragraph IDs
Bryan O'Sullivan <bos@serpentine.com>
parents: 810
diff changeset
743 <para id="x_6d0">For instance, a distributed revision control system cannot,
810
1a0a78e197c3 Incorporate feedback from Greg Lindahl.
Bryan O'Sullivan <bos@serpentine.com>
parents: 775
diff changeset
744 by its nature, offer a file locking facility. There is thus no
1a0a78e197c3 Incorporate feedback from Greg Lindahl.
Bryan O'Sullivan <bos@serpentine.com>
parents: 775
diff changeset
745 built-in mechanism to prevent two people from making conflicting
1a0a78e197c3 Incorporate feedback from Greg Lindahl.
Bryan O'Sullivan <bos@serpentine.com>
parents: 775
diff changeset
746 changes to a binary file. If you have a team where several
1a0a78e197c3 Incorporate feedback from Greg Lindahl.
Bryan O'Sullivan <bos@serpentine.com>
parents: 775
diff changeset
747 people may be editing binary files frequently, it may not be a
1a0a78e197c3 Incorporate feedback from Greg Lindahl.
Bryan O'Sullivan <bos@serpentine.com>
parents: 775
diff changeset
748 good idea to use Mercurial&emdash;or any other distributed
1a0a78e197c3 Incorporate feedback from Greg Lindahl.
Bryan O'Sullivan <bos@serpentine.com>
parents: 775
diff changeset
749 revision control system&emdash;to manage those files.</para>
1a0a78e197c3 Incorporate feedback from Greg Lindahl.
Bryan O'Sullivan <bos@serpentine.com>
parents: 775
diff changeset
750
811
a66f6d499afa Add paragraph IDs
Bryan O'Sullivan <bos@serpentine.com>
parents: 810
diff changeset
751 <para id="x_6d1">When storing modifications to a file, Mercurial usually
810
1a0a78e197c3 Incorporate feedback from Greg Lindahl.
Bryan O'Sullivan <bos@serpentine.com>
parents: 775
diff changeset
752 saves only the differences between the previous and current
1a0a78e197c3 Incorporate feedback from Greg Lindahl.
Bryan O'Sullivan <bos@serpentine.com>
parents: 775
diff changeset
753 versions of the file. For most text files, this is extremely
1a0a78e197c3 Incorporate feedback from Greg Lindahl.
Bryan O'Sullivan <bos@serpentine.com>
parents: 775
diff changeset
754 efficient. However, some files (particularly binary files) are
1a0a78e197c3 Incorporate feedback from Greg Lindahl.
Bryan O'Sullivan <bos@serpentine.com>
parents: 775
diff changeset
755 laid out in such a way that even a small change to a file's
1a0a78e197c3 Incorporate feedback from Greg Lindahl.
Bryan O'Sullivan <bos@serpentine.com>
parents: 775
diff changeset
756 logical content results in many or most of the bytes inside the
1a0a78e197c3 Incorporate feedback from Greg Lindahl.
Bryan O'Sullivan <bos@serpentine.com>
parents: 775
diff changeset
757 file changing. For instance, compressed files are particularly
1a0a78e197c3 Incorporate feedback from Greg Lindahl.
Bryan O'Sullivan <bos@serpentine.com>
parents: 775
diff changeset
758 susceptible to this. If the differences between each successive
1a0a78e197c3 Incorporate feedback from Greg Lindahl.
Bryan O'Sullivan <bos@serpentine.com>
parents: 775
diff changeset
759 version of a file are always large, Mercurial will not be able
1a0a78e197c3 Incorporate feedback from Greg Lindahl.
Bryan O'Sullivan <bos@serpentine.com>
parents: 775
diff changeset
760 to store the file's revision history very efficiently. This can
1a0a78e197c3 Incorporate feedback from Greg Lindahl.
Bryan O'Sullivan <bos@serpentine.com>
parents: 775
diff changeset
761 affect both local storage needs and the amount of time it takes
1a0a78e197c3 Incorporate feedback from Greg Lindahl.
Bryan O'Sullivan <bos@serpentine.com>
parents: 775
diff changeset
762 to clone a repository.</para>
1a0a78e197c3 Incorporate feedback from Greg Lindahl.
Bryan O'Sullivan <bos@serpentine.com>
parents: 775
diff changeset
763
811
a66f6d499afa Add paragraph IDs
Bryan O'Sullivan <bos@serpentine.com>
parents: 810
diff changeset
764 <para id="x_6d2">To get an idea of how this could affect you in practice,
810
1a0a78e197c3 Incorporate feedback from Greg Lindahl.
Bryan O'Sullivan <bos@serpentine.com>
parents: 775
diff changeset
765 suppose you want to use Mercurial to manage an OpenOffice
1a0a78e197c3 Incorporate feedback from Greg Lindahl.
Bryan O'Sullivan <bos@serpentine.com>
parents: 775
diff changeset
766 document. OpenOffice stores documents on disk as compressed zip
1a0a78e197c3 Incorporate feedback from Greg Lindahl.
Bryan O'Sullivan <bos@serpentine.com>
parents: 775
diff changeset
767 files. Edit even a single letter of your document in OpenOffice,
1a0a78e197c3 Incorporate feedback from Greg Lindahl.
Bryan O'Sullivan <bos@serpentine.com>
parents: 775
diff changeset
768 and almost every byte in the entire file will change when you
1a0a78e197c3 Incorporate feedback from Greg Lindahl.
Bryan O'Sullivan <bos@serpentine.com>
parents: 775
diff changeset
769 save it. Now suppose that file is 2MB in size. Because most of
1a0a78e197c3 Incorporate feedback from Greg Lindahl.
Bryan O'Sullivan <bos@serpentine.com>
parents: 775
diff changeset
770 the file changes every time you save, Mercurial will have to
1a0a78e197c3 Incorporate feedback from Greg Lindahl.
Bryan O'Sullivan <bos@serpentine.com>
parents: 775
diff changeset
771 store all 2MB of the file every time you commit, even though
1a0a78e197c3 Incorporate feedback from Greg Lindahl.
Bryan O'Sullivan <bos@serpentine.com>
parents: 775
diff changeset
772 from your perspective, perhaps only a few words are changing
1a0a78e197c3 Incorporate feedback from Greg Lindahl.
Bryan O'Sullivan <bos@serpentine.com>
parents: 775
diff changeset
773 each time. A single frequently-edited file that is not friendly
1a0a78e197c3 Incorporate feedback from Greg Lindahl.
Bryan O'Sullivan <bos@serpentine.com>
parents: 775
diff changeset
774 to Mercurial's storage assumptions can easily have an outsized
1a0a78e197c3 Incorporate feedback from Greg Lindahl.
Bryan O'Sullivan <bos@serpentine.com>
parents: 775
diff changeset
775 effect on the size of the repository.</para>
1a0a78e197c3 Incorporate feedback from Greg Lindahl.
Bryan O'Sullivan <bos@serpentine.com>
parents: 775
diff changeset
776
811
a66f6d499afa Add paragraph IDs
Bryan O'Sullivan <bos@serpentine.com>
parents: 810
diff changeset
777 <para id="x_6d3">Even worse, if both you and someone else edit the OpenOffice
810
1a0a78e197c3 Incorporate feedback from Greg Lindahl.
Bryan O'Sullivan <bos@serpentine.com>
parents: 775
diff changeset
778 document you're working on, there is no useful way to merge your
1a0a78e197c3 Incorporate feedback from Greg Lindahl.
Bryan O'Sullivan <bos@serpentine.com>
parents: 775
diff changeset
779 work. In fact, there isn't even a good way to tell what the
1a0a78e197c3 Incorporate feedback from Greg Lindahl.
Bryan O'Sullivan <bos@serpentine.com>
parents: 775
diff changeset
780 differences are between your respective changes.</para>
1a0a78e197c3 Incorporate feedback from Greg Lindahl.
Bryan O'Sullivan <bos@serpentine.com>
parents: 775
diff changeset
781
811
a66f6d499afa Add paragraph IDs
Bryan O'Sullivan <bos@serpentine.com>
parents: 810
diff changeset
782 <para id="x_6d4">There are thus a few clear recommendations about specific
810
1a0a78e197c3 Incorporate feedback from Greg Lindahl.
Bryan O'Sullivan <bos@serpentine.com>
parents: 775
diff changeset
783 kinds of files to be very careful with.</para>
1a0a78e197c3 Incorporate feedback from Greg Lindahl.
Bryan O'Sullivan <bos@serpentine.com>
parents: 775
diff changeset
784
1a0a78e197c3 Incorporate feedback from Greg Lindahl.
Bryan O'Sullivan <bos@serpentine.com>
parents: 775
diff changeset
785 <itemizedlist>
1a0a78e197c3 Incorporate feedback from Greg Lindahl.
Bryan O'Sullivan <bos@serpentine.com>
parents: 775
diff changeset
786 <listitem>
811
a66f6d499afa Add paragraph IDs
Bryan O'Sullivan <bos@serpentine.com>
parents: 810
diff changeset
787 <para id="x_6d5">Files that are very large and incompressible, e.g. ISO
810
1a0a78e197c3 Incorporate feedback from Greg Lindahl.
Bryan O'Sullivan <bos@serpentine.com>
parents: 775
diff changeset
788 CD-ROM images, will by virtue of sheer size make clones over
1a0a78e197c3 Incorporate feedback from Greg Lindahl.
Bryan O'Sullivan <bos@serpentine.com>
parents: 775
diff changeset
789 a network very slow.</para>
1a0a78e197c3 Incorporate feedback from Greg Lindahl.
Bryan O'Sullivan <bos@serpentine.com>
parents: 775
diff changeset
790 </listitem>
1a0a78e197c3 Incorporate feedback from Greg Lindahl.
Bryan O'Sullivan <bos@serpentine.com>
parents: 775
diff changeset
791 <listitem>
811
a66f6d499afa Add paragraph IDs
Bryan O'Sullivan <bos@serpentine.com>
parents: 810
diff changeset
792 <para id="x_6d6">Files that change a lot from one revision to the next
810
1a0a78e197c3 Incorporate feedback from Greg Lindahl.
Bryan O'Sullivan <bos@serpentine.com>
parents: 775
diff changeset
793 may be expensive to store if you edit them frequently, and
1a0a78e197c3 Incorporate feedback from Greg Lindahl.
Bryan O'Sullivan <bos@serpentine.com>
parents: 775
diff changeset
794 conflicts due to concurrent edits may be difficult to
1a0a78e197c3 Incorporate feedback from Greg Lindahl.
Bryan O'Sullivan <bos@serpentine.com>
parents: 775
diff changeset
795 resolve.</para>
1a0a78e197c3 Incorporate feedback from Greg Lindahl.
Bryan O'Sullivan <bos@serpentine.com>
parents: 775
diff changeset
796 </listitem>
1a0a78e197c3 Incorporate feedback from Greg Lindahl.
Bryan O'Sullivan <bos@serpentine.com>
parents: 775
diff changeset
797 </itemizedlist>
1a0a78e197c3 Incorporate feedback from Greg Lindahl.
Bryan O'Sullivan <bos@serpentine.com>
parents: 775
diff changeset
798 </sect1>
1a0a78e197c3 Incorporate feedback from Greg Lindahl.
Bryan O'Sullivan <bos@serpentine.com>
parents: 775
diff changeset
799
1a0a78e197c3 Incorporate feedback from Greg Lindahl.
Bryan O'Sullivan <bos@serpentine.com>
parents: 775
diff changeset
800 <sect1>
1a0a78e197c3 Incorporate feedback from Greg Lindahl.
Bryan O'Sullivan <bos@serpentine.com>
parents: 775
diff changeset
801 <title>Backups and mirroring</title>
1a0a78e197c3 Incorporate feedback from Greg Lindahl.
Bryan O'Sullivan <bos@serpentine.com>
parents: 775
diff changeset
802
811
a66f6d499afa Add paragraph IDs
Bryan O'Sullivan <bos@serpentine.com>
parents: 810
diff changeset
803 <para id="x_6d7">Since Mercurial maintains a complete copy of history in each
810
1a0a78e197c3 Incorporate feedback from Greg Lindahl.
Bryan O'Sullivan <bos@serpentine.com>
parents: 775
diff changeset
804 clone, everyone who uses Mercurial to collaborate on a project
1a0a78e197c3 Incorporate feedback from Greg Lindahl.
Bryan O'Sullivan <bos@serpentine.com>
parents: 775
diff changeset
805 can potentially act as a source of backups in the event of a
1a0a78e197c3 Incorporate feedback from Greg Lindahl.
Bryan O'Sullivan <bos@serpentine.com>
parents: 775
diff changeset
806 catastrophe. If a central repository becomes unavailable, you
1a0a78e197c3 Incorporate feedback from Greg Lindahl.
Bryan O'Sullivan <bos@serpentine.com>
parents: 775
diff changeset
807 can construct a replacement simply by cloning a copy of the
1a0a78e197c3 Incorporate feedback from Greg Lindahl.
Bryan O'Sullivan <bos@serpentine.com>
parents: 775
diff changeset
808 repository from one contributor, and pulling any changes they
1a0a78e197c3 Incorporate feedback from Greg Lindahl.
Bryan O'Sullivan <bos@serpentine.com>
parents: 775
diff changeset
809 may not have seen from others.</para>
1a0a78e197c3 Incorporate feedback from Greg Lindahl.
Bryan O'Sullivan <bos@serpentine.com>
parents: 775
diff changeset
810
811
a66f6d499afa Add paragraph IDs
Bryan O'Sullivan <bos@serpentine.com>
parents: 810
diff changeset
811 <para id="x_6d8">It is simple to use Mercurial to perform off-site backups
810
1a0a78e197c3 Incorporate feedback from Greg Lindahl.
Bryan O'Sullivan <bos@serpentine.com>
parents: 775
diff changeset
812 and remote mirrors. Set up a periodic job (e.g. via the
1a0a78e197c3 Incorporate feedback from Greg Lindahl.
Bryan O'Sullivan <bos@serpentine.com>
parents: 775
diff changeset
813 <command>cron</command> command) on a remote server to pull
1a0a78e197c3 Incorporate feedback from Greg Lindahl.
Bryan O'Sullivan <bos@serpentine.com>
parents: 775
diff changeset
814 changes from your master repositories every hour. This will
1a0a78e197c3 Incorporate feedback from Greg Lindahl.
Bryan O'Sullivan <bos@serpentine.com>
parents: 775
diff changeset
815 only be tricky in the unlikely case that the number of master
1a0a78e197c3 Incorporate feedback from Greg Lindahl.
Bryan O'Sullivan <bos@serpentine.com>
parents: 775
diff changeset
816 repositories you maintain changes frequently, in which case
1a0a78e197c3 Incorporate feedback from Greg Lindahl.
Bryan O'Sullivan <bos@serpentine.com>
parents: 775
diff changeset
817 you'll need to do a little scripting to refresh the list of
1a0a78e197c3 Incorporate feedback from Greg Lindahl.
Bryan O'Sullivan <bos@serpentine.com>
parents: 775
diff changeset
818 repositories to back up.</para>
1a0a78e197c3 Incorporate feedback from Greg Lindahl.
Bryan O'Sullivan <bos@serpentine.com>
parents: 775
diff changeset
819
811
a66f6d499afa Add paragraph IDs
Bryan O'Sullivan <bos@serpentine.com>
parents: 810
diff changeset
820 <para id="x_6d9">If you perform traditional backups of your master
810
1a0a78e197c3 Incorporate feedback from Greg Lindahl.
Bryan O'Sullivan <bos@serpentine.com>
parents: 775
diff changeset
821 repositories to tape or disk, and you want to back up a
828
477d6a3e5023 Many final changes.
Bryan O'Sullivan <bos@serpentine.com>
parents: 812
diff changeset
822 repository named <filename>myrepo</filename>, use <command>hg
810
1a0a78e197c3 Incorporate feedback from Greg Lindahl.
Bryan O'Sullivan <bos@serpentine.com>
parents: 775
diff changeset
823 clone -U myrepo myrepo.bak</command> to create a
1a0a78e197c3 Incorporate feedback from Greg Lindahl.
Bryan O'Sullivan <bos@serpentine.com>
parents: 775
diff changeset
824 clone of <filename>myrepo</filename> before you start your
1a0a78e197c3 Incorporate feedback from Greg Lindahl.
Bryan O'Sullivan <bos@serpentine.com>
parents: 775
diff changeset
825 backups. The <option>-U</option> option doesn't check out a
1a0a78e197c3 Incorporate feedback from Greg Lindahl.
Bryan O'Sullivan <bos@serpentine.com>
parents: 775
diff changeset
826 working directory after the clone completes, since that would be
812
6b7818eb3d8e Fix bogons
Bryan O'Sullivan <bos@serpentine.com>
parents: 811
diff changeset
827 superfluous and make the backup take longer.</para>
810
1a0a78e197c3 Incorporate feedback from Greg Lindahl.
Bryan O'Sullivan <bos@serpentine.com>
parents: 775
diff changeset
828
811
a66f6d499afa Add paragraph IDs
Bryan O'Sullivan <bos@serpentine.com>
parents: 810
diff changeset
829 <para id="x_6da">If you then back up <filename>myrepo.bak</filename> instead
810
1a0a78e197c3 Incorporate feedback from Greg Lindahl.
Bryan O'Sullivan <bos@serpentine.com>
parents: 775
diff changeset
830 of <filename>myrepo</filename>, you will be guaranteed to have a
1a0a78e197c3 Incorporate feedback from Greg Lindahl.
Bryan O'Sullivan <bos@serpentine.com>
parents: 775
diff changeset
831 consistent snapshot of your repository that won't be pushed to
1a0a78e197c3 Incorporate feedback from Greg Lindahl.
Bryan O'Sullivan <bos@serpentine.com>
parents: 775
diff changeset
832 by an insomniac developer in mid-backup.</para>
1a0a78e197c3 Incorporate feedback from Greg Lindahl.
Bryan O'Sullivan <bos@serpentine.com>
parents: 775
diff changeset
833 </sect1>
658
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
834 </chapter>
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
835
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
836 <!--
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
837 local variables:
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
838 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
839 end:
b90b024729f1 WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents: 650
diff changeset
840 -->