Mercurial > hgbook
annotate ja/daily.tex @ 368:7ef84661e43e
started daily.tex either.
author | Yoshiki Yazawa <yaz@honeyplanet.jp> |
---|---|
date | Sat, 01 Nov 2008 14:37:00 +0900 |
parents | 32d33b238b7e |
children | 9f7812b79c70 |
rev | line source |
---|---|
368
7ef84661e43e
started daily.tex either.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
348
diff
changeset
|
1 %\chapter{Mercurial in daily use} |
7ef84661e43e
started daily.tex either.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
348
diff
changeset
|
2 \chapter{Mercurial$B$G$NF|>o:n6H(B} |
42
cbfa08bcf181
Start the "Mercurial in daily use" chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
3 \label{chap:daily} |
cbfa08bcf181
Start the "Mercurial in daily use" chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
4 |
368
7ef84661e43e
started daily.tex either.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
348
diff
changeset
|
5 %\section{Telling Mercurial which files to track} |
7ef84661e43e
started daily.tex either.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
348
diff
changeset
|
6 \section{$BDI@W$9$Y$-%U%!%$%k$N(BMercurial$B$X$NEPO?(B} |
42
cbfa08bcf181
Start the "Mercurial in daily use" chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
7 |
cbfa08bcf181
Start the "Mercurial in daily use" chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
8 Mercurial does not work with files in your repository unless you tell |
cbfa08bcf181
Start the "Mercurial in daily use" chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
9 it to manage them. The \hgcmd{status} command will tell you which |
cbfa08bcf181
Start the "Mercurial in daily use" chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
10 files Mercurial doesn't know about; it uses a ``\texttt{?}'' to |
cbfa08bcf181
Start the "Mercurial in daily use" chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
11 display such files. |
cbfa08bcf181
Start the "Mercurial in daily use" chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
12 |
cbfa08bcf181
Start the "Mercurial in daily use" chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
13 To tell Mercurial to track a file, use the \hgcmd{add} command. Once |
cbfa08bcf181
Start the "Mercurial in daily use" chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
14 you have added a file, the entry in the output of \hgcmd{status} for |
cbfa08bcf181
Start the "Mercurial in daily use" chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
15 that file changes from ``\texttt{?}'' to ``\texttt{A}''. |
117
6b0f4498569e
Beef up daily routine material. Focus on merge-across-copy.
Bryan O'Sullivan <bos@serpentine.com>
parents:
43
diff
changeset
|
16 \interaction{daily.files.add} |
42
cbfa08bcf181
Start the "Mercurial in daily use" chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
17 |
cbfa08bcf181
Start the "Mercurial in daily use" chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
18 After you run a \hgcmd{commit}, the files that you added before the |
cbfa08bcf181
Start the "Mercurial in daily use" chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
19 commit will no longer be listed in the output of \hgcmd{status}. The |
cbfa08bcf181
Start the "Mercurial in daily use" chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
20 reason for this is that \hgcmd{status} only tells you about |
117
6b0f4498569e
Beef up daily routine material. Focus on merge-across-copy.
Bryan O'Sullivan <bos@serpentine.com>
parents:
43
diff
changeset
|
21 ``interesting'' files---those that you have modified or told Mercurial |
6b0f4498569e
Beef up daily routine material. Focus on merge-across-copy.
Bryan O'Sullivan <bos@serpentine.com>
parents:
43
diff
changeset
|
22 to do something with---by default. If you have a repository that |
42
cbfa08bcf181
Start the "Mercurial in daily use" chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
23 contains thousands of files, you will rarely want to know about files |
cbfa08bcf181
Start the "Mercurial in daily use" chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
24 that Mercurial is tracking, but that have not changed. (You can still |
cbfa08bcf181
Start the "Mercurial in daily use" chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
25 get this information; we'll return to this later.) |
cbfa08bcf181
Start the "Mercurial in daily use" chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
26 |
117
6b0f4498569e
Beef up daily routine material. Focus on merge-across-copy.
Bryan O'Sullivan <bos@serpentine.com>
parents:
43
diff
changeset
|
27 Once you add a file, Mercurial doesn't do anything with it |
6b0f4498569e
Beef up daily routine material. Focus on merge-across-copy.
Bryan O'Sullivan <bos@serpentine.com>
parents:
43
diff
changeset
|
28 immediately. Instead, it will take a snapshot of the file's state the |
6b0f4498569e
Beef up daily routine material. Focus on merge-across-copy.
Bryan O'Sullivan <bos@serpentine.com>
parents:
43
diff
changeset
|
29 next time you perform a commit. It will then continue to track the |
6b0f4498569e
Beef up daily routine material. Focus on merge-across-copy.
Bryan O'Sullivan <bos@serpentine.com>
parents:
43
diff
changeset
|
30 changes you make to the file every time you commit, until you remove |
6b0f4498569e
Beef up daily routine material. Focus on merge-across-copy.
Bryan O'Sullivan <bos@serpentine.com>
parents:
43
diff
changeset
|
31 the file. |
6b0f4498569e
Beef up daily routine material. Focus on merge-across-copy.
Bryan O'Sullivan <bos@serpentine.com>
parents:
43
diff
changeset
|
32 |
368
7ef84661e43e
started daily.tex either.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
348
diff
changeset
|
33 %\subsection{Explicit versus implicit file naming} |
7ef84661e43e
started daily.tex either.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
348
diff
changeset
|
34 \subsection{$BL@<(E*$J%U%!%$%kL?L>BP0EL[$N%U%!%$%kL?L>(B} |
42
cbfa08bcf181
Start the "Mercurial in daily use" chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
35 |
117
6b0f4498569e
Beef up daily routine material. Focus on merge-across-copy.
Bryan O'Sullivan <bos@serpentine.com>
parents:
43
diff
changeset
|
36 A useful behaviour that Mercurial has is that if you pass the name of |
6b0f4498569e
Beef up daily routine material. Focus on merge-across-copy.
Bryan O'Sullivan <bos@serpentine.com>
parents:
43
diff
changeset
|
37 a directory to a command, every Mercurial command will treat this as |
6b0f4498569e
Beef up daily routine material. Focus on merge-across-copy.
Bryan O'Sullivan <bos@serpentine.com>
parents:
43
diff
changeset
|
38 ``I want to operate on every file in this directory and its |
6b0f4498569e
Beef up daily routine material. Focus on merge-across-copy.
Bryan O'Sullivan <bos@serpentine.com>
parents:
43
diff
changeset
|
39 subdirectories''. |
6b0f4498569e
Beef up daily routine material. Focus on merge-across-copy.
Bryan O'Sullivan <bos@serpentine.com>
parents:
43
diff
changeset
|
40 \interaction{daily.files.add-dir} |
6b0f4498569e
Beef up daily routine material. Focus on merge-across-copy.
Bryan O'Sullivan <bos@serpentine.com>
parents:
43
diff
changeset
|
41 Notice in this example that Mercurial printed the names of the files |
6b0f4498569e
Beef up daily routine material. Focus on merge-across-copy.
Bryan O'Sullivan <bos@serpentine.com>
parents:
43
diff
changeset
|
42 it added, whereas it didn't do so when we added the file named |
6b0f4498569e
Beef up daily routine material. Focus on merge-across-copy.
Bryan O'Sullivan <bos@serpentine.com>
parents:
43
diff
changeset
|
43 \filename{a} in the earlier example. |
42
cbfa08bcf181
Start the "Mercurial in daily use" chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
44 |
117
6b0f4498569e
Beef up daily routine material. Focus on merge-across-copy.
Bryan O'Sullivan <bos@serpentine.com>
parents:
43
diff
changeset
|
45 What's going on is that in the former case, we explicitly named the |
6b0f4498569e
Beef up daily routine material. Focus on merge-across-copy.
Bryan O'Sullivan <bos@serpentine.com>
parents:
43
diff
changeset
|
46 file to add on the command line, so the assumption that Mercurial |
178
1b55292716a4
correct single typo in chpt 5 text
Steve Guidon <steve.guidon@gmail.com>
parents:
156
diff
changeset
|
47 makes in such cases is that you know what you were doing, and it |
117
6b0f4498569e
Beef up daily routine material. Focus on merge-across-copy.
Bryan O'Sullivan <bos@serpentine.com>
parents:
43
diff
changeset
|
48 doesn't print any output. |
6b0f4498569e
Beef up daily routine material. Focus on merge-across-copy.
Bryan O'Sullivan <bos@serpentine.com>
parents:
43
diff
changeset
|
49 |
6b0f4498569e
Beef up daily routine material. Focus on merge-across-copy.
Bryan O'Sullivan <bos@serpentine.com>
parents:
43
diff
changeset
|
50 However, when we \emph{imply} the names of files by giving the name of |
6b0f4498569e
Beef up daily routine material. Focus on merge-across-copy.
Bryan O'Sullivan <bos@serpentine.com>
parents:
43
diff
changeset
|
51 a directory, Mercurial takes the extra step of printing the name of |
6b0f4498569e
Beef up daily routine material. Focus on merge-across-copy.
Bryan O'Sullivan <bos@serpentine.com>
parents:
43
diff
changeset
|
52 each file that it does something with. This makes it more clear what |
6b0f4498569e
Beef up daily routine material. Focus on merge-across-copy.
Bryan O'Sullivan <bos@serpentine.com>
parents:
43
diff
changeset
|
53 is happening, and reduces the likelihood of a silent and nasty |
6b0f4498569e
Beef up daily routine material. Focus on merge-across-copy.
Bryan O'Sullivan <bos@serpentine.com>
parents:
43
diff
changeset
|
54 surprise. This behaviour is common to most Mercurial commands. |
6b0f4498569e
Beef up daily routine material. Focus on merge-across-copy.
Bryan O'Sullivan <bos@serpentine.com>
parents:
43
diff
changeset
|
55 |
368
7ef84661e43e
started daily.tex either.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
348
diff
changeset
|
56 %\subsection{Aside: Mercurial tracks files, not directories} |
7ef84661e43e
started daily.tex either.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
348
diff
changeset
|
57 \subsection{$B$3$\$lOC(B: Mercurial$B$O%G%#%l%/%H%j$G$O$J$/%U%!%$%k$rDI@W$9$k(B} |
42
cbfa08bcf181
Start the "Mercurial in daily use" chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
58 |
cbfa08bcf181
Start the "Mercurial in daily use" chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
59 Mercurial does not track directory information. Instead, it tracks |
117
6b0f4498569e
Beef up daily routine material. Focus on merge-across-copy.
Bryan O'Sullivan <bos@serpentine.com>
parents:
43
diff
changeset
|
60 the path to a file. Before creating a file, it first creates any |
6b0f4498569e
Beef up daily routine material. Focus on merge-across-copy.
Bryan O'Sullivan <bos@serpentine.com>
parents:
43
diff
changeset
|
61 missing directory components of the path. After it deletes a file, it |
6b0f4498569e
Beef up daily routine material. Focus on merge-across-copy.
Bryan O'Sullivan <bos@serpentine.com>
parents:
43
diff
changeset
|
62 then deletes any empty directories that were in the deleted file's |
6b0f4498569e
Beef up daily routine material. Focus on merge-across-copy.
Bryan O'Sullivan <bos@serpentine.com>
parents:
43
diff
changeset
|
63 path. This sounds like a trivial distinction, but it has one minor |
42
cbfa08bcf181
Start the "Mercurial in daily use" chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
64 practical consequence: it is not possible to represent a completely |
cbfa08bcf181
Start the "Mercurial in daily use" chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
65 empty directory in Mercurial. |
cbfa08bcf181
Start the "Mercurial in daily use" chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
66 |
cbfa08bcf181
Start the "Mercurial in daily use" chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
67 Empty directories are rarely useful, and there are unintrusive |
cbfa08bcf181
Start the "Mercurial in daily use" chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
68 workarounds that you can use to achieve an appropriate effect. The |
cbfa08bcf181
Start the "Mercurial in daily use" chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
69 developers of Mercurial thus felt that the complexity that would be |
cbfa08bcf181
Start the "Mercurial in daily use" chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
70 required to manage empty directories was not worth the limited benefit |
cbfa08bcf181
Start the "Mercurial in daily use" chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
71 this feature would bring. |
cbfa08bcf181
Start the "Mercurial in daily use" chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
72 |
cbfa08bcf181
Start the "Mercurial in daily use" chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
73 If you need an empty directory in your repository, there are a few |
cbfa08bcf181
Start the "Mercurial in daily use" chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
74 ways to achieve this. One is to create a directory, then \hgcmd{add} a |
cbfa08bcf181
Start the "Mercurial in daily use" chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
75 ``hidden'' file to that directory. On Unix-like systems, any file |
cbfa08bcf181
Start the "Mercurial in daily use" chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
76 name that begins with a period (``\texttt{.}'') is treated as hidden |
cbfa08bcf181
Start the "Mercurial in daily use" chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
77 by most commands and GUI tools. This approach is illustrated in |
43 | 78 figure~\ref{ex:daily:hidden}. |
42
cbfa08bcf181
Start the "Mercurial in daily use" chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
79 |
cbfa08bcf181
Start the "Mercurial in daily use" chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
80 \begin{figure}[ht] |
43 | 81 \interaction{daily.files.hidden} |
82 \caption{Simulating an empty directory using a hidden file} | |
83 \label{ex:daily:hidden} | |
42
cbfa08bcf181
Start the "Mercurial in daily use" chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
84 \end{figure} |
cbfa08bcf181
Start the "Mercurial in daily use" chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
85 |
cbfa08bcf181
Start the "Mercurial in daily use" chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
86 Another way to tackle a need for an empty directory is to simply |
cbfa08bcf181
Start the "Mercurial in daily use" chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
87 create one in your automated build scripts before they will need it. |
cbfa08bcf181
Start the "Mercurial in daily use" chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
88 |
368
7ef84661e43e
started daily.tex either.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
348
diff
changeset
|
89 %\section{How to stop tracking a file} |
7ef84661e43e
started daily.tex either.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
348
diff
changeset
|
90 \section{$B%U%!%$%kDI@W$NDd;_(B} |
42
cbfa08bcf181
Start the "Mercurial in daily use" chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
91 |
117
6b0f4498569e
Beef up daily routine material. Focus on merge-across-copy.
Bryan O'Sullivan <bos@serpentine.com>
parents:
43
diff
changeset
|
92 Once you decide that a file no longer belongs in your repository, use |
42
cbfa08bcf181
Start the "Mercurial in daily use" chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
93 the \hgcmd{remove} command; this deletes the file, and tells Mercurial |
43 | 94 to stop tracking it. A removed file is represented in the output of |
95 \hgcmd{status} with a ``\texttt{R}''. | |
117
6b0f4498569e
Beef up daily routine material. Focus on merge-across-copy.
Bryan O'Sullivan <bos@serpentine.com>
parents:
43
diff
changeset
|
96 \interaction{daily.files.remove} |
42
cbfa08bcf181
Start the "Mercurial in daily use" chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
97 |
118
1ee53cb37a99
More progress on daily work.
Bryan O'Sullivan <bos@serpentine.com>
parents:
117
diff
changeset
|
98 After you \hgcmd{remove} a file, Mercurial will no longer track |
1ee53cb37a99
More progress on daily work.
Bryan O'Sullivan <bos@serpentine.com>
parents:
117
diff
changeset
|
99 changes to that file, even if you recreate a file with the same name |
1ee53cb37a99
More progress on daily work.
Bryan O'Sullivan <bos@serpentine.com>
parents:
117
diff
changeset
|
100 in your working directory. If you do recreate a file with the same |
1ee53cb37a99
More progress on daily work.
Bryan O'Sullivan <bos@serpentine.com>
parents:
117
diff
changeset
|
101 name and want Mercurial to track the new file, simply \hgcmd{add} it. |
1ee53cb37a99
More progress on daily work.
Bryan O'Sullivan <bos@serpentine.com>
parents:
117
diff
changeset
|
102 Mercurial will know that the newly added file is not related to the |
1ee53cb37a99
More progress on daily work.
Bryan O'Sullivan <bos@serpentine.com>
parents:
117
diff
changeset
|
103 old file of the same name. |
1ee53cb37a99
More progress on daily work.
Bryan O'Sullivan <bos@serpentine.com>
parents:
117
diff
changeset
|
104 |
368
7ef84661e43e
started daily.tex either.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
348
diff
changeset
|
105 %\subsection{Removing a file does not affect its history} |
7ef84661e43e
started daily.tex either.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
348
diff
changeset
|
106 \subsection{$B%U%!%$%k:o=|$OMzNr$K1F6A$rM?$($J$$(B} |
118
1ee53cb37a99
More progress on daily work.
Bryan O'Sullivan <bos@serpentine.com>
parents:
117
diff
changeset
|
107 |
1ee53cb37a99
More progress on daily work.
Bryan O'Sullivan <bos@serpentine.com>
parents:
117
diff
changeset
|
108 It is important to understand that removing a file has only two |
1ee53cb37a99
More progress on daily work.
Bryan O'Sullivan <bos@serpentine.com>
parents:
117
diff
changeset
|
109 effects. |
1ee53cb37a99
More progress on daily work.
Bryan O'Sullivan <bos@serpentine.com>
parents:
117
diff
changeset
|
110 \begin{itemize} |
1ee53cb37a99
More progress on daily work.
Bryan O'Sullivan <bos@serpentine.com>
parents:
117
diff
changeset
|
111 \item It removes the current version of the file from the working |
1ee53cb37a99
More progress on daily work.
Bryan O'Sullivan <bos@serpentine.com>
parents:
117
diff
changeset
|
112 directory. |
1ee53cb37a99
More progress on daily work.
Bryan O'Sullivan <bos@serpentine.com>
parents:
117
diff
changeset
|
113 \item It stops Mercurial from tracking changes to the file, from the |
1ee53cb37a99
More progress on daily work.
Bryan O'Sullivan <bos@serpentine.com>
parents:
117
diff
changeset
|
114 time of the next commit. |
1ee53cb37a99
More progress on daily work.
Bryan O'Sullivan <bos@serpentine.com>
parents:
117
diff
changeset
|
115 \end{itemize} |
1ee53cb37a99
More progress on daily work.
Bryan O'Sullivan <bos@serpentine.com>
parents:
117
diff
changeset
|
116 Removing a file \emph{does not} in any way alter the \emph{history} of |
1ee53cb37a99
More progress on daily work.
Bryan O'Sullivan <bos@serpentine.com>
parents:
117
diff
changeset
|
117 the file. |
1ee53cb37a99
More progress on daily work.
Bryan O'Sullivan <bos@serpentine.com>
parents:
117
diff
changeset
|
118 |
1ee53cb37a99
More progress on daily work.
Bryan O'Sullivan <bos@serpentine.com>
parents:
117
diff
changeset
|
119 If you update the working directory to a changeset in which a file |
1ee53cb37a99
More progress on daily work.
Bryan O'Sullivan <bos@serpentine.com>
parents:
117
diff
changeset
|
120 that you have removed was still tracked, it will reappear in the |
1ee53cb37a99
More progress on daily work.
Bryan O'Sullivan <bos@serpentine.com>
parents:
117
diff
changeset
|
121 working directory, with the contents it had when you committed that |
1ee53cb37a99
More progress on daily work.
Bryan O'Sullivan <bos@serpentine.com>
parents:
117
diff
changeset
|
122 changeset. If you then update the working directory to a later |
1ee53cb37a99
More progress on daily work.
Bryan O'Sullivan <bos@serpentine.com>
parents:
117
diff
changeset
|
123 changeset, in which the file had been removed, Mercurial will once |
1ee53cb37a99
More progress on daily work.
Bryan O'Sullivan <bos@serpentine.com>
parents:
117
diff
changeset
|
124 again remove the file from the working directory. |
1ee53cb37a99
More progress on daily work.
Bryan O'Sullivan <bos@serpentine.com>
parents:
117
diff
changeset
|
125 |
368
7ef84661e43e
started daily.tex either.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
348
diff
changeset
|
126 %\subsection{Missing files} |
7ef84661e43e
started daily.tex either.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
348
diff
changeset
|
127 \subsection{$B7gMn$7$?%U%!%$%k(B} |
42
cbfa08bcf181
Start the "Mercurial in daily use" chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
128 |
43 | 129 Mercurial considers a file that you have deleted, but not used |
130 \hgcmd{remove} to delete, to be \emph{missing}. A missing file is | |
131 represented with ``\texttt{!}'' in the output of \hgcmd{status}. | |
117
6b0f4498569e
Beef up daily routine material. Focus on merge-across-copy.
Bryan O'Sullivan <bos@serpentine.com>
parents:
43
diff
changeset
|
132 Mercurial commands will not generally do anything with missing files. |
6b0f4498569e
Beef up daily routine material. Focus on merge-across-copy.
Bryan O'Sullivan <bos@serpentine.com>
parents:
43
diff
changeset
|
133 \interaction{daily.files.missing} |
6b0f4498569e
Beef up daily routine material. Focus on merge-across-copy.
Bryan O'Sullivan <bos@serpentine.com>
parents:
43
diff
changeset
|
134 |
6b0f4498569e
Beef up daily routine material. Focus on merge-across-copy.
Bryan O'Sullivan <bos@serpentine.com>
parents:
43
diff
changeset
|
135 If your repository contains a file that \hgcmd{status} reports as |
6b0f4498569e
Beef up daily routine material. Focus on merge-across-copy.
Bryan O'Sullivan <bos@serpentine.com>
parents:
43
diff
changeset
|
136 missing, and you want the file to stay gone, you can run |
6b0f4498569e
Beef up daily routine material. Focus on merge-across-copy.
Bryan O'Sullivan <bos@serpentine.com>
parents:
43
diff
changeset
|
137 \hgcmdargs{remove}{\hgopt{remove}{--after}} at any time later on, to |
6b0f4498569e
Beef up daily routine material. Focus on merge-across-copy.
Bryan O'Sullivan <bos@serpentine.com>
parents:
43
diff
changeset
|
138 tell Mercurial that you really did mean to remove the file. |
6b0f4498569e
Beef up daily routine material. Focus on merge-across-copy.
Bryan O'Sullivan <bos@serpentine.com>
parents:
43
diff
changeset
|
139 \interaction{daily.files.remove-after} |
43 | 140 |
117
6b0f4498569e
Beef up daily routine material. Focus on merge-across-copy.
Bryan O'Sullivan <bos@serpentine.com>
parents:
43
diff
changeset
|
141 On the other hand, if you deleted the missing file by accident, use |
6b0f4498569e
Beef up daily routine material. Focus on merge-across-copy.
Bryan O'Sullivan <bos@serpentine.com>
parents:
43
diff
changeset
|
142 \hgcmdargs{revert}{\emph{filename}} to recover the file. It will |
6b0f4498569e
Beef up daily routine material. Focus on merge-across-copy.
Bryan O'Sullivan <bos@serpentine.com>
parents:
43
diff
changeset
|
143 reappear, in unmodified form. |
6b0f4498569e
Beef up daily routine material. Focus on merge-across-copy.
Bryan O'Sullivan <bos@serpentine.com>
parents:
43
diff
changeset
|
144 \interaction{daily.files.recover-missing} |
6b0f4498569e
Beef up daily routine material. Focus on merge-across-copy.
Bryan O'Sullivan <bos@serpentine.com>
parents:
43
diff
changeset
|
145 |
368
7ef84661e43e
started daily.tex either.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
348
diff
changeset
|
146 %\subsection{Aside: why tell Mercurial explicitly to remove a file?} |
7ef84661e43e
started daily.tex either.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
348
diff
changeset
|
147 \subsection{$B$3$\$lOC(B: $B$J$<(BMercurial$B$X%U%!%$%k$N:o=|$rL@<(E*$K;X<($7$J$1(B |
7ef84661e43e
started daily.tex either.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
348
diff
changeset
|
148 $B$l$P$J$i$J$$$+(B} |
42
cbfa08bcf181
Start the "Mercurial in daily use" chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
149 |
117
6b0f4498569e
Beef up daily routine material. Focus on merge-across-copy.
Bryan O'Sullivan <bos@serpentine.com>
parents:
43
diff
changeset
|
150 You might wonder why Mercurial requires you to explicitly tell it that |
6b0f4498569e
Beef up daily routine material. Focus on merge-across-copy.
Bryan O'Sullivan <bos@serpentine.com>
parents:
43
diff
changeset
|
151 you are deleting a file. Early during the development of Mercurial, |
6b0f4498569e
Beef up daily routine material. Focus on merge-across-copy.
Bryan O'Sullivan <bos@serpentine.com>
parents:
43
diff
changeset
|
152 it let you delete a file however you pleased; Mercurial would notice |
6b0f4498569e
Beef up daily routine material. Focus on merge-across-copy.
Bryan O'Sullivan <bos@serpentine.com>
parents:
43
diff
changeset
|
153 the absence of the file automatically when you next ran a |
6b0f4498569e
Beef up daily routine material. Focus on merge-across-copy.
Bryan O'Sullivan <bos@serpentine.com>
parents:
43
diff
changeset
|
154 \hgcmd{commit}, and stop tracking the file. In practice, this made it |
6b0f4498569e
Beef up daily routine material. Focus on merge-across-copy.
Bryan O'Sullivan <bos@serpentine.com>
parents:
43
diff
changeset
|
155 too easy to accidentally remove a file without noticing. |
6b0f4498569e
Beef up daily routine material. Focus on merge-across-copy.
Bryan O'Sullivan <bos@serpentine.com>
parents:
43
diff
changeset
|
156 |
368
7ef84661e43e
started daily.tex either.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
348
diff
changeset
|
157 %\subsection{Useful shorthand---adding and removing files in one step} |
7ef84661e43e
started daily.tex either.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
348
diff
changeset
|
158 \subsection{$BLr$KN)$D4JN,K!(B---$B%U%!%$%k$NDI2C$H:o=|$r(B1$B%9%F%C%W$G9T$&(B} |
42
cbfa08bcf181
Start the "Mercurial in daily use" chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
159 |
43 | 160 Mercurial offers a combination command, \hgcmd{addremove}, that adds |
368
7ef84661e43e
started daily.tex either.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
348
diff
changeset
|
161 untracked files and marks missing files as removed. |
117
6b0f4498569e
Beef up daily routine material. Focus on merge-across-copy.
Bryan O'Sullivan <bos@serpentine.com>
parents:
43
diff
changeset
|
162 \interaction{daily.files.addremove} |
6b0f4498569e
Beef up daily routine material. Focus on merge-across-copy.
Bryan O'Sullivan <bos@serpentine.com>
parents:
43
diff
changeset
|
163 The \hgcmd{commit} command also provides a \hgopt{commit}{-A} option |
6b0f4498569e
Beef up daily routine material. Focus on merge-across-copy.
Bryan O'Sullivan <bos@serpentine.com>
parents:
43
diff
changeset
|
164 that performs this same add-and-remove, immediately followed by a |
6b0f4498569e
Beef up daily routine material. Focus on merge-across-copy.
Bryan O'Sullivan <bos@serpentine.com>
parents:
43
diff
changeset
|
165 commit. |
6b0f4498569e
Beef up daily routine material. Focus on merge-across-copy.
Bryan O'Sullivan <bos@serpentine.com>
parents:
43
diff
changeset
|
166 \interaction{daily.files.commit-addremove} |
6b0f4498569e
Beef up daily routine material. Focus on merge-across-copy.
Bryan O'Sullivan <bos@serpentine.com>
parents:
43
diff
changeset
|
167 |
368
7ef84661e43e
started daily.tex either.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
348
diff
changeset
|
168 %\section{Copying files} |
7ef84661e43e
started daily.tex either.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
348
diff
changeset
|
169 \section{$B%U%!%$%k$N%3%T!<(B} |
117
6b0f4498569e
Beef up daily routine material. Focus on merge-across-copy.
Bryan O'Sullivan <bos@serpentine.com>
parents:
43
diff
changeset
|
170 |
368
7ef84661e43e
started daily.tex either.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
348
diff
changeset
|
171 %Mercurial provides a \hgcmd{copy} command that lets you make a new |
7ef84661e43e
started daily.tex either.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
348
diff
changeset
|
172 %copy of a file. When you copy a file using this command, Mercurial |
7ef84661e43e
started daily.tex either.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
348
diff
changeset
|
173 %makes a record of the fact that the new file is a copy of the original |
7ef84661e43e
started daily.tex either.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
348
diff
changeset
|
174 %file. It treats these copied files specially when you merge your work |
7ef84661e43e
started daily.tex either.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
348
diff
changeset
|
175 %with someone else's. |
117
6b0f4498569e
Beef up daily routine material. Focus on merge-across-copy.
Bryan O'Sullivan <bos@serpentine.com>
parents:
43
diff
changeset
|
176 |
368
7ef84661e43e
started daily.tex either.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
348
diff
changeset
|
177 Mercurial$B$K$O!$%U%!%$%k$N?7$7$$%3%T!<$r:n$k(B\hgcmd{copy}$B%3%^%s%I$,$"$k!%(B |
7ef84661e43e
started daily.tex either.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
348
diff
changeset
|
178 $B$3$N%3%^%s%I$r;H$C$F%U%!%$%k$r%3%T!<$9$k$H!$(BMercurial$B$O?7$7$$%U%!%$%k$,(B |
7ef84661e43e
started daily.tex either.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
348
diff
changeset
|
179 $B%*%j%8%J%k$NJ#@=$G$"$k$3$H$r5-O?$9$k!%J#@=$5$l$?%U%!%$%k$O!$JL$N?M$K$h$k(B |
7ef84661e43e
started daily.tex either.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
348
diff
changeset
|
180 $BJQ99$r%^!<%8$9$k;~$KFCJL$J<h$j07$$$,$J$5$l$k!%(B |
7ef84661e43e
started daily.tex either.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
348
diff
changeset
|
181 |
7ef84661e43e
started daily.tex either.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
348
diff
changeset
|
182 %\subsection{The results of copying during a merge} |
7ef84661e43e
started daily.tex either.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
348
diff
changeset
|
183 \subsection{$B%^!<%8Cf$N%3%T!<$N7k2L(B} |
121
9094c9fda8ec
Start chapter on error recovery.
Bryan O'Sullivan <bos@serpentine.com>
parents:
118
diff
changeset
|
184 |
117
6b0f4498569e
Beef up daily routine material. Focus on merge-across-copy.
Bryan O'Sullivan <bos@serpentine.com>
parents:
43
diff
changeset
|
185 What happens during a merge is that changes ``follow'' a copy. To |
6b0f4498569e
Beef up daily routine material. Focus on merge-across-copy.
Bryan O'Sullivan <bos@serpentine.com>
parents:
43
diff
changeset
|
186 best illustrate what this means, let's create an example. We'll start |
6b0f4498569e
Beef up daily routine material. Focus on merge-across-copy.
Bryan O'Sullivan <bos@serpentine.com>
parents:
43
diff
changeset
|
187 with the usual tiny repository that contains a single file. |
6b0f4498569e
Beef up daily routine material. Focus on merge-across-copy.
Bryan O'Sullivan <bos@serpentine.com>
parents:
43
diff
changeset
|
188 \interaction{daily.copy.init} |
6b0f4498569e
Beef up daily routine material. Focus on merge-across-copy.
Bryan O'Sullivan <bos@serpentine.com>
parents:
43
diff
changeset
|
189 We need to do some work in parallel, so that we'll have something to |
6b0f4498569e
Beef up daily routine material. Focus on merge-across-copy.
Bryan O'Sullivan <bos@serpentine.com>
parents:
43
diff
changeset
|
190 merge. So let's clone our repository. |
6b0f4498569e
Beef up daily routine material. Focus on merge-across-copy.
Bryan O'Sullivan <bos@serpentine.com>
parents:
43
diff
changeset
|
191 \interaction{daily.copy.clone} |
6b0f4498569e
Beef up daily routine material. Focus on merge-across-copy.
Bryan O'Sullivan <bos@serpentine.com>
parents:
43
diff
changeset
|
192 Back in our initial repository, let's use the \hgcmd{copy} command to |
6b0f4498569e
Beef up daily routine material. Focus on merge-across-copy.
Bryan O'Sullivan <bos@serpentine.com>
parents:
43
diff
changeset
|
193 make a copy of the first file we created. |
6b0f4498569e
Beef up daily routine material. Focus on merge-across-copy.
Bryan O'Sullivan <bos@serpentine.com>
parents:
43
diff
changeset
|
194 \interaction{daily.copy.copy} |
6b0f4498569e
Beef up daily routine material. Focus on merge-across-copy.
Bryan O'Sullivan <bos@serpentine.com>
parents:
43
diff
changeset
|
195 |
6b0f4498569e
Beef up daily routine material. Focus on merge-across-copy.
Bryan O'Sullivan <bos@serpentine.com>
parents:
43
diff
changeset
|
196 If we look at the output of the \hgcmd{status} command afterwards, the |
6b0f4498569e
Beef up daily routine material. Focus on merge-across-copy.
Bryan O'Sullivan <bos@serpentine.com>
parents:
43
diff
changeset
|
197 copied file looks just like a normal added file. |
6b0f4498569e
Beef up daily routine material. Focus on merge-across-copy.
Bryan O'Sullivan <bos@serpentine.com>
parents:
43
diff
changeset
|
198 \interaction{daily.copy.status} |
6b0f4498569e
Beef up daily routine material. Focus on merge-across-copy.
Bryan O'Sullivan <bos@serpentine.com>
parents:
43
diff
changeset
|
199 But if we pass the \hgopt{status}{-C} option to \hgcmd{status}, it |
6b0f4498569e
Beef up daily routine material. Focus on merge-across-copy.
Bryan O'Sullivan <bos@serpentine.com>
parents:
43
diff
changeset
|
200 prints another line of output: this is the file that our newly-added |
6b0f4498569e
Beef up daily routine material. Focus on merge-across-copy.
Bryan O'Sullivan <bos@serpentine.com>
parents:
43
diff
changeset
|
201 file was copied \emph{from}. |
6b0f4498569e
Beef up daily routine material. Focus on merge-across-copy.
Bryan O'Sullivan <bos@serpentine.com>
parents:
43
diff
changeset
|
202 \interaction{daily.copy.status-copy} |
6b0f4498569e
Beef up daily routine material. Focus on merge-across-copy.
Bryan O'Sullivan <bos@serpentine.com>
parents:
43
diff
changeset
|
203 |
6b0f4498569e
Beef up daily routine material. Focus on merge-across-copy.
Bryan O'Sullivan <bos@serpentine.com>
parents:
43
diff
changeset
|
204 Now, back in the repository we cloned, let's make a change in |
6b0f4498569e
Beef up daily routine material. Focus on merge-across-copy.
Bryan O'Sullivan <bos@serpentine.com>
parents:
43
diff
changeset
|
205 parallel. We'll add a line of content to the original file that we |
6b0f4498569e
Beef up daily routine material. Focus on merge-across-copy.
Bryan O'Sullivan <bos@serpentine.com>
parents:
43
diff
changeset
|
206 created. |
6b0f4498569e
Beef up daily routine material. Focus on merge-across-copy.
Bryan O'Sullivan <bos@serpentine.com>
parents:
43
diff
changeset
|
207 \interaction{daily.copy.other} |
6b0f4498569e
Beef up daily routine material. Focus on merge-across-copy.
Bryan O'Sullivan <bos@serpentine.com>
parents:
43
diff
changeset
|
208 Now we have a modified \filename{file} in this repository. When we |
6b0f4498569e
Beef up daily routine material. Focus on merge-across-copy.
Bryan O'Sullivan <bos@serpentine.com>
parents:
43
diff
changeset
|
209 pull the changes from the first repository, and merge the two heads, |
6b0f4498569e
Beef up daily routine material. Focus on merge-across-copy.
Bryan O'Sullivan <bos@serpentine.com>
parents:
43
diff
changeset
|
210 Mercurial will propagate the changes that we made locally to |
6b0f4498569e
Beef up daily routine material. Focus on merge-across-copy.
Bryan O'Sullivan <bos@serpentine.com>
parents:
43
diff
changeset
|
211 \filename{file} into its copy, \filename{new-file}. |
6b0f4498569e
Beef up daily routine material. Focus on merge-across-copy.
Bryan O'Sullivan <bos@serpentine.com>
parents:
43
diff
changeset
|
212 \interaction{daily.copy.merge} |
6b0f4498569e
Beef up daily routine material. Focus on merge-across-copy.
Bryan O'Sullivan <bos@serpentine.com>
parents:
43
diff
changeset
|
213 |
368
7ef84661e43e
started daily.tex either.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
348
diff
changeset
|
214 %\subsection{Why should changes follow copies?} |
7ef84661e43e
started daily.tex either.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
348
diff
changeset
|
215 \subsection{$BJQ99$O$J$<%3%T!<$K=>$o$J$1$l$P$J$i$J$$$+(B} |
117
6b0f4498569e
Beef up daily routine material. Focus on merge-across-copy.
Bryan O'Sullivan <bos@serpentine.com>
parents:
43
diff
changeset
|
216 \label{sec:daily:why-copy} |
6b0f4498569e
Beef up daily routine material. Focus on merge-across-copy.
Bryan O'Sullivan <bos@serpentine.com>
parents:
43
diff
changeset
|
217 |
6b0f4498569e
Beef up daily routine material. Focus on merge-across-copy.
Bryan O'Sullivan <bos@serpentine.com>
parents:
43
diff
changeset
|
218 This behaviour, of changes to a file propagating out to copies of the |
6b0f4498569e
Beef up daily routine material. Focus on merge-across-copy.
Bryan O'Sullivan <bos@serpentine.com>
parents:
43
diff
changeset
|
219 file, might seem esoteric, but in most cases it's highly desirable. |
6b0f4498569e
Beef up daily routine material. Focus on merge-across-copy.
Bryan O'Sullivan <bos@serpentine.com>
parents:
43
diff
changeset
|
220 |
6b0f4498569e
Beef up daily routine material. Focus on merge-across-copy.
Bryan O'Sullivan <bos@serpentine.com>
parents:
43
diff
changeset
|
221 First of all, remember that this propagation \emph{only} happens when |
6b0f4498569e
Beef up daily routine material. Focus on merge-across-copy.
Bryan O'Sullivan <bos@serpentine.com>
parents:
43
diff
changeset
|
222 you merge. So if you \hgcmd{copy} a file, and subsequently modify the |
6b0f4498569e
Beef up daily routine material. Focus on merge-across-copy.
Bryan O'Sullivan <bos@serpentine.com>
parents:
43
diff
changeset
|
223 original file during the normal course of your work, nothing will |
6b0f4498569e
Beef up daily routine material. Focus on merge-across-copy.
Bryan O'Sullivan <bos@serpentine.com>
parents:
43
diff
changeset
|
224 happen. |
42
cbfa08bcf181
Start the "Mercurial in daily use" chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
225 |
117
6b0f4498569e
Beef up daily routine material. Focus on merge-across-copy.
Bryan O'Sullivan <bos@serpentine.com>
parents:
43
diff
changeset
|
226 The second thing to know is that modifications will only propagate |
6b0f4498569e
Beef up daily routine material. Focus on merge-across-copy.
Bryan O'Sullivan <bos@serpentine.com>
parents:
43
diff
changeset
|
227 across a copy as long as the repository that you're pulling changes |
6b0f4498569e
Beef up daily routine material. Focus on merge-across-copy.
Bryan O'Sullivan <bos@serpentine.com>
parents:
43
diff
changeset
|
228 from \emph{doesn't know} about the copy. |
6b0f4498569e
Beef up daily routine material. Focus on merge-across-copy.
Bryan O'Sullivan <bos@serpentine.com>
parents:
43
diff
changeset
|
229 |
6b0f4498569e
Beef up daily routine material. Focus on merge-across-copy.
Bryan O'Sullivan <bos@serpentine.com>
parents:
43
diff
changeset
|
230 The reason that Mercurial does this is as follows. Let's say I make |
6b0f4498569e
Beef up daily routine material. Focus on merge-across-copy.
Bryan O'Sullivan <bos@serpentine.com>
parents:
43
diff
changeset
|
231 an important bug fix in a source file, and commit my changes. |
6b0f4498569e
Beef up daily routine material. Focus on merge-across-copy.
Bryan O'Sullivan <bos@serpentine.com>
parents:
43
diff
changeset
|
232 Meanwhile, you've decided to \hgcmd{copy} the file in your repository, |
6b0f4498569e
Beef up daily routine material. Focus on merge-across-copy.
Bryan O'Sullivan <bos@serpentine.com>
parents:
43
diff
changeset
|
233 without knowing about the bug or having seen the fix, and you have |
6b0f4498569e
Beef up daily routine material. Focus on merge-across-copy.
Bryan O'Sullivan <bos@serpentine.com>
parents:
43
diff
changeset
|
234 started hacking on your copy of the file. |
6b0f4498569e
Beef up daily routine material. Focus on merge-across-copy.
Bryan O'Sullivan <bos@serpentine.com>
parents:
43
diff
changeset
|
235 |
6b0f4498569e
Beef up daily routine material. Focus on merge-across-copy.
Bryan O'Sullivan <bos@serpentine.com>
parents:
43
diff
changeset
|
236 If you pulled and merged my changes, and Mercurial \emph{didn't} |
6b0f4498569e
Beef up daily routine material. Focus on merge-across-copy.
Bryan O'Sullivan <bos@serpentine.com>
parents:
43
diff
changeset
|
237 propagate changes across copies, your source file would now contain |
6b0f4498569e
Beef up daily routine material. Focus on merge-across-copy.
Bryan O'Sullivan <bos@serpentine.com>
parents:
43
diff
changeset
|
238 the bug, and unless you remembered to propagate the bug fix by hand, |
6b0f4498569e
Beef up daily routine material. Focus on merge-across-copy.
Bryan O'Sullivan <bos@serpentine.com>
parents:
43
diff
changeset
|
239 the bug would \emph{remain} in your copy of the file. |
6b0f4498569e
Beef up daily routine material. Focus on merge-across-copy.
Bryan O'Sullivan <bos@serpentine.com>
parents:
43
diff
changeset
|
240 |
6b0f4498569e
Beef up daily routine material. Focus on merge-across-copy.
Bryan O'Sullivan <bos@serpentine.com>
parents:
43
diff
changeset
|
241 By automatically propagating the change that fixed the bug from the |
6b0f4498569e
Beef up daily routine material. Focus on merge-across-copy.
Bryan O'Sullivan <bos@serpentine.com>
parents:
43
diff
changeset
|
242 original file to the copy, Mercurial prevents this class of problem. |
6b0f4498569e
Beef up daily routine material. Focus on merge-across-copy.
Bryan O'Sullivan <bos@serpentine.com>
parents:
43
diff
changeset
|
243 To my knowledge, Mercurial is the \emph{only} revision control system |
6b0f4498569e
Beef up daily routine material. Focus on merge-across-copy.
Bryan O'Sullivan <bos@serpentine.com>
parents:
43
diff
changeset
|
244 that propagates changes across copies like this. |
6b0f4498569e
Beef up daily routine material. Focus on merge-across-copy.
Bryan O'Sullivan <bos@serpentine.com>
parents:
43
diff
changeset
|
245 |
6b0f4498569e
Beef up daily routine material. Focus on merge-across-copy.
Bryan O'Sullivan <bos@serpentine.com>
parents:
43
diff
changeset
|
246 Once your change history has a record that the copy and subsequent |
6b0f4498569e
Beef up daily routine material. Focus on merge-across-copy.
Bryan O'Sullivan <bos@serpentine.com>
parents:
43
diff
changeset
|
247 merge occurred, there's usually no further need to propagate changes |
6b0f4498569e
Beef up daily routine material. Focus on merge-across-copy.
Bryan O'Sullivan <bos@serpentine.com>
parents:
43
diff
changeset
|
248 from the original file to the copied file, and that's why Mercurial |
6b0f4498569e
Beef up daily routine material. Focus on merge-across-copy.
Bryan O'Sullivan <bos@serpentine.com>
parents:
43
diff
changeset
|
249 only propagates changes across copies until this point, and no |
6b0f4498569e
Beef up daily routine material. Focus on merge-across-copy.
Bryan O'Sullivan <bos@serpentine.com>
parents:
43
diff
changeset
|
250 further. |
6b0f4498569e
Beef up daily routine material. Focus on merge-across-copy.
Bryan O'Sullivan <bos@serpentine.com>
parents:
43
diff
changeset
|
251 |
368
7ef84661e43e
started daily.tex either.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
348
diff
changeset
|
252 %\subsection{How to make changes \emph{not} follow a copy} |
7ef84661e43e
started daily.tex either.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
348
diff
changeset
|
253 \subsection{$BJQ99$,%3%T!<$K$7B&FbMF$K$9$kJ}K!(B} |
117
6b0f4498569e
Beef up daily routine material. Focus on merge-across-copy.
Bryan O'Sullivan <bos@serpentine.com>
parents:
43
diff
changeset
|
254 |
6b0f4498569e
Beef up daily routine material. Focus on merge-across-copy.
Bryan O'Sullivan <bos@serpentine.com>
parents:
43
diff
changeset
|
255 If, for some reason, you decide that this business of automatically |
6b0f4498569e
Beef up daily routine material. Focus on merge-across-copy.
Bryan O'Sullivan <bos@serpentine.com>
parents:
43
diff
changeset
|
256 propagating changes across copies is not for you, simply use your |
6b0f4498569e
Beef up daily routine material. Focus on merge-across-copy.
Bryan O'Sullivan <bos@serpentine.com>
parents:
43
diff
changeset
|
257 system's normal file copy command (on Unix-like systems, that's |
6b0f4498569e
Beef up daily routine material. Focus on merge-across-copy.
Bryan O'Sullivan <bos@serpentine.com>
parents:
43
diff
changeset
|
258 \command{cp}) to make a copy of a file, then \hgcmd{add} the new copy |
6b0f4498569e
Beef up daily routine material. Focus on merge-across-copy.
Bryan O'Sullivan <bos@serpentine.com>
parents:
43
diff
changeset
|
259 by hand. Before you do so, though, please do reread |
6b0f4498569e
Beef up daily routine material. Focus on merge-across-copy.
Bryan O'Sullivan <bos@serpentine.com>
parents:
43
diff
changeset
|
260 section~\ref{sec:daily:why-copy}, and make an informed decision that |
6b0f4498569e
Beef up daily routine material. Focus on merge-across-copy.
Bryan O'Sullivan <bos@serpentine.com>
parents:
43
diff
changeset
|
261 this behaviour is not appropriate to your specific case. |
6b0f4498569e
Beef up daily routine material. Focus on merge-across-copy.
Bryan O'Sullivan <bos@serpentine.com>
parents:
43
diff
changeset
|
262 |
368
7ef84661e43e
started daily.tex either.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
348
diff
changeset
|
263 %\subsection{Behaviour of the \hgcmd{copy} command} |
7ef84661e43e
started daily.tex either.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
348
diff
changeset
|
264 \subsection{\hgcmd{copy}$B%3%^%s%I$N5sF0(B} |
117
6b0f4498569e
Beef up daily routine material. Focus on merge-across-copy.
Bryan O'Sullivan <bos@serpentine.com>
parents:
43
diff
changeset
|
265 |
118
1ee53cb37a99
More progress on daily work.
Bryan O'Sullivan <bos@serpentine.com>
parents:
117
diff
changeset
|
266 When you use the \hgcmd{copy} command, Mercurial makes a copy of each |
1ee53cb37a99
More progress on daily work.
Bryan O'Sullivan <bos@serpentine.com>
parents:
117
diff
changeset
|
267 source file as it currently stands in the working directory. This |
181
d4570b8c78bd
Be more explicit about the behaviour of copy with modified files.
Bryan O'Sullivan <bos@serpentine.com>
parents:
180
diff
changeset
|
268 means that if you make some modifications to a file, then \hgcmd{copy} |
d4570b8c78bd
Be more explicit about the behaviour of copy with modified files.
Bryan O'Sullivan <bos@serpentine.com>
parents:
180
diff
changeset
|
269 it without first having committed those changes, the new copy will |
d4570b8c78bd
Be more explicit about the behaviour of copy with modified files.
Bryan O'Sullivan <bos@serpentine.com>
parents:
180
diff
changeset
|
270 also contain the modifications you have made up until that point. (I |
d4570b8c78bd
Be more explicit about the behaviour of copy with modified files.
Bryan O'Sullivan <bos@serpentine.com>
parents:
180
diff
changeset
|
271 find this behaviour a little counterintuitive, which is why I mention |
d4570b8c78bd
Be more explicit about the behaviour of copy with modified files.
Bryan O'Sullivan <bos@serpentine.com>
parents:
180
diff
changeset
|
272 it here.) |
118
1ee53cb37a99
More progress on daily work.
Bryan O'Sullivan <bos@serpentine.com>
parents:
117
diff
changeset
|
273 |
117
6b0f4498569e
Beef up daily routine material. Focus on merge-across-copy.
Bryan O'Sullivan <bos@serpentine.com>
parents:
43
diff
changeset
|
274 The \hgcmd{copy} command acts similarly to the Unix \command{cp} |
118
1ee53cb37a99
More progress on daily work.
Bryan O'Sullivan <bos@serpentine.com>
parents:
117
diff
changeset
|
275 command (you can use the \hgcmd{cp} alias if you prefer). The last |
1ee53cb37a99
More progress on daily work.
Bryan O'Sullivan <bos@serpentine.com>
parents:
117
diff
changeset
|
276 argument is the \emph{destination}, and all prior arguments are |
1ee53cb37a99
More progress on daily work.
Bryan O'Sullivan <bos@serpentine.com>
parents:
117
diff
changeset
|
277 \emph{sources}. If you pass it a single file as the source, and the |
1ee53cb37a99
More progress on daily work.
Bryan O'Sullivan <bos@serpentine.com>
parents:
117
diff
changeset
|
278 destination does not exist, it creates a new file with that name. |
117
6b0f4498569e
Beef up daily routine material. Focus on merge-across-copy.
Bryan O'Sullivan <bos@serpentine.com>
parents:
43
diff
changeset
|
279 \interaction{daily.copy.simple} |
6b0f4498569e
Beef up daily routine material. Focus on merge-across-copy.
Bryan O'Sullivan <bos@serpentine.com>
parents:
43
diff
changeset
|
280 If the destination is a directory, Mercurial copies its sources into |
6b0f4498569e
Beef up daily routine material. Focus on merge-across-copy.
Bryan O'Sullivan <bos@serpentine.com>
parents:
43
diff
changeset
|
281 that directory. |
6b0f4498569e
Beef up daily routine material. Focus on merge-across-copy.
Bryan O'Sullivan <bos@serpentine.com>
parents:
43
diff
changeset
|
282 \interaction{daily.copy.dir-dest} |
6b0f4498569e
Beef up daily routine material. Focus on merge-across-copy.
Bryan O'Sullivan <bos@serpentine.com>
parents:
43
diff
changeset
|
283 Copying a directory is recursive, and preserves the directory |
6b0f4498569e
Beef up daily routine material. Focus on merge-across-copy.
Bryan O'Sullivan <bos@serpentine.com>
parents:
43
diff
changeset
|
284 structure of the source. |
6b0f4498569e
Beef up daily routine material. Focus on merge-across-copy.
Bryan O'Sullivan <bos@serpentine.com>
parents:
43
diff
changeset
|
285 \interaction{daily.copy.dir-src} |
6b0f4498569e
Beef up daily routine material. Focus on merge-across-copy.
Bryan O'Sullivan <bos@serpentine.com>
parents:
43
diff
changeset
|
286 If the source and destination are both directories, the source tree is |
6b0f4498569e
Beef up daily routine material. Focus on merge-across-copy.
Bryan O'Sullivan <bos@serpentine.com>
parents:
43
diff
changeset
|
287 recreated in the destination directory. |
6b0f4498569e
Beef up daily routine material. Focus on merge-across-copy.
Bryan O'Sullivan <bos@serpentine.com>
parents:
43
diff
changeset
|
288 \interaction{daily.copy.dir-src-dest} |
6b0f4498569e
Beef up daily routine material. Focus on merge-across-copy.
Bryan O'Sullivan <bos@serpentine.com>
parents:
43
diff
changeset
|
289 |
118
1ee53cb37a99
More progress on daily work.
Bryan O'Sullivan <bos@serpentine.com>
parents:
117
diff
changeset
|
290 As with the \hgcmd{rename} command, if you copy a file manually and |
1ee53cb37a99
More progress on daily work.
Bryan O'Sullivan <bos@serpentine.com>
parents:
117
diff
changeset
|
291 then want Mercurial to know that you've copied the file, simply use |
236 | 292 the \hgopt{copy}{--after} option to \hgcmd{copy}. |
118
1ee53cb37a99
More progress on daily work.
Bryan O'Sullivan <bos@serpentine.com>
parents:
117
diff
changeset
|
293 \interaction{daily.copy.after} |
1ee53cb37a99
More progress on daily work.
Bryan O'Sullivan <bos@serpentine.com>
parents:
117
diff
changeset
|
294 |
368
7ef84661e43e
started daily.tex either.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
348
diff
changeset
|
295 %\section{Renaming files} |
7ef84661e43e
started daily.tex either.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
348
diff
changeset
|
296 \section{$B%U%!%$%k$N%j%M!<%`(B} |
43 | 297 |
118
1ee53cb37a99
More progress on daily work.
Bryan O'Sullivan <bos@serpentine.com>
parents:
117
diff
changeset
|
298 It's rather more common to need to rename a file than to make a copy |
1ee53cb37a99
More progress on daily work.
Bryan O'Sullivan <bos@serpentine.com>
parents:
117
diff
changeset
|
299 of it. The reason I discussed the \hgcmd{copy} command before talking |
1ee53cb37a99
More progress on daily work.
Bryan O'Sullivan <bos@serpentine.com>
parents:
117
diff
changeset
|
300 about renaming files is that Mercurial treats a rename in essentially |
1ee53cb37a99
More progress on daily work.
Bryan O'Sullivan <bos@serpentine.com>
parents:
117
diff
changeset
|
301 the same way as a copy. Therefore, knowing what Mercurial does when |
1ee53cb37a99
More progress on daily work.
Bryan O'Sullivan <bos@serpentine.com>
parents:
117
diff
changeset
|
302 you copy a file tells you what to expect when you rename a file. |
43 | 303 |
118
1ee53cb37a99
More progress on daily work.
Bryan O'Sullivan <bos@serpentine.com>
parents:
117
diff
changeset
|
304 When you use the \hgcmd{rename} command, Mercurial makes a copy of |
1ee53cb37a99
More progress on daily work.
Bryan O'Sullivan <bos@serpentine.com>
parents:
117
diff
changeset
|
305 each source file, then deletes it and marks the file as removed. |
1ee53cb37a99
More progress on daily work.
Bryan O'Sullivan <bos@serpentine.com>
parents:
117
diff
changeset
|
306 \interaction{daily.rename.rename} |
1ee53cb37a99
More progress on daily work.
Bryan O'Sullivan <bos@serpentine.com>
parents:
117
diff
changeset
|
307 The \hgcmd{status} command shows the newly copied file as added, and |
1ee53cb37a99
More progress on daily work.
Bryan O'Sullivan <bos@serpentine.com>
parents:
117
diff
changeset
|
308 the copied-from file as removed. |
1ee53cb37a99
More progress on daily work.
Bryan O'Sullivan <bos@serpentine.com>
parents:
117
diff
changeset
|
309 \interaction{daily.rename.status} |
1ee53cb37a99
More progress on daily work.
Bryan O'Sullivan <bos@serpentine.com>
parents:
117
diff
changeset
|
310 As with the results of a \hgcmd{copy}, we must use the |
1ee53cb37a99
More progress on daily work.
Bryan O'Sullivan <bos@serpentine.com>
parents:
117
diff
changeset
|
311 \hgopt{status}{-C} option to \hgcmd{status} to see that the added file |
1ee53cb37a99
More progress on daily work.
Bryan O'Sullivan <bos@serpentine.com>
parents:
117
diff
changeset
|
312 is really being tracked by Mercurial as a copy of the original, now |
1ee53cb37a99
More progress on daily work.
Bryan O'Sullivan <bos@serpentine.com>
parents:
117
diff
changeset
|
313 removed, file. |
1ee53cb37a99
More progress on daily work.
Bryan O'Sullivan <bos@serpentine.com>
parents:
117
diff
changeset
|
314 \interaction{daily.rename.status-copy} |
1ee53cb37a99
More progress on daily work.
Bryan O'Sullivan <bos@serpentine.com>
parents:
117
diff
changeset
|
315 |
1ee53cb37a99
More progress on daily work.
Bryan O'Sullivan <bos@serpentine.com>
parents:
117
diff
changeset
|
316 As with \hgcmd{remove} and \hgcmd{copy}, you can tell Mercurial about |
1ee53cb37a99
More progress on daily work.
Bryan O'Sullivan <bos@serpentine.com>
parents:
117
diff
changeset
|
317 a rename after the fact using the \hgopt{rename}{--after} option. In |
1ee53cb37a99
More progress on daily work.
Bryan O'Sullivan <bos@serpentine.com>
parents:
117
diff
changeset
|
318 most other respects, the behaviour of the \hgcmd{rename} command, and |
1ee53cb37a99
More progress on daily work.
Bryan O'Sullivan <bos@serpentine.com>
parents:
117
diff
changeset
|
319 the options it accepts, are similar to the \hgcmd{copy} command. |
1ee53cb37a99
More progress on daily work.
Bryan O'Sullivan <bos@serpentine.com>
parents:
117
diff
changeset
|
320 |
368
7ef84661e43e
started daily.tex either.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
348
diff
changeset
|
321 %\subsection{Renaming files and merging changes} |
7ef84661e43e
started daily.tex either.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
348
diff
changeset
|
322 \subsection{$B%U%!%$%k$N%j%M!<%`$HJQ99$N%^!<%8(B} |
118
1ee53cb37a99
More progress on daily work.
Bryan O'Sullivan <bos@serpentine.com>
parents:
117
diff
changeset
|
323 |
1ee53cb37a99
More progress on daily work.
Bryan O'Sullivan <bos@serpentine.com>
parents:
117
diff
changeset
|
324 Since Mercurial's rename is implemented as copy-and-remove, the same |
1ee53cb37a99
More progress on daily work.
Bryan O'Sullivan <bos@serpentine.com>
parents:
117
diff
changeset
|
325 propagation of changes happens when you merge after a rename as after |
1ee53cb37a99
More progress on daily work.
Bryan O'Sullivan <bos@serpentine.com>
parents:
117
diff
changeset
|
326 a copy. |
1ee53cb37a99
More progress on daily work.
Bryan O'Sullivan <bos@serpentine.com>
parents:
117
diff
changeset
|
327 |
156
91a936be78b8
Document merge behaviour with file names.
Bryan O'Sullivan <bos@serpentine.com>
parents:
121
diff
changeset
|
328 If I modify a file, and you rename it to a new name, and then we merge |
91a936be78b8
Document merge behaviour with file names.
Bryan O'Sullivan <bos@serpentine.com>
parents:
121
diff
changeset
|
329 our respective changes, my modifications to the file under its |
91a936be78b8
Document merge behaviour with file names.
Bryan O'Sullivan <bos@serpentine.com>
parents:
121
diff
changeset
|
330 original name will be propagated into the file under its new name. |
91a936be78b8
Document merge behaviour with file names.
Bryan O'Sullivan <bos@serpentine.com>
parents:
121
diff
changeset
|
331 (This is something you might expect to ``simply work,'' but not all |
91a936be78b8
Document merge behaviour with file names.
Bryan O'Sullivan <bos@serpentine.com>
parents:
121
diff
changeset
|
332 revision control systems actually do this.) |
43 | 333 |
121
9094c9fda8ec
Start chapter on error recovery.
Bryan O'Sullivan <bos@serpentine.com>
parents:
118
diff
changeset
|
334 Whereas having changes follow a copy is a feature where you can |
9094c9fda8ec
Start chapter on error recovery.
Bryan O'Sullivan <bos@serpentine.com>
parents:
118
diff
changeset
|
335 perhaps nod and say ``yes, that might be useful,'' it should be clear |
9094c9fda8ec
Start chapter on error recovery.
Bryan O'Sullivan <bos@serpentine.com>
parents:
118
diff
changeset
|
336 that having them follow a rename is definitely important. Without |
9094c9fda8ec
Start chapter on error recovery.
Bryan O'Sullivan <bos@serpentine.com>
parents:
118
diff
changeset
|
337 this facility, it would simply be too easy for changes to become |
9094c9fda8ec
Start chapter on error recovery.
Bryan O'Sullivan <bos@serpentine.com>
parents:
118
diff
changeset
|
338 orphaned when files are renamed. |
9094c9fda8ec
Start chapter on error recovery.
Bryan O'Sullivan <bos@serpentine.com>
parents:
118
diff
changeset
|
339 |
368
7ef84661e43e
started daily.tex either.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
348
diff
changeset
|
340 %\subsection{Divergent renames and merging} |
7ef84661e43e
started daily.tex either.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
348
diff
changeset
|
341 \subsection{$BL>A0$H%^!<%8$NH/;6(B} |
156
91a936be78b8
Document merge behaviour with file names.
Bryan O'Sullivan <bos@serpentine.com>
parents:
121
diff
changeset
|
342 |
91a936be78b8
Document merge behaviour with file names.
Bryan O'Sullivan <bos@serpentine.com>
parents:
121
diff
changeset
|
343 The case of diverging names occurs when two developers start with a |
91a936be78b8
Document merge behaviour with file names.
Bryan O'Sullivan <bos@serpentine.com>
parents:
121
diff
changeset
|
344 file---let's call it \filename{foo}---in their respective |
91a936be78b8
Document merge behaviour with file names.
Bryan O'Sullivan <bos@serpentine.com>
parents:
121
diff
changeset
|
345 repositories. |
91a936be78b8
Document merge behaviour with file names.
Bryan O'Sullivan <bos@serpentine.com>
parents:
121
diff
changeset
|
346 |
91a936be78b8
Document merge behaviour with file names.
Bryan O'Sullivan <bos@serpentine.com>
parents:
121
diff
changeset
|
347 \interaction{rename.divergent.clone} |
91a936be78b8
Document merge behaviour with file names.
Bryan O'Sullivan <bos@serpentine.com>
parents:
121
diff
changeset
|
348 Anne renames the file to \filename{bar}. |
91a936be78b8
Document merge behaviour with file names.
Bryan O'Sullivan <bos@serpentine.com>
parents:
121
diff
changeset
|
349 \interaction{rename.divergent.rename.anne} |
91a936be78b8
Document merge behaviour with file names.
Bryan O'Sullivan <bos@serpentine.com>
parents:
121
diff
changeset
|
350 Meanwhile, Bob renames it to \filename{quux}. |
91a936be78b8
Document merge behaviour with file names.
Bryan O'Sullivan <bos@serpentine.com>
parents:
121
diff
changeset
|
351 \interaction{rename.divergent.rename.bob} |
91a936be78b8
Document merge behaviour with file names.
Bryan O'Sullivan <bos@serpentine.com>
parents:
121
diff
changeset
|
352 |
91a936be78b8
Document merge behaviour with file names.
Bryan O'Sullivan <bos@serpentine.com>
parents:
121
diff
changeset
|
353 I like to think of this as a conflict because each developer has |
91a936be78b8
Document merge behaviour with file names.
Bryan O'Sullivan <bos@serpentine.com>
parents:
121
diff
changeset
|
354 expressed different intentions about what the file ought to be named. |
91a936be78b8
Document merge behaviour with file names.
Bryan O'Sullivan <bos@serpentine.com>
parents:
121
diff
changeset
|
355 |
91a936be78b8
Document merge behaviour with file names.
Bryan O'Sullivan <bos@serpentine.com>
parents:
121
diff
changeset
|
356 What do you think should happen when they merge their work? |
91a936be78b8
Document merge behaviour with file names.
Bryan O'Sullivan <bos@serpentine.com>
parents:
121
diff
changeset
|
357 Mercurial's actual behaviour is that it always preserves \emph{both} |
91a936be78b8
Document merge behaviour with file names.
Bryan O'Sullivan <bos@serpentine.com>
parents:
121
diff
changeset
|
358 names when it merges changesets that contain divergent renames. |
91a936be78b8
Document merge behaviour with file names.
Bryan O'Sullivan <bos@serpentine.com>
parents:
121
diff
changeset
|
359 \interaction{rename.divergent.merge} |
91a936be78b8
Document merge behaviour with file names.
Bryan O'Sullivan <bos@serpentine.com>
parents:
121
diff
changeset
|
360 |
273
00f69e8825c5
Bring book up to date with recent changes.
Bryan O'Sullivan <bos@serpentine.com>
parents:
236
diff
changeset
|
361 Notice that Mercurial does warn about the divergent renames, but it |
00f69e8825c5
Bring book up to date with recent changes.
Bryan O'Sullivan <bos@serpentine.com>
parents:
236
diff
changeset
|
362 leaves it up to you to do something about the divergence after the merge. |
156
91a936be78b8
Document merge behaviour with file names.
Bryan O'Sullivan <bos@serpentine.com>
parents:
121
diff
changeset
|
363 |
368
7ef84661e43e
started daily.tex either.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
348
diff
changeset
|
364 %\subsection{Convergent renames and merging} |
7ef84661e43e
started daily.tex either.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
348
diff
changeset
|
365 \subsection{$B%j%M!<%`$H%^!<%8$K$h$k<}B+(B} |
156
91a936be78b8
Document merge behaviour with file names.
Bryan O'Sullivan <bos@serpentine.com>
parents:
121
diff
changeset
|
366 |
91a936be78b8
Document merge behaviour with file names.
Bryan O'Sullivan <bos@serpentine.com>
parents:
121
diff
changeset
|
367 Another kind of rename conflict occurs when two people choose to |
91a936be78b8
Document merge behaviour with file names.
Bryan O'Sullivan <bos@serpentine.com>
parents:
121
diff
changeset
|
368 rename different \emph{source} files to the same \emph{destination}. |
91a936be78b8
Document merge behaviour with file names.
Bryan O'Sullivan <bos@serpentine.com>
parents:
121
diff
changeset
|
369 In this case, Mercurial runs its normal merge machinery, and lets you |
91a936be78b8
Document merge behaviour with file names.
Bryan O'Sullivan <bos@serpentine.com>
parents:
121
diff
changeset
|
370 guide it to a suitable resolution. |
91a936be78b8
Document merge behaviour with file names.
Bryan O'Sullivan <bos@serpentine.com>
parents:
121
diff
changeset
|
371 |
368
7ef84661e43e
started daily.tex either.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
348
diff
changeset
|
372 %\subsection{Other name-related corner cases} |
7ef84661e43e
started daily.tex either.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
348
diff
changeset
|
373 \subsection{$BL>A0$K4XO"$7$?$$$/$D$+$NLdBj(B} |
156
91a936be78b8
Document merge behaviour with file names.
Bryan O'Sullivan <bos@serpentine.com>
parents:
121
diff
changeset
|
374 |
91a936be78b8
Document merge behaviour with file names.
Bryan O'Sullivan <bos@serpentine.com>
parents:
121
diff
changeset
|
375 Mercurial has a longstanding bug in which it fails to handle a merge |
91a936be78b8
Document merge behaviour with file names.
Bryan O'Sullivan <bos@serpentine.com>
parents:
121
diff
changeset
|
376 where one side has a file with a given name, while another has a |
348
32d33b238b7e
made changes to the source files to be compiled at any rate.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
293
diff
changeset
|
377 directory with the same name. This is documented as~\bug{29} . |
156
91a936be78b8
Document merge behaviour with file names.
Bryan O'Sullivan <bos@serpentine.com>
parents:
121
diff
changeset
|
378 \interaction{issue29.go} |
121
9094c9fda8ec
Start chapter on error recovery.
Bryan O'Sullivan <bos@serpentine.com>
parents:
118
diff
changeset
|
379 |
368
7ef84661e43e
started daily.tex either.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
348
diff
changeset
|
380 %\section{Recovering from mistakes} |
7ef84661e43e
started daily.tex either.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
348
diff
changeset
|
381 \section{$B%_%9$+$i$N2sI|(B} |
7ef84661e43e
started daily.tex either.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
348
diff
changeset
|
382 |
7ef84661e43e
started daily.tex either.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
348
diff
changeset
|
383 %Mercurial has some useful commands that will help you to recover from |
7ef84661e43e
started daily.tex either.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
348
diff
changeset
|
384 %some common mistakes. |
180
6413f88338df
Point to chapter on undoing mistakes.
Bryan O'Sullivan <bos@serpentine.com>
parents:
178
diff
changeset
|
385 |
368
7ef84661e43e
started daily.tex either.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
348
diff
changeset
|
386 Mercurial$B$K$O0lHLE*$J%_%9$+$i$N2sI|$r=u$1$k$$$/$D$+$NM-MQ$J%3%^%s%I$,$"$k!%(B |
7ef84661e43e
started daily.tex either.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
348
diff
changeset
|
387 |
7ef84661e43e
started daily.tex either.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
348
diff
changeset
|
388 %The \hgcmd{revert} command lets you undo changes that you have made to |
7ef84661e43e
started daily.tex either.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
348
diff
changeset
|
389 %your working directory. For example, if you \hgcmd{add} a file by |
7ef84661e43e
started daily.tex either.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
348
diff
changeset
|
390 %accident, just run \hgcmd{revert} with the name of the file you added, |
7ef84661e43e
started daily.tex either.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
348
diff
changeset
|
391 %and while the file won't be touched in any way, it won't be tracked |
7ef84661e43e
started daily.tex either.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
348
diff
changeset
|
392 %for adding by Mercurial any longer, either. You can also use |
7ef84661e43e
started daily.tex either.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
348
diff
changeset
|
393 %\hgcmd{revert} to get rid of erroneous changes to a file. |
180
6413f88338df
Point to chapter on undoing mistakes.
Bryan O'Sullivan <bos@serpentine.com>
parents:
178
diff
changeset
|
394 |
368
7ef84661e43e
started daily.tex either.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
348
diff
changeset
|
395 \hgcmd{revert}$B%3%^%s%I$O%o!<%-%s%0%G%#%l%/%H%jFb$G9T$C$?JQ99$r<h$j>C$9!%(B |
7ef84661e43e
started daily.tex either.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
348
diff
changeset
|
396 $B$?$H$($P!$8m$C$F(B\hgcmd{add}$B$r9T$C$?>l9g!$DI2C$7$?%U%!%$%kL>$H6&$K(B |
7ef84661e43e
started daily.tex either.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
348
diff
changeset
|
397 \hgcmd{revert}$B$r<B9T$9$l$P%U%!%$%k$O2?$bJQ99$5$l$:!$(BMercurial$B$N4IM}$+$i30(B |
7ef84661e43e
started daily.tex either.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
348
diff
changeset
|
398 $B$5$l$k!%$^$?(B\hgcmd{revert}$B$O%U%!%$%k$X$N4V0c$C$?JQ99$r>C5n$9$k$N$b;H$($k!%(B |
7ef84661e43e
started daily.tex either.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
348
diff
changeset
|
399 |
7ef84661e43e
started daily.tex either.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
348
diff
changeset
|
400 %It's useful to remember that the \hgcmd{revert} command is useful for |
7ef84661e43e
started daily.tex either.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
348
diff
changeset
|
401 |
7ef84661e43e
started daily.tex either.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
348
diff
changeset
|
402 %changes that you have not yet committed. Once you've committed a |
7ef84661e43e
started daily.tex either.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
348
diff
changeset
|
403 %change, if you decide it was a mistake, you can still do something |
7ef84661e43e
started daily.tex either.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
348
diff
changeset
|
404 %about it, though your options may be more limited. |
180
6413f88338df
Point to chapter on undoing mistakes.
Bryan O'Sullivan <bos@serpentine.com>
parents:
178
diff
changeset
|
405 |
368
7ef84661e43e
started daily.tex either.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
348
diff
changeset
|
406 \hgcmd{revert}$B%3%^%s%I$OL$%3%_%C%H$NJQ99$KBP$7$FM-8z$G$"$k$3$H$r3P$($F$*(B |
7ef84661e43e
started daily.tex either.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
348
diff
changeset
|
407 $B$/$HNI$$!%JQ99$r%3%_%C%H$7$?$"$H$G!$$3$l$,4V0c$$$G$"$C$?$3$H$K5$$E$$$?>l(B |
7ef84661e43e
started daily.tex either.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
348
diff
changeset
|
408 $B9g$O!$$H$l$k<jCJ$O$d$d8B$i$l$k!%(B |
180
6413f88338df
Point to chapter on undoing mistakes.
Bryan O'Sullivan <bos@serpentine.com>
parents:
178
diff
changeset
|
409 |
368
7ef84661e43e
started daily.tex either.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
348
diff
changeset
|
410 %For more information about the \hgcmd{revert} command, and details |
7ef84661e43e
started daily.tex either.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
348
diff
changeset
|
411 %about how to deal with changes you have already committed, see |
7ef84661e43e
started daily.tex either.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
348
diff
changeset
|
412 %chapter~\ref{chap:undo}. |
180
6413f88338df
Point to chapter on undoing mistakes.
Bryan O'Sullivan <bos@serpentine.com>
parents:
178
diff
changeset
|
413 |
368
7ef84661e43e
started daily.tex either.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
348
diff
changeset
|
414 \hgcmd{revert}$B%3%^%s%I$K$D$$$F$N$h$j>\:Y$J>pJs$H!$$9$G$K%3%_%C%H$7$?JQ99(B |
7ef84661e43e
started daily.tex either.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
348
diff
changeset
|
415 $B$X$NA`:n$K$D$$$F$O(B~\ref{chap:undo}$B$N>O$r;2>H$5$l$?$$!%(B |
7ef84661e43e
started daily.tex either.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
348
diff
changeset
|
416 |
7ef84661e43e
started daily.tex either.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
348
diff
changeset
|
417 %%% Local Variables: |
293
3b1291f24c0d
- replaved latex-mode to yatex-mode
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
290
diff
changeset
|
418 %%% mode: yatex |
42
cbfa08bcf181
Start the "Mercurial in daily use" chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
419 %%% TeX-master: "00book" |
368
7ef84661e43e
started daily.tex either.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
348
diff
changeset
|
420 %%% End: |