annotate ja/daily.tex @ 379:beab196f78da

- more hook.tex - more daily.tex
author Yoshiki Yazawa <yaz@honeyplanet.jp>
date Thu, 15 Jan 2009 16:34:43 +0900
parents 9f7812b79c70
children 38f034c1da53
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
376
9f7812b79c70 more daily.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 368
diff changeset
8 %Mercurial does not work with files in your repository unless you tell
9f7812b79c70 more daily.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 368
diff changeset
9 %it to manage them. The \hgcmd{status} command will tell you which
9f7812b79c70 more daily.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 368
diff changeset
10 %files Mercurial doesn't know about; it uses a ``\texttt{?}'' to
9f7812b79c70 more daily.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 368
diff changeset
11 %display such files.
9f7812b79c70 more daily.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 368
diff changeset
12
9f7812b79c70 more daily.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 368
diff changeset
13 Mercurial$B$O!$%f!<%6$K$h$k%U%!%$%k4IM}$N;X<($,$J$$8B$j!$%j%]%8%H%jFb$N%U%!(B
9f7812b79c70 more daily.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 368
diff changeset
14 $B%$%k$G$"$C$F$b4IM}$r9T$o$J$$!%(BMercurial$B$,4IM}$7$J$$%U%!%$%k$O(B
9f7812b79c70 more daily.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 368
diff changeset
15 \hgcmd{status}$B%3%^%s%I$r<B9T$9$k$H(B``\texttt{?}''$B$HI=<($5$l$k!%(B
42
cbfa08bcf181 Start the "Mercurial in daily use" chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
16
376
9f7812b79c70 more daily.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 368
diff changeset
17 %To tell Mercurial to track a file, use the \hgcmd{add} command. Once
9f7812b79c70 more daily.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 368
diff changeset
18 %you have added a file, the entry in the output of \hgcmd{status} for
9f7812b79c70 more daily.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 368
diff changeset
19 %that file changes from ``\texttt{?}'' to ``\texttt{A}''.
9f7812b79c70 more daily.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 368
diff changeset
20 %\interaction{daily.files.add}
9f7812b79c70 more daily.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 368
diff changeset
21
9f7812b79c70 more daily.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 368
diff changeset
22 Mercurial$B$K%U%!%$%k$NDI@W$r$5$;$k$K$O!$(B\hgcmd{add}$B%3%^%s%I$rMQ$$$k!%0lEY(B
9f7812b79c70 more daily.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 368
diff changeset
23 $B%U%!%$%k$rDI2C$9$k$H!$(B\hgcmd{status}$B%3%^%s%I$N=PNO$O(B``\texttt{?}''$B$+$i(B
9f7812b79c70 more daily.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 368
diff changeset
24 ``\texttt{A}''$B$KJQ$o$k!%(B
117
6b0f4498569e Beef up daily routine material. Focus on merge-across-copy.
Bryan O'Sullivan <bos@serpentine.com>
parents: 43
diff changeset
25 \interaction{daily.files.add}
42
cbfa08bcf181 Start the "Mercurial in daily use" chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
26
376
9f7812b79c70 more daily.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 368
diff changeset
27 %After you run a \hgcmd{commit}, the files that you added before the
9f7812b79c70 more daily.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 368
diff changeset
28 %commit will no longer be listed in the output of \hgcmd{status}. The
9f7812b79c70 more daily.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 368
diff changeset
29 %reason for this is that \hgcmd{status} only tells you about
9f7812b79c70 more daily.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 368
diff changeset
30 %``interesting'' files---those that you have modified or told Mercurial
9f7812b79c70 more daily.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 368
diff changeset
31 %to do something with---by default. If you have a repository that
9f7812b79c70 more daily.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 368
diff changeset
32 %contains thousands of files, you will rarely want to know about files
9f7812b79c70 more daily.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 368
diff changeset
33 %that Mercurial is tracking, but that have not changed. (You can still
9f7812b79c70 more daily.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 368
diff changeset
34 %get this information; we'll return to this later.)
42
cbfa08bcf181 Start the "Mercurial in daily use" chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
35
376
9f7812b79c70 more daily.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 368
diff changeset
36 \hgcmd{commit}$B%3%^%s%I$r<B9T$9$k$H!$(Bcommit$B$NA0$KDI2C$7$?%U%!%$%k$O(B
9f7812b79c70 more daily.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 368
diff changeset
37 \hgcmd{status}$B$N=PNO$K8=$l$J$/$J$k!%$3$l$O!$(B\hgcmd{status}$B$,%G%U%)%k%H$G(B
9f7812b79c70 more daily.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 368
diff changeset
38 $B$OJQ99$r2C$($?$j!$(BMercurial$B$K2?$+$r$5$;$?$H$$$C$?(B``$BCmL\$9$Y$-(B''$B%U%!%$%k$N(B
9f7812b79c70 more daily.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 368
diff changeset
39 $B$_$rI=<($9$k$?$a$G$"$k!%?t@i$N%U%!%$%k$+$i$J$k%j%]%8%H%j$N>l9g!$(BMercurial$B$,(B
9f7812b79c70 more daily.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 368
diff changeset
40 $BDI@W$7$F$$$k$b$N$N!$JQ99$N2C$($i$l$F$$$J$$%U%!%$%k$K$D$$$F2?$+$rCN$j$?$$(B
9f7812b79c70 more daily.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 368
diff changeset
41 $B$H$$$&$3$H$O5)$G$"$k!%!J$b$A$m$sCN$j$?$$>l9g$O>pJs$rF@$k$3$H$b$G$-$k!%$3(B
9f7812b79c70 more daily.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 368
diff changeset
42 $B$l$K$D$$$F$O8e=R$9$k!%!K(B
9f7812b79c70 more daily.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 368
diff changeset
43
9f7812b79c70 more daily.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 368
diff changeset
44 %Once you add a file, Mercurial doesn't do anything with it
9f7812b79c70 more daily.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 368
diff changeset
45 %immediately. Instead, it will take a snapshot of the file's state the
9f7812b79c70 more daily.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 368
diff changeset
46 %next time you perform a commit. It will then continue to track the
9f7812b79c70 more daily.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 368
diff changeset
47 %changes you make to the file every time you commit, until you remove
9f7812b79c70 more daily.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 368
diff changeset
48 %the file.
9f7812b79c70 more daily.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 368
diff changeset
49
9f7812b79c70 more daily.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 368
diff changeset
50 $BDI2C$7$?%U%!%$%k$KBP$7$F(BMercurial$B$,D>$A$K9T$&$3$H$O2?$b$J$$$,!$$=$NBe$o$j(B
9f7812b79c70 more daily.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 368
diff changeset
51 $B$K<!2s$N%3%_%C%H;~$K%U%!%$%k>uBV$N%9%J%C%W%7%g%C%H$r<h$k!%$=$7$F%U%!%$%k(B
9f7812b79c70 more daily.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 368
diff changeset
52 $B$r:o=|$9$k$^$G%3%_%C%HKh$K%U%!%$%k$NJQ2=$rDI@W$9$k!%(B
117
6b0f4498569e Beef up daily routine material. Focus on merge-across-copy.
Bryan O'Sullivan <bos@serpentine.com>
parents: 43
diff changeset
53
368
7ef84661e43e started daily.tex either.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 348
diff changeset
54 %\subsection{Explicit versus implicit file naming}
7ef84661e43e started daily.tex either.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 348
diff changeset
55 \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
56
379
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 376
diff changeset
57 %A useful behaviour that Mercurial has is that if you pass the name of
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 376
diff changeset
58 %a directory to a command, every Mercurial command will treat this as
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 376
diff changeset
59 %``I want to operate on every file in this directory and its
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 376
diff changeset
60 %subdirectories''.
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 376
diff changeset
61 %\interaction{daily.files.add-dir}
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 376
diff changeset
62 %Notice in this example that Mercurial printed the names of the files
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 376
diff changeset
63 %it added, whereas it didn't do so when we added the file named
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 376
diff changeset
64 %\filename{a} in the earlier example.
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 376
diff changeset
65
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 376
diff changeset
66 Mercurial$B$NA4$F$N%3%^%s%I$O!$0z?t$H$7$F%G%#%l%/%H%jL>$rEO$9$H!$%G%#%l%/%H(B
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 376
diff changeset
67 $B%j$NFb$NA4$F$N%U%!%$%k$H%5%V%G%#%l%/%H%j$KBP$9$kA`:n$G$"$k$H2r<a$9$k$?$a(B
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 376
diff changeset
68 $BJXMx$G$"$k!%(B
117
6b0f4498569e Beef up daily routine material. Focus on merge-across-copy.
Bryan O'Sullivan <bos@serpentine.com>
parents: 43
diff changeset
69 \interaction{daily.files.add-dir}
379
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 376
diff changeset
70 $B$3$NNc$G$O(BMercurial$B$ODI2C$7$?%U%!%$%kL>$rI=<($7$F$$$k$,!$A0$NNc$G(B
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 376
diff changeset
71 \filename{a}$B$H$$$&L>A0$N%U%!%$%k$rDI2C$7$?:]$K$OI=<($7$F$$$J$+$C$?E@$KCm(B
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 376
diff changeset
72 $B0U$5$l$?$$!%(B
42
cbfa08bcf181 Start the "Mercurial in daily use" chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
73
379
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 376
diff changeset
74 %What's going on is that in the former case, we explicitly named the
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 376
diff changeset
75 %file to add on the command line, so the assumption that Mercurial
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 376
diff changeset
76 %makes in such cases is that you know what you were doing, and it
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 376
diff changeset
77 %doesn't print any output.
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 376
diff changeset
78
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 376
diff changeset
79 $BA0$NNc$G$O%3%^%s%I%i%$%s$G$I$N%U%!%$%k$rDI2C$9$k$N$+$rL@<(E*$K;XDj$7$?$?(B
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 376
diff changeset
80 $B$a!$(BMercurial$B$O%f!<%6$,2?$r$7$h$&$H$7$F$$$k$N$+J,$+$C$F$$$k$H?dDj$7$F2?$b(B
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 376
diff changeset
81 $BI=<($7$J$+$C$?!%(B
117
6b0f4498569e Beef up daily routine material. Focus on merge-across-copy.
Bryan O'Sullivan <bos@serpentine.com>
parents: 43
diff changeset
82
379
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 376
diff changeset
83 %However, when we \emph{imply} the names of files by giving the name of
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 376
diff changeset
84 %a directory, Mercurial takes the extra step of printing the name of
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 376
diff changeset
85 %each file that it does something with. This makes it more clear what
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 376
diff changeset
86 %is happening, and reduces the likelihood of a silent and nasty
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 376
diff changeset
87 %surprise. This behaviour is common to most Mercurial commands.
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 376
diff changeset
88
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 376
diff changeset
89 $B$7$+$7%G%#%l%/%H%jL>$rM?$($k$3$H$G%U%!%$%kL>$r0EL[E*$KM?$($?>l9g!"(B
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 376
diff changeset
90 Mercurial$B$O4XO"$9$k%U%!%$%k$NL>A0$r(B1$B$D$:$DI=<($9$kDI2C$N%9%F%C%W$rF'$`!%(B
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 376
diff changeset
91 $B$3$l$K$h$C$F2?$,5/$3$C$F$$$k$N$+M}2r$7$d$9$/$9$k$H6&$K!$D@L[N"$KLq2p$JLd(B
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 376
diff changeset
92 $BBj$,5/$3$k2DG=@-$r8:$i$7$F$$$k!%$3$N5sF0$O(BMercurial$B$NBgH>$N%3%^%s%I$K6&(B
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 376
diff changeset
93 $BDL$7$F$$$k!%(B
117
6b0f4498569e Beef up daily routine material. Focus on merge-across-copy.
Bryan O'Sullivan <bos@serpentine.com>
parents: 43
diff changeset
94
368
7ef84661e43e started daily.tex either.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 348
diff changeset
95 %\subsection{Aside: Mercurial tracks files, not directories}
379
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 376
diff changeset
96 \subsection{$BM>CL(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
97
379
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 376
diff changeset
98 %Mercurial does not track directory information. Instead, it tracks
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 376
diff changeset
99 %the path to a file. Before creating a file, it first creates any
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 376
diff changeset
100 %missing directory components of the path. After it deletes a file, it
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 376
diff changeset
101 %then deletes any empty directories that were in the deleted file's
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 376
diff changeset
102 %path. This sounds like a trivial distinction, but it has one minor
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 376
diff changeset
103 %practical consequence: it is not possible to represent a completely
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 376
diff changeset
104 %empty directory in Mercurial.
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 376
diff changeset
105
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 376
diff changeset
106 Mercurial$B$O%G%#%l%/%H%j>pJs$rDI@W$7$J$$!%$=$NBe$o$j!$%U%!%$%k$X$N%Q%9$rDI(B
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 376
diff changeset
107 $B@W$7$F$$$k!%%U%!%$%k$r:n@.$9$k:]$K$O!$$^$:%Q%9$N%G%#%l%/%H%jItJ,$rJd40$9(B
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 376
diff changeset
108 $B$k!%%U%!%$%k$r>C5n$7$?8e$O!$%U%!%$%k$N4^$^$l$F$$$?6u$N%G%#%l%/%H%j$rA4$F(B
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 376
diff changeset
109 $B>C5n$9$k!%$3$l$OEvA3$N5sF0$N$h$&$K8+$($k$,!$<B:]>e$O>.$5$JLdBj$r0z$-5/$3(B
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 376
diff changeset
110 $B$9!%$9$J$o$A!$(BMercurial$B$O40A4$K6u$N%G%#%l%/%H%j$rI=8=$9$k$3$H$,$G$-$J$$$N(B
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 376
diff changeset
111 $B$G$"$k!%(B
42
cbfa08bcf181 Start the "Mercurial in daily use" chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
112
379
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 376
diff changeset
113 %Empty directories are rarely useful, and there are unintrusive
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 376
diff changeset
114 %workarounds that you can use to achieve an appropriate effect. The
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 376
diff changeset
115 %developers of Mercurial thus felt that the complexity that would be
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 376
diff changeset
116 %required to manage empty directories was not worth the limited benefit
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 376
diff changeset
117 %this feature would bring.
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 376
diff changeset
118
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 376
diff changeset
119 $B6u$N%G%#%l%/%H%j$,M-MQ$G$"$k$3$H$OLGB?$K$J$$$,!$E,Ev$J%o!<%/%"%i%&%s%I$H(B
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 376
diff changeset
120 $B$7$F!$%j%]%8%H%j$NF0$-$rK8$2$J$$J}K!$,B8:_$9$k!%(B
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 376
diff changeset
121 Mercurial$B$N3+H/<T$?$A$O!$6u$N%G%#%l%/%H%j$rI=8=$9$k$?$a$K2C$o$kJ#;($5$O!$$=(B
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 376
diff changeset
122 $B$N5!G=$K8+9g$o$J$$$H9M$($?!%(B
42
cbfa08bcf181 Start the "Mercurial in daily use" chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
123
379
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 376
diff changeset
124 %If you need an empty directory in your repository, there are a few
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 376
diff changeset
125 %ways to achieve this. One is to create a directory, then \hgcmd{add} a
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 376
diff changeset
126 %``hidden'' file to that directory. On Unix-like systems, any file
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 376
diff changeset
127 %name that begins with a period (``\texttt{.}'') is treated as hidden
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 376
diff changeset
128 %by most commands and GUI tools. This approach is illustrated in
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 376
diff changeset
129 %figure~\ref{ex:daily:hidden}.
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 376
diff changeset
130
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 376
diff changeset
131 $B%j%]%8%H%j$K6u$N%G%#%l%/%H%j$,I,MW$J>l9g!$$3$l$r<B8=$9$kJ}K!$,$$$/$D$+$"(B
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 376
diff changeset
132 $B$k!%(B1$B$DL\$O!$$^$:%G%#%l%/%H%j$r:n@.$7!$1#$7%U%!%$%k$r$3$N%G%#%l%/%H%jFb$K(B
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 376
diff changeset
133 \hgcmd{add}$B$9$k!%(BUnix$B7O%7%9%F%`$G$O!$%T%j%*%I(B(``\texttt{.}'')$B$G;O$^$k%U%!(B
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 376
diff changeset
134 $B%$%k$OBgH>$N%3%^%s%I$H(BGUI$B%D!<%k$G1#$7%U%!%$%k$H$7$F<h$j07$o$l$k!%(B
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 376
diff changeset
135 $B>\:Y$K$D$$$F$O?^(B~\ref{ex:daily:hidden}$B$r;2>H$5$l$?$$!%(B
42
cbfa08bcf181 Start the "Mercurial in daily use" chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
136
cbfa08bcf181 Start the "Mercurial in daily use" chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
137 \begin{figure}[ht]
43
7ac85766db0f Rename, remove.
Bryan O'Sullivan <bos@serpentine.com>
parents: 42
diff changeset
138 \interaction{daily.files.hidden}
379
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 376
diff changeset
139 % \caption{Simulating an empty directory using a hidden file}
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 376
diff changeset
140 \caption{$B1#$7%U%!%$%k$r;H$C$F6u$N%G%#%l%/%H%j$r%7%_%e%l!<%H$9$k(B}
43
7ac85766db0f Rename, remove.
Bryan O'Sullivan <bos@serpentine.com>
parents: 42
diff changeset
141 \label{ex:daily:hidden}
42
cbfa08bcf181 Start the "Mercurial in daily use" chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
142 \end{figure}
cbfa08bcf181 Start the "Mercurial in daily use" chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
143
379
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 376
diff changeset
144 %Another way to tackle a need for an empty directory is to simply
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 376
diff changeset
145 %create one in your automated build scripts before they will need it.
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 376
diff changeset
146
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 376
diff changeset
147 $B6u$N%G%#%l%/%H%j$r07$&JL$NJ}K!$K$O!$<+F0%S%k%I%9%/%j%W%H$NCf$G!$I,MW$K$J$k(B
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 376
diff changeset
148 $BA0$K:n@.$9$k$3$H$,$"$k!%(B
42
cbfa08bcf181 Start the "Mercurial in daily use" chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
149
368
7ef84661e43e started daily.tex either.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 348
diff changeset
150 %\section{How to stop tracking a file}
7ef84661e43e started daily.tex either.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 348
diff changeset
151 \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
152
117
6b0f4498569e Beef up daily routine material. Focus on merge-across-copy.
Bryan O'Sullivan <bos@serpentine.com>
parents: 43
diff changeset
153 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
154 the \hgcmd{remove} command; this deletes the file, and tells Mercurial
43
7ac85766db0f Rename, remove.
Bryan O'Sullivan <bos@serpentine.com>
parents: 42
diff changeset
155 to stop tracking it. A removed file is represented in the output of
7ac85766db0f Rename, remove.
Bryan O'Sullivan <bos@serpentine.com>
parents: 42
diff changeset
156 \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
157 \interaction{daily.files.remove}
42
cbfa08bcf181 Start the "Mercurial in daily use" chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
158
118
1ee53cb37a99 More progress on daily work.
Bryan O'Sullivan <bos@serpentine.com>
parents: 117
diff changeset
159 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
160 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
161 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
162 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
163 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
164 old file of the same name.
1ee53cb37a99 More progress on daily work.
Bryan O'Sullivan <bos@serpentine.com>
parents: 117
diff changeset
165
368
7ef84661e43e started daily.tex either.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 348
diff changeset
166 %\subsection{Removing a file does not affect its history}
7ef84661e43e started daily.tex either.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 348
diff changeset
167 \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
168
1ee53cb37a99 More progress on daily work.
Bryan O'Sullivan <bos@serpentine.com>
parents: 117
diff changeset
169 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
170 effects.
1ee53cb37a99 More progress on daily work.
Bryan O'Sullivan <bos@serpentine.com>
parents: 117
diff changeset
171 \begin{itemize}
1ee53cb37a99 More progress on daily work.
Bryan O'Sullivan <bos@serpentine.com>
parents: 117
diff changeset
172 \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
173 directory.
1ee53cb37a99 More progress on daily work.
Bryan O'Sullivan <bos@serpentine.com>
parents: 117
diff changeset
174 \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
175 time of the next commit.
1ee53cb37a99 More progress on daily work.
Bryan O'Sullivan <bos@serpentine.com>
parents: 117
diff changeset
176 \end{itemize}
1ee53cb37a99 More progress on daily work.
Bryan O'Sullivan <bos@serpentine.com>
parents: 117
diff changeset
177 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
178 the file.
1ee53cb37a99 More progress on daily work.
Bryan O'Sullivan <bos@serpentine.com>
parents: 117
diff changeset
179
1ee53cb37a99 More progress on daily work.
Bryan O'Sullivan <bos@serpentine.com>
parents: 117
diff changeset
180 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
181 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
182 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
183 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
184 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
185 again remove the file from the working directory.
1ee53cb37a99 More progress on daily work.
Bryan O'Sullivan <bos@serpentine.com>
parents: 117
diff changeset
186
368
7ef84661e43e started daily.tex either.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 348
diff changeset
187 %\subsection{Missing files}
7ef84661e43e started daily.tex either.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 348
diff changeset
188 \subsection{$B7gMn$7$?%U%!%$%k(B}
42
cbfa08bcf181 Start the "Mercurial in daily use" chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
189
43
7ac85766db0f Rename, remove.
Bryan O'Sullivan <bos@serpentine.com>
parents: 42
diff changeset
190 Mercurial considers a file that you have deleted, but not used
7ac85766db0f Rename, remove.
Bryan O'Sullivan <bos@serpentine.com>
parents: 42
diff changeset
191 \hgcmd{remove} to delete, to be \emph{missing}. A missing file is
7ac85766db0f Rename, remove.
Bryan O'Sullivan <bos@serpentine.com>
parents: 42
diff changeset
192 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
193 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
194 \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
195
6b0f4498569e Beef up daily routine material. Focus on merge-across-copy.
Bryan O'Sullivan <bos@serpentine.com>
parents: 43
diff changeset
196 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
197 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
198 \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
199 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
200 \interaction{daily.files.remove-after}
43
7ac85766db0f Rename, remove.
Bryan O'Sullivan <bos@serpentine.com>
parents: 42
diff changeset
201
117
6b0f4498569e Beef up daily routine material. Focus on merge-across-copy.
Bryan O'Sullivan <bos@serpentine.com>
parents: 43
diff changeset
202 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
203 \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
204 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
205 \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
206
368
7ef84661e43e started daily.tex either.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 348
diff changeset
207 %\subsection{Aside: why tell Mercurial explicitly to remove a file?}
7ef84661e43e started daily.tex either.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 348
diff changeset
208 \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
209 $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
210
117
6b0f4498569e Beef up daily routine material. Focus on merge-across-copy.
Bryan O'Sullivan <bos@serpentine.com>
parents: 43
diff changeset
211 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
212 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
213 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
214 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
215 \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
216 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
217
368
7ef84661e43e started daily.tex either.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 348
diff changeset
218 %\subsection{Useful shorthand---adding and removing files in one step}
7ef84661e43e started daily.tex either.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 348
diff changeset
219 \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
220
43
7ac85766db0f Rename, remove.
Bryan O'Sullivan <bos@serpentine.com>
parents: 42
diff changeset
221 Mercurial offers a combination command, \hgcmd{addremove}, that adds
368
7ef84661e43e started daily.tex either.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 348
diff changeset
222 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
223 \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
224 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
225 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
226 commit.
6b0f4498569e Beef up daily routine material. Focus on merge-across-copy.
Bryan O'Sullivan <bos@serpentine.com>
parents: 43
diff changeset
227 \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
228
368
7ef84661e43e started daily.tex either.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 348
diff changeset
229 %\section{Copying files}
7ef84661e43e started daily.tex either.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 348
diff changeset
230 \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
231
368
7ef84661e43e started daily.tex either.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 348
diff changeset
232 %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
233 %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
234 %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
235 %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
236 %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
237
368
7ef84661e43e started daily.tex either.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 348
diff changeset
238 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
239 $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
240 $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
241 $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
242
7ef84661e43e started daily.tex either.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 348
diff changeset
243 %\subsection{The results of copying during a merge}
7ef84661e43e started daily.tex either.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 348
diff changeset
244 \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
245
117
6b0f4498569e Beef up daily routine material. Focus on merge-across-copy.
Bryan O'Sullivan <bos@serpentine.com>
parents: 43
diff changeset
246 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
247 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
248 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
249 \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
250 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
251 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
252 \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
253 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
254 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
255 \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
256
6b0f4498569e Beef up daily routine material. Focus on merge-across-copy.
Bryan O'Sullivan <bos@serpentine.com>
parents: 43
diff changeset
257 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
258 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
259 \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
260 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
261 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
262 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
263 \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
264
6b0f4498569e Beef up daily routine material. Focus on merge-across-copy.
Bryan O'Sullivan <bos@serpentine.com>
parents: 43
diff changeset
265 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
266 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
267 created.
6b0f4498569e Beef up daily routine material. Focus on merge-across-copy.
Bryan O'Sullivan <bos@serpentine.com>
parents: 43
diff changeset
268 \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
269 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
270 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
271 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
272 \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
273 \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
274
368
7ef84661e43e started daily.tex either.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 348
diff changeset
275 %\subsection{Why should changes follow copies?}
7ef84661e43e started daily.tex either.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 348
diff changeset
276 \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
277 \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
278
6b0f4498569e Beef up daily routine material. Focus on merge-across-copy.
Bryan O'Sullivan <bos@serpentine.com>
parents: 43
diff changeset
279 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
280 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
281
6b0f4498569e Beef up daily routine material. Focus on merge-across-copy.
Bryan O'Sullivan <bos@serpentine.com>
parents: 43
diff changeset
282 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
283 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
284 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
285 happen.
42
cbfa08bcf181 Start the "Mercurial in daily use" chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
286
117
6b0f4498569e Beef up daily routine material. Focus on merge-across-copy.
Bryan O'Sullivan <bos@serpentine.com>
parents: 43
diff changeset
287 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
288 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
289 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
290
6b0f4498569e Beef up daily routine material. Focus on merge-across-copy.
Bryan O'Sullivan <bos@serpentine.com>
parents: 43
diff changeset
291 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
292 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
293 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
294 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
295 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
296
6b0f4498569e Beef up daily routine material. Focus on merge-across-copy.
Bryan O'Sullivan <bos@serpentine.com>
parents: 43
diff changeset
297 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
298 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
299 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
300 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
301
6b0f4498569e Beef up daily routine material. Focus on merge-across-copy.
Bryan O'Sullivan <bos@serpentine.com>
parents: 43
diff changeset
302 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
303 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
304 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
305 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
306
6b0f4498569e Beef up daily routine material. Focus on merge-across-copy.
Bryan O'Sullivan <bos@serpentine.com>
parents: 43
diff changeset
307 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
308 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
309 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
310 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
311 further.
6b0f4498569e Beef up daily routine material. Focus on merge-across-copy.
Bryan O'Sullivan <bos@serpentine.com>
parents: 43
diff changeset
312
368
7ef84661e43e started daily.tex either.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 348
diff changeset
313 %\subsection{How to make changes \emph{not} follow a copy}
7ef84661e43e started daily.tex either.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 348
diff changeset
314 \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
315
6b0f4498569e Beef up daily routine material. Focus on merge-across-copy.
Bryan O'Sullivan <bos@serpentine.com>
parents: 43
diff changeset
316 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
317 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
318 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
319 \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
320 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
321 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
322 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
323
368
7ef84661e43e started daily.tex either.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 348
diff changeset
324 %\subsection{Behaviour of the \hgcmd{copy} command}
7ef84661e43e started daily.tex either.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 348
diff changeset
325 \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
326
118
1ee53cb37a99 More progress on daily work.
Bryan O'Sullivan <bos@serpentine.com>
parents: 117
diff changeset
327 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
328 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
329 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
330 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
331 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
332 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
333 it here.)
118
1ee53cb37a99 More progress on daily work.
Bryan O'Sullivan <bos@serpentine.com>
parents: 117
diff changeset
334
117
6b0f4498569e Beef up daily routine material. Focus on merge-across-copy.
Bryan O'Sullivan <bos@serpentine.com>
parents: 43
diff changeset
335 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
336 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
337 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
338 \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
339 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
340 \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
341 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
342 that directory.
6b0f4498569e Beef up daily routine material. Focus on merge-across-copy.
Bryan O'Sullivan <bos@serpentine.com>
parents: 43
diff changeset
343 \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
344 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
345 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
346 \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
347 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
348 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
349 \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
350
118
1ee53cb37a99 More progress on daily work.
Bryan O'Sullivan <bos@serpentine.com>
parents: 117
diff changeset
351 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
352 then want Mercurial to know that you've copied the file, simply use
236
abebe72451d6 Fix thinko.
Bryan O'Sullivan <bos@serpentine.com>
parents: 182
diff changeset
353 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
354 \interaction{daily.copy.after}
1ee53cb37a99 More progress on daily work.
Bryan O'Sullivan <bos@serpentine.com>
parents: 117
diff changeset
355
368
7ef84661e43e started daily.tex either.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 348
diff changeset
356 %\section{Renaming files}
7ef84661e43e started daily.tex either.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 348
diff changeset
357 \section{$B%U%!%$%k$N%j%M!<%`(B}
43
7ac85766db0f Rename, remove.
Bryan O'Sullivan <bos@serpentine.com>
parents: 42
diff changeset
358
118
1ee53cb37a99 More progress on daily work.
Bryan O'Sullivan <bos@serpentine.com>
parents: 117
diff changeset
359 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
360 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
361 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
362 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
363 you copy a file tells you what to expect when you rename a file.
43
7ac85766db0f Rename, remove.
Bryan O'Sullivan <bos@serpentine.com>
parents: 42
diff changeset
364
118
1ee53cb37a99 More progress on daily work.
Bryan O'Sullivan <bos@serpentine.com>
parents: 117
diff changeset
365 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
366 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
367 \interaction{daily.rename.rename}
1ee53cb37a99 More progress on daily work.
Bryan O'Sullivan <bos@serpentine.com>
parents: 117
diff changeset
368 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
369 the copied-from file as removed.
1ee53cb37a99 More progress on daily work.
Bryan O'Sullivan <bos@serpentine.com>
parents: 117
diff changeset
370 \interaction{daily.rename.status}
1ee53cb37a99 More progress on daily work.
Bryan O'Sullivan <bos@serpentine.com>
parents: 117
diff changeset
371 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
372 \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
373 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
374 removed, file.
1ee53cb37a99 More progress on daily work.
Bryan O'Sullivan <bos@serpentine.com>
parents: 117
diff changeset
375 \interaction{daily.rename.status-copy}
1ee53cb37a99 More progress on daily work.
Bryan O'Sullivan <bos@serpentine.com>
parents: 117
diff changeset
376
1ee53cb37a99 More progress on daily work.
Bryan O'Sullivan <bos@serpentine.com>
parents: 117
diff changeset
377 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
378 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
379 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
380 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
381
368
7ef84661e43e started daily.tex either.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 348
diff changeset
382 %\subsection{Renaming files and merging changes}
7ef84661e43e started daily.tex either.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 348
diff changeset
383 \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
384
376
9f7812b79c70 more daily.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 368
diff changeset
385 %Since Mercurial's rename is implemented as copy-and-remove, the same
9f7812b79c70 more daily.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 368
diff changeset
386 %propagation of changes happens when you merge after a rename as after
9f7812b79c70 more daily.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 368
diff changeset
387 %a copy.
9f7812b79c70 more daily.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 368
diff changeset
388
9f7812b79c70 more daily.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 368
diff changeset
389 Mercurial$B$N%j%M!<%`$O%3%T!<$H:o=|$H$7$F<BAu$5$l$F$*$j!$%j%M!<%`8e$K%^!<(B
9f7812b79c70 more daily.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 368
diff changeset
390 $B%8$r9T$&$N$H!$%3%T!<8e$K%^!<%8$r9T$&$N$G$OF1$8JQ99$NGH5Z$,5/$-$k!%(B
9f7812b79c70 more daily.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 368
diff changeset
391
9f7812b79c70 more daily.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 368
diff changeset
392 %If I modify a file, and you rename it to a new name, and then we merge
9f7812b79c70 more daily.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 368
diff changeset
393 %our respective changes, my modifications to the file under its
9f7812b79c70 more daily.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 368
diff changeset
394 %original name will be propagated into the file under its new name.
9f7812b79c70 more daily.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 368
diff changeset
395 %(This is something you might expect to ``simply work,'' but not all
9f7812b79c70 more daily.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 368
diff changeset
396 %revision control systems actually do this.)
118
1ee53cb37a99 More progress on daily work.
Bryan O'Sullivan <bos@serpentine.com>
parents: 117
diff changeset
397
376
9f7812b79c70 more daily.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 368
diff changeset
398 $B;d$,%U%!%$%k$rJQ99$7!$$"$J$?$,$=$N%U%!%$%k$r$r?7$7$$L>A0$K%j%M!<%`$7$?>l(B
9f7812b79c70 more daily.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 368
diff changeset
399 $B9g!$2f!9$,$*8_$$$NJQ99$r%^!<%8$9$k$H85$N%U%!%$%kL>$KBP$9$k;d$NJQ99$O!$?7(B
9f7812b79c70 more daily.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 368
diff changeset
400 $B$7$$%U%!%$%kL>$N%U%!%$%k$KGH5Z$9$k!%(B $B!J$3$l$,$G$-$k$N$OEv$?$jA0$H;W$&$+$b(B
9f7812b79c70 more daily.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 368
diff changeset
401 $B$7$l$J$$$,!$<B$N$H$3$m!$A4$F$N%j%S%8%g%s%3%s%H%m!<%k%7%9%F%`$,$G$-$k$o$1(B
9f7812b79c70 more daily.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 368
diff changeset
402 $B$G$O$J$$!%!K(B
43
7ac85766db0f Rename, remove.
Bryan O'Sullivan <bos@serpentine.com>
parents: 42
diff changeset
403
376
9f7812b79c70 more daily.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 368
diff changeset
404 %Whereas having changes follow a copy is a feature where you can
9f7812b79c70 more daily.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 368
diff changeset
405 %perhaps nod and say ``yes, that might be useful,'' it should be clear
9f7812b79c70 more daily.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 368
diff changeset
406 %that having them follow a rename is definitely important. Without
9f7812b79c70 more daily.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 368
diff changeset
407 %this facility, it would simply be too easy for changes to become
9f7812b79c70 more daily.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 368
diff changeset
408 %orphaned when files are renamed.
9f7812b79c70 more daily.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 368
diff changeset
409
9f7812b79c70 more daily.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 368
diff changeset
410 $BJQ99$,%3%T!<$K=>$&5!G=$,M-MQ$G$"$k$3$H$O!$$*$=$i$/MF0W$KF10U$,F@$i$l$k$H(B
9f7812b79c70 more daily.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 368
diff changeset
411 $B$3$m$G$"$k$H;W$o$l$k!%$H$j$o$1%j%M!<%`$KDI=>$9$k5!G=$O$-$o$a$F=EMW$G$"$k(B
9f7812b79c70 more daily.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 368
diff changeset
412 $B$3$H$OL@Gr$G$"$k!%$b$7$3$N5!G=$,$J$1$l$P!$%U%!%$%k$N%j%M!<%`$K$h$C$FJQ99(B
9f7812b79c70 more daily.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 368
diff changeset
413 $B$OMF0W$/9T$->l$r<:$C$F$7$^$&$@$m$&!%(B
121
9094c9fda8ec Start chapter on error recovery.
Bryan O'Sullivan <bos@serpentine.com>
parents: 118
diff changeset
414
368
7ef84661e43e started daily.tex either.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 348
diff changeset
415 %\subsection{Divergent renames and merging}
7ef84661e43e started daily.tex either.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 348
diff changeset
416 \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
417
376
9f7812b79c70 more daily.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 368
diff changeset
418 %The case of diverging names occurs when two developers start with a
9f7812b79c70 more daily.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 368
diff changeset
419 %file---let's call it \filename{foo}---in their respective
9f7812b79c70 more daily.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 368
diff changeset
420 %repositories.
9f7812b79c70 more daily.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 368
diff changeset
421
9f7812b79c70 more daily.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 368
diff changeset
422 2$B?M$N3+H/<T$N%j%]%8%H%j4V$G(B1$B$D$N%U%!%$%k(B ---\filename{foo}$B$H8F$V$3$H$K$9(B
9f7812b79c70 more daily.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 368
diff changeset
423 $B$k(B--- $B$K$D$$$FL>A0$NH/;6$,5/$3$C$?>l9g$K$D$$$F9M$($F$_$h$&!%(B
156
91a936be78b8 Document merge behaviour with file names.
Bryan O'Sullivan <bos@serpentine.com>
parents: 121
diff changeset
424
91a936be78b8 Document merge behaviour with file names.
Bryan O'Sullivan <bos@serpentine.com>
parents: 121
diff changeset
425 \interaction{rename.divergent.clone}
376
9f7812b79c70 more daily.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 368
diff changeset
426 %Anne renames the file to \filename{bar}.
9f7812b79c70 more daily.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 368
diff changeset
427 $B%"%s$O%U%!%$%k$r(B\filename{bar}$B$H2~L>$7$?!%(B
156
91a936be78b8 Document merge behaviour with file names.
Bryan O'Sullivan <bos@serpentine.com>
parents: 121
diff changeset
428 \interaction{rename.divergent.rename.anne}
376
9f7812b79c70 more daily.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 368
diff changeset
429 %Meanwhile, Bob renames it to \filename{quux}.
9f7812b79c70 more daily.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 368
diff changeset
430 $B$=$N4V!$%\%V$OF1$8%U%!%$%k$r(B\filename{quux}$B$H2~L>$7$?!%(B
156
91a936be78b8 Document merge behaviour with file names.
Bryan O'Sullivan <bos@serpentine.com>
parents: 121
diff changeset
431 \interaction{rename.divergent.rename.bob}
91a936be78b8 Document merge behaviour with file names.
Bryan O'Sullivan <bos@serpentine.com>
parents: 121
diff changeset
432
376
9f7812b79c70 more daily.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 368
diff changeset
433 %I like to think of this as a conflict because each developer has
9f7812b79c70 more daily.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 368
diff changeset
434 %expressed different intentions about what the file ought to be named.
9f7812b79c70 more daily.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 368
diff changeset
435
9f7812b79c70 more daily.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 368
diff changeset
436 $B3F!9$N3+H/<T$O%U%!%$%k$,$I$N$h$&$K8F$P$l$k$Y$-$+$K$D$$$F0[$J$C$?0U?^$r;}$C(B
9f7812b79c70 more daily.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 368
diff changeset
437 $B$F$*$j!$$3$l$O%3%s%U%j%/%H$H9M$($i$l$k!%(B
156
91a936be78b8 Document merge behaviour with file names.
Bryan O'Sullivan <bos@serpentine.com>
parents: 121
diff changeset
438
376
9f7812b79c70 more daily.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 368
diff changeset
439 %What do you think should happen when they merge their work?
9f7812b79c70 more daily.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 368
diff changeset
440 %Mercurial's actual behaviour is that it always preserves \emph{both}
9f7812b79c70 more daily.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 368
diff changeset
441 %names when it merges changesets that contain divergent renames.
9f7812b79c70 more daily.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 368
diff changeset
442 %\interaction{rename.divergent.merge}
9f7812b79c70 more daily.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 368
diff changeset
443
9f7812b79c70 more daily.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 368
diff changeset
444 $BH`$i$,%^!<%8$r9T$C$?:]$K$I$&$J$l$P$h$$$@$m$&$+!)(B Mercurial$B$N<B:]$N5sF0(B
9f7812b79c70 more daily.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 368
diff changeset
445 $B$O!$H/;6$7$?%j%M!<%`$,$"$k%A%'%s%8%;%C%H$r%^!<%8$7$?>l9g$O>o$K(B\emph{$BN>J}(B}$B$N(B
9f7812b79c70 more daily.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 368
diff changeset
446 $BL>A0$rJ]B8$9$k!%(B
156
91a936be78b8 Document merge behaviour with file names.
Bryan O'Sullivan <bos@serpentine.com>
parents: 121
diff changeset
447 \interaction{rename.divergent.merge}
91a936be78b8 Document merge behaviour with file names.
Bryan O'Sullivan <bos@serpentine.com>
parents: 121
diff changeset
448
376
9f7812b79c70 more daily.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 368
diff changeset
449 %Notice that Mercurial does warn about the divergent renames, but it
9f7812b79c70 more daily.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 368
diff changeset
450 %leaves it up to you to do something about the divergence after the merge.
9f7812b79c70 more daily.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 368
diff changeset
451
9f7812b79c70 more daily.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 368
diff changeset
452 Mercurial$B$OL>A0$NH/;6$K$D$$$F7Y9p$9$k$,!$%^!<%88e$bL>A0$NH/;6$N2r7h$O%f!<(B
9f7812b79c70 more daily.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 368
diff changeset
453 $B%6$KG$$;$kE@$KCm0U!%(B
156
91a936be78b8 Document merge behaviour with file names.
Bryan O'Sullivan <bos@serpentine.com>
parents: 121
diff changeset
454
368
7ef84661e43e started daily.tex either.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 348
diff changeset
455 %\subsection{Convergent renames and merging}
7ef84661e43e started daily.tex either.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 348
diff changeset
456 \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
457
376
9f7812b79c70 more daily.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 368
diff changeset
458 %Another kind of rename conflict occurs when two people choose to
9f7812b79c70 more daily.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 368
diff changeset
459 %rename different \emph{source} files to the same \emph{destination}.
9f7812b79c70 more daily.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 368
diff changeset
460 %In this case, Mercurial runs its normal merge machinery, and lets you
9f7812b79c70 more daily.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 368
diff changeset
461 %guide it to a suitable resolution.
9f7812b79c70 more daily.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 368
diff changeset
462
9f7812b79c70 more daily.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 368
diff changeset
463 2$B?M$N%f!<%6$,0[$J$k(B\emph{$B%=!<%9(B}$B%U%!%$%k72$rF10l$N(B\emph{$BL\E*(B}$B%U%!%$%k$K%j(B
9f7812b79c70 more daily.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 368
diff changeset
464 $B%M!<%`$9$k$H>WFM$,5/$-$k!%$3$N>l9g!$(BMercurial$B$ODL>o$N%^!<%85!9=$r5/F0$7!$(B
9f7812b79c70 more daily.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 368
diff changeset
465 $B%f!<%6$KE,@Z$J2r7h$rB%$9!%(B
156
91a936be78b8 Document merge behaviour with file names.
Bryan O'Sullivan <bos@serpentine.com>
parents: 121
diff changeset
466
368
7ef84661e43e started daily.tex either.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 348
diff changeset
467 %\subsection{Other name-related corner cases}
7ef84661e43e started daily.tex either.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 348
diff changeset
468 \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
469
376
9f7812b79c70 more daily.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 368
diff changeset
470 %Mercurial has a longstanding bug in which it fails to handle a merge
9f7812b79c70 more daily.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 368
diff changeset
471 %where one side has a file with a given name, while another has a
9f7812b79c70 more daily.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 368
diff changeset
472 %directory with the same name. This is documented as~\bug{29} .
9f7812b79c70 more daily.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 368
diff changeset
473 %\interaction{issue29.go}
9f7812b79c70 more daily.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 368
diff changeset
474
9f7812b79c70 more daily.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 368
diff changeset
475 Mercurial$B$K$O!$0lJ}$rL>A0$rM?$($?%U%!%$%k!$$b$&0lJ}$rF1L>$N%G%#%l%/%H%j$H(B
9f7812b79c70 more daily.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 368
diff changeset
476 $B$7$F%^!<%8$r9T$&$H<:GT$9$k%P%0$,0JA0$+$i$"$k!%$3$l$O(B~\bug{29}$B$H$7$F%I%-%e(B
9f7812b79c70 more daily.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 368
diff changeset
477 $B%a%s%H2=$5$l$F$$$k!%(B
156
91a936be78b8 Document merge behaviour with file names.
Bryan O'Sullivan <bos@serpentine.com>
parents: 121
diff changeset
478 \interaction{issue29.go}
121
9094c9fda8ec Start chapter on error recovery.
Bryan O'Sullivan <bos@serpentine.com>
parents: 118
diff changeset
479
368
7ef84661e43e started daily.tex either.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 348
diff changeset
480 %\section{Recovering from mistakes}
7ef84661e43e started daily.tex either.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 348
diff changeset
481 \section{$B%_%9$+$i$N2sI|(B}
7ef84661e43e started daily.tex either.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 348
diff changeset
482
7ef84661e43e started daily.tex either.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 348
diff changeset
483 %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
484 %some common mistakes.
180
6413f88338df Point to chapter on undoing mistakes.
Bryan O'Sullivan <bos@serpentine.com>
parents: 178
diff changeset
485
368
7ef84661e43e started daily.tex either.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 348
diff changeset
486 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
487
7ef84661e43e started daily.tex either.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 348
diff changeset
488 %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
489 %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
490 %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
491 %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
492 %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
493 %\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
494
368
7ef84661e43e started daily.tex either.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 348
diff changeset
495 \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
496 $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
497 \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
498 $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
499
7ef84661e43e started daily.tex either.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 348
diff changeset
500 %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
501 %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
502 %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
503 %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
504
368
7ef84661e43e started daily.tex either.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 348
diff changeset
505 \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
506 $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
507 $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
508
368
7ef84661e43e started daily.tex either.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 348
diff changeset
509 %For more information about the \hgcmd{revert} command, and details
7ef84661e43e started daily.tex either.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 348
diff changeset
510 %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
511 %chapter~\ref{chap:undo}.
180
6413f88338df Point to chapter on undoing mistakes.
Bryan O'Sullivan <bos@serpentine.com>
parents: 178
diff changeset
512
368
7ef84661e43e started daily.tex either.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 348
diff changeset
513 \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
514 $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
515
7ef84661e43e started daily.tex either.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 348
diff changeset
516 %%% Local Variables:
293
3b1291f24c0d - replaved latex-mode to yatex-mode
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 290
diff changeset
517 %%% mode: yatex
42
cbfa08bcf181 Start the "Mercurial in daily use" chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
518 %%% TeX-master: "00book"
368
7ef84661e43e started daily.tex either.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 348
diff changeset
519 %%% End: