
foozy@708: \chapter{Mercurial in daily use}
foozy@708: \label{chap:daily}
foozy@708: 
foozy@708: \section{Telling Mercurial which files to track}
foozy@708: 
foozy@708: $B%U%!%$%k$N4IM}$r;X<($7$J$$8B$j!"(B
foozy@708: $B%j%]%8%H%jCf$N%U%!%$%k$KBP$7$F(B Mercurial $B$O2?$b9T$$$^$;$s!#(B
foozy@708: \hgcmd{status} $B%3%^%s%I$O!"(B
foozy@708: Mercurial $B$N4IM}2<$KL5$$%U%!%$%k$r(B
foozy@708: ``\texttt{?}'' $B$rI=<($9$k$3$H$GCN$i$;$F$/$l$^$9(B
foozy@708: 
foozy@708: Mercurial $B$K$h$k9=@.4IM}$r;X<($9$k$K$O!"(B
foozy@708: \hgcmd{add} $B%3%^%s%I$r;HMQ$7$^$9!#(B
foozy@708: $B%U%!%$%k$N9=@.4IM}$r;X<($7$?%U%!%$%k$N(B
foozy@708: \hgcmd{status} $B$K$h$kI=<($O!"(B
foozy@708: ``\texttt{?}'' $B$+$i(B ``\texttt{A}'' $B$X$HJQ2=$7$^$9!#(B
foozy@708: 
foozy@708: \interaction{daily.files.add}
foozy@708: 
foozy@708: \hgcmd{commit} $B$r<B9T$7$?D>8e$O!"(B
foozy@708: $B%3%_%C%HA0$KDI2C$7$?%U%!%$%k$,(B
foozy@708: \hgcmd{status} $B$K$h$jI=<($5$l$k$3$H$O$"$j$^$;$s!#(B
foozy@708: $B$3$l$O!"(B
foozy@708: ``$B6=L#?<$$(B''$B%U%!%$%k(B---
foozy@708: $BJQ99$7$?$j!"(BMercurial $B$K2?$i$+$NA`:n$rMW5a$7$?%U%!%$%k(B
foozy@708: ---$B$K$D$$$FI=<($9$k$N$,(B
foozy@708: \hgcmd{status} $B$NLr3d$@$+$i$G$9!#(B
foozy@708: $B?t@i$N%U%!%$%k$+$i@.$k%j%]%8%H%j$,$"$k>l9g!"(B
foozy@708: $B9=@.4IM}$5$l$F$O$$$F$bFC$KJQ99$5$l$F$$$J$$%U%!%$%k$N0lMw(B
foozy@708: $B!J8e=R$9$k$h$&$K!"$=$N$h$&$J%U%!%$%k0lMw$N>pJs$rF@$k$3$H$b$G$-$^$9!K(B
foozy@708: $B$rM_$7$$$H;W$&$3$H$O5)$G$9!#(B
foozy@708: 
foozy@708: $B0lC6%U%!%$%k$rDI2C$7$?$H$7$F$b!"(B
foozy@708: $B$=$N%U%!%$%k$KBP$7$F(B Mercurial $B$O$9$0$K$O2?$b9T$$$^$;$s!#(B
foozy@708: $B$=$NBe$o$j!"(B
foozy@708: $B<!$K%3%_%C%H$r9T$C$?:]$K%U%!%$%k>uBV$N%9%J%C%W%7%g%C%H$r:n@.$7$^$9!#(B
foozy@708: Mercurial $B$O$=$l0J9_!"(B
foozy@708: $B9=@.4IM}2<$+$i=|30$9$k$^$G!"(B
foozy@708: $B%3%_%C%H$N:]$K$O>o$KEv3:%U%!%$%k$NJQ99>u67$r3NG'$7$^$9!#(B
foozy@708: 
foozy@708: \subsection{Explicit versus implicit file naming}
foozy@708: 
foozy@708: Mercurial $B$NM-MQ$J?6$kIq$$$H$7$F!"(B
foozy@708: Mercurial $B$N%3%^%s%I$K%G%#%l%/%H%jL>$r;XDj$7$?>l9g!"(B
foozy@708: $B$=$N;XDj$r(B
foozy@708: ``$BEv3:%G%#%l%/%H%jG[2<$NA4$F$N%U%!%$%k(B\footnote{$BLuCm(B:
foozy@708: $BEv3:%G%#%l%/%H%jD>2<$N%U%!%$%k$J$i$S$K!"(B
foozy@708: $B%5%V%G%#%l%/%H%j0J2<$N%U%!%$%kA4$F(B}$B$KBP$9$kA`:n$N<B;\(B''
foozy@708: $B$,MW5a$5$l$?$b$N$H$_$J$7$^$9!#(B
foozy@708: 
foozy@708: \interaction{daily.files.add-dir}
foozy@708: 
foozy@708: $B@h$NNc$G(B \filename{a} 
foozy@708: $B%U%!%$%k$r9=@.4IM}BP>]$KDI2C$7$?:]$K$O!"(B
foozy@708: Mercurial $B$ODI2C$5$l$?%U%!%$%k$N%U%!%$%kL>$rI=<($7$F$$$^$;$s$,!"(B
foozy@708: $B$3$NNc$G$O(B
foozy@708: $B9=@.4IM}BP>]$KDI2C$5$l$?%U%!%$%k$rI=<($7$F$$$kE@$KCm0U$7$F$/$@$5$$!#(B
foozy@708: 
foozy@708: $B@h$NNc$G$O!"(B
foozy@708: $BDI2C$9$k%U%!%$%kL>$r%3%^%s%I%i%$%s$GL@<(E*$K;XDj$7$^$7$?$N$G!"(B
foozy@708: $B$=$N$h$&$J>l9g$OMxMQ<T<+?H$,<+J,$N?6$kIq$$$rM}2r$7$F$$$k$b$N$H$_$J$7!"(B
foozy@708: Mercurial $B$O2?$bI=<($7$^$;$s!#(B
foozy@708: 
foozy@708: $B$7$+$7!"(B
foozy@708: $B%G%#%l%/%H%jL>$r;XDj$9$k$3$H$G%U%!%$%kL>$r(B\emph{$B0E<((B}$B$7$?>l9g!"(B
foozy@708: Mercurial $B$OFCJL$KA`:nBP>]$H$J$C$?8D!9$N%U%!%$%kL>$rI=<($7$^$9!#(B
foozy@708: $B$3$&$9$k$3$H$G2?$,<B;\$5$l$?$N$+$,L@3N$K$J$k$?$a!"(B
foozy@708: $B$R$C$=$j$H$d$C$+$$$JLdBj$,H/@8$9$k2DG=@-$rDc8:$7$^$9!#(B
foozy@708: $B$3$N?6$kIq$$$OKX$I$N(B
foozy@708: Mercurial $B%3%^%s%I$K6&DL$7$F$$$^$9!#(B
foozy@708: 
foozy@708: \subsection{Aside: Mercurial tracks files, not directories}
foozy@708: 
foozy@708: $B%G%#%l%/%H%j$O(B Mercurial $B$K$h$k9=@.4IM}$NBP>]$K$O$J$j$^$;$s!#(B
foozy@708: $B$=$NBe$o$j!"(B
foozy@708: Mercurial $B$O%U%!%$%k$N%Q%9$r9=@.4IM}$7$^$9!#(B
foozy@708: $B%U%!%$%k$N@8@.$N:]$K$O!"(B
foozy@708: $B$=$l$K@hN)$C$F%Q%9$K4^$^$l$kB8:_$7$J$$%G%#%l%/%H%j$rA4$F:n@.$7$^$9!#(B
foozy@708: $B%U%!%$%k$N:o=|$N:]$K$O!"(B
foozy@708: $B:o=|$5$l$?%U%!%$%k$X$N%Q%9$K4^$^$l$k6u%G%#%l%/%H%j$rA4$F:o=|$7$^$9!#(B
foozy@708: $B$?$o$$$bL5$$$3$H$KJ9$3$($k$+$b$7$l$^$;$s$,!"(B
foozy@708: Mercurial $B$,40A4$K6u$C$]$N%G%#%l%/%H%j$r<h$j07$($J$$!"(B
foozy@708: $B$H$$$&>.$5$$$J$,$i$b<BMQ>e=EBg$J@-<A$r<($7$F$$$^$9!#(B
foozy@708: 
foozy@708: $B6u$N%G%#%l%/%H%j$,M-MQ$J$3$H$OLGB?$KL5$$$G$9$7!"(B
foozy@708: $BBEEv$J8z2L$rF@$k$?$a$N95$($a$J2sHrJ}K!$,$"$j$^$9!#(B
foozy@708: Empty directories are rarely useful, and there are unintrusive
foozy@708: workarounds that you can use to achieve an appropriate effect.  
foozy@708: $B$=$l8N$K!"(B
foozy@708: $B6u$N%G%#%l%/%H%j$r07$&$3$H$K$h$k8BDjE*$JM-1W@-$,!"(B
foozy@708: $B$=$l$KI,MW$H$5$l$kJ#;($5$K8+9g$&$b$N$G$O$J$$!"(B
foozy@708: $B$H(B Mercurial $B$N3+H/?X$OH=CG$7$^$7$?!#(B
foozy@708: 
foozy@708: $B6u$N%G%#%l%/%H%j$r%j%]%8%H%j$G4IM}$7$?$$>l9g!"(B
foozy@708: $BJ#?t$N<B8=J}K!$,$"$j$^$9!#(B
foozy@708: $B#1$D$OEv3:%G%#%l%/%H%jD>2<$N(B``$B1#$7(B''$B%U%!%$%k$r(B 
foozy@708: \hgcmd{add} $B$9$k$3$H$G$9!#(B
foozy@708: UNIX $B%i%$%/$J%7%9%F%`$G$O!"(B
foozy@708: $B%T%j%*%I!J(B``\texttt{.}''$B!K$G;O$^$kL>A0$N%U%!%$%k$O!"(B
foozy@708: $BKX$I$N%3%^%s%I$d(B GUI $B%D!<%k$+$i1#$7%U%!%$%k$H$7$F07$o$l$^$9!#(B
foozy@708: $B$3$N<jK!$r?^(B~\ref{ex:daily:hidden}$B$K<($7$^$9!#(B
foozy@708: 
foozy@708: \begin{figure}[ht]
foozy@708:   \interaction{daily.files.hidden}
foozy@708:   \caption{Simulating an empty directory using a hidden file}
foozy@708:   \label{ex:daily:hidden}
foozy@708: \end{figure}
foozy@708: 
foozy@708: $B6u%G%#%l%/%H%j$rI,MW$H$9$k>l9g$N$b$&0l$D$N2r7hJ}K!$O!"(B
foozy@708: $B<+F02=$5$l$?%S%k%I%9%/%j%W%H$GI,MW$K$J$kETEY:n@.$9$k!"(B
foozy@708: $B$H$$$&$b$N$G$9!#(B
foozy@708: 
foozy@708: \section{How to stop tracking a file}
foozy@708: 
foozy@708: $B%j%]%8%H%j$K$H$C$FITMW$K$J$C$?(B\footnote{$BLuCm(B:
foozy@708: $B9=@.4IM}$NI,MW@-$,$J$/$J$C$?(B}$B%U%!%$%k$,$"$k>l9g$O!"(B
foozy@708: \hgcmd{remove} $B%3%^%s%I$r;HMQ$^$9!#(B
foozy@708: $B$3$N%3%^%s%I$O%U%!%$%k$r:o=|$7$D$D!"(B
foozy@708: Mercurial $B$K9=@.4IM}BP>]$+$i%U%!%$%k$r=|30$9$k;]$rDLCN$7$^$9!#(B
foozy@708: $B:o=|$5$l$?%U%!%$%k$O!"(B
foozy@708: \hgcmd{status} $B$N=PNO$G$O(B
foozy@708: ``\texttt{R}'' $BIU$-$GI=<($5$l$^$9!#(B
foozy@708: 
foozy@708: \interaction{daily.files.remove}
foozy@708: 
foozy@708: \hgcmd{remove} $B$K$h$k%U%!%$%k$N:o=|$r9T$&$H!"(B
foozy@708: $B:n6HNN0h%G%#%l%/%H%j$KF1L>$N%U%!%$%k$r:FEY:n@.$7$?$H$7$F$b!"(B
foozy@708: Mercurial $B$O$=$N%U%!%$%k$r9=@.4IM}BP>]$+$i=|30$7$^$9!#(B
foozy@708: $BF1L>%U%!%$%k$r:F@8@.$7(B Mercurial $B$K$h$k9=@.4IM}$r9T$&>l9g$K$O!"(B
foozy@708: $BC1=c$K$=$N%U%!%$%k$r(B \hgcmd{add} $B$7$F$/$@$5$$!#(B
foozy@708: Mercurial $B$O?75,$K4IM}BP>]$K2C$($i$l$?%U%!%$%k$,!"(B
foozy@708: $B0JA04IM}$7$F$$$?F1L>$N%U%!%$%k$H$OL54X78$G$"$k$H$_$J$7$^$9!#(B
foozy@708: 
foozy@708: \subsection{Removing a file does not affect its history}
foozy@708: 
foozy@708: $B=EMW$J;v$G$9$N$G!"(B
foozy@708: \hgcmd{remove} $B%3%^%s%I$K$h$kA`:n$,;}$D1F6A$O#2$D$@$1$G$"$k!"(B
foozy@708: $B$HM}2r$7$F$/$@$5$$!#(B
foozy@708: 
foozy@708: \begin{itemize}
foozy@708: \item $B:n6HNN0h%G%#%l%/%H%j$+$i!"8=;~E@$N%U%!%$%k$r:o=|$7$^$9(B
foozy@708: 
foozy@708: \item Mercurial $B$KBP$7$F!"<!2s$N%3%_%C%H0J9_!"(B
foozy@708:   $BEv3:%U%!%$%k$r9=@.4IM}BP>]$+$i=|30$9$k$h$&$KDLCN$7$^$9(B
foozy@708: 
foozy@708: \end{itemize}
foozy@708: 
foozy@708: \hgcmd{remove} $B%3%^%s%I$K$h$kA`:n$O!"(B
foozy@708: $B%U%!%$%k$N(B\emph{$BJQ99MzNr(B}$B$K$O0l@ZJQ99$r2C$((B\emph{$B$^$;$s(B}$B!#(B
foozy@708: 
foozy@708: $B:n6HNN0h%G%#%l%/%H%j$r(B
foozy@708: \hgcmd{remove} 
foozy@708: $B$G:o=|$7$?%U%!%$%k$,$^$@9=@.4IM}$5$l$F$$$?;~E@$N%A%'%s%8%;%C%H$G99?7$7$?>l9g!"(B
foozy@708: $B$=$N%A%'%s%8%;%C%H$,%3%_%C%H$5$l$?;~E@$NFbMF$G!"(B
foozy@708: $B:n6HNN0h%G%#%l%/%H%j$KEv3:%U%!%$%k$,:F@8@.$5$l$^$9!#(B
foozy@708: $B$=$N8e$G!"(B
foozy@708: $BEv3:%U%!%$%k$,(B \hgcmd{remove} 
foozy@708: $B$G:o=|$5$l$?;~E@$N%A%'%s%8%;%C%H$G99?7$9$k$H!"(B
foozy@708: Mercurial $B$O:F$SEv3:%U%!%$%k$r:n6HNN0h$+$i:o=|$7$^$9!#(B
foozy@708: 
foozy@708: \subsection{Missing files}
foozy@708: 
foozy@708: \hgcmd{remove} 
foozy@708: $B%3%^%s%I$r;HMQ$;$:$K:n6HNN0h%G%#%l%/%H%j$+$i:o=|$7$?%U%!%$%k$r!"(B
foozy@708: Mercurial $B$O(B\emph{$B9TJ}ITL@(B}$B$H$_$J$7$^$9!#(B
foozy@708: $B9TJ}ITL@$N%U%!%$%k$O!"(B
foozy@708: \hgcmd{status} $B$N=PNO$G$O(B
foozy@708: ``\texttt{!}'' $BIU$-$GI=<($5$l$^$9!#(B
foozy@708: Mercurial $B$N%3%^%s%I72A4HL$O!"(B
foozy@708: $B9TJ}ITL@$N%U%!%$%k$K4X$7$F$O2?$b9T$$$^$;$s!#(B
foozy@708: 
foozy@708: \interaction{daily.files.missing}
foozy@708: 
foozy@708: \hgcmd{status} 
foozy@708: $B$,9TJ}ITL@$H$7$FI=<($9$k%U%!%$%k$,%j%]%8%H%jCf$K$"$k>l9g(B\footnote{$BLuCm(B:
foozy@708: $B$D$^$j<jF0$G%U%!%$%k$r:o=|$7$?>l9g(B}$B!"(B
foozy@708: $B%U%!%$%k:o=|8e$NG$0U$N;~E@$G(B
foozy@708: \hgcmdargs{remove}{\hgopt{remove}{--after}} $B$r<B9T$9$k$3$H$G(B
foozy@708: $BEv3:%U%!%$%k$r9=@.4IM}BP>]$+$i=|30$9$k0U;W$,$"$k$3$H$r(B
foozy@708: Mercurial $B$KDLCN$9$k$3$H$,$G$-$^$9!#(B
foozy@708: 
foozy@708: \interaction{daily.files.remove-after}
foozy@708: 
foozy@708: $B$=$N0lJ}$G!"(B
foozy@708: $B9TJ}ITL@$H$5$l$F$$$k%U%!%$%k$,0U?^$;$:$K:o=|$7$F$7$^$C$?$b$N$J$i!"(B
foozy@708: \hgcmd{revert} $B$KEv3:%U%!%$%kL>$r;XDj$9$k$3$H$G!"(B
foozy@708: $BJQ99$5$l$F$$$J$$>uBV$K%U%!%$%k$rI|5l$9$k$3$H$,$G$-$^$9!#(B
foozy@708: 
foozy@708: \interaction{daily.files.recover-missing}
foozy@708: 
foozy@708: \subsection{Aside: why tell Mercurial explicitly to remove a file?}
foozy@708: 
foozy@708: $B%U%!%$%k:o=|$N0U;WI=<($r0l!9(B Mercurial $B$K<($9I,MW@-$K$D$$$F!"(B
foozy@708: $B5?Ld$K;W$o$l$k$+$b$7$l$^$;$s!#(B
foozy@708: Mercurial $B$N3+H/=i4|$K$*$1$k:o=|J}K!$O!"(B
foozy@708: $B$=$N$h$&$K;W$&?M$K$H$C$F$OK>$^$7$$$b$N$+$b$7$l$^$;$s!#(B
foozy@708: Mercurial $B$O(B \hgcmd{commit} $B%3%^%s%I<B9T;~$K%U%!%$%k$NIT:_$r<+F0E*$K8!CN$7!"(B
foozy@708: $BEv3:%U%!%$%k$r9=@.4IM}BP>]$+$i=|30$7$F$$$?$N$G$9!#(B
foozy@708: $B<B:]LdBj!"$3$N:o=|J}K!$G$O!"(B
foozy@708: $BITN8$N;vBV$GDLCN$bL5$/%U%!%$%k$,:o=|$5$l$k;vBV$,MF0W$K5/$3$jF@$^$9!#(B
foozy@708: 
foozy@708: \subsection{Useful shorthand---adding and removing files in one step}
foozy@708: 
foozy@708: Mercurial $B$O!"(B
foozy@708: $B9=@.4IM}BP>]$X$N%U%!%$%k$NDI2C$H=|30$r9T$&!"(B
foozy@708: $BAH$_9g$o$;%3%^%s%I$G$"$k(B \hgcmd{addremove} $B$rDs6!$7$F$$$^$9!#(B
foozy@708: 
foozy@708: \interaction{daily.files.addremove}
foozy@708: 
foozy@708: \hgcmd{commit} $B%3%^%s%I$b!"(B
foozy@708: $B%3%_%C%H<B;\$ND>A0$K(B
foozy@708: \hgcmd{addremove} $B$HF1$8J}?K$G9=@.4IM}BP>]$X$NDI2C!?=|30$r9T$&(B
foozy@708: \hgopt{commit}{-A} $B%*%W%7%g%s$rDs6!$7$F$$$^$9!#(B
foozy@708: 
foozy@708: \interaction{daily.files.commit-addremove}
foozy@708: 
foozy@708: \section{Copying files}
foozy@708: 
foozy@708: Mercurial $B$O%U%!%$%k$NJ#@=$r9T$&(B
foozy@708: \hgcmd{copy} $B%3%^%s%I$rDs6!$7$F$$$^$9!#(B
foozy@708: $B$3$N%3%^%s%I$G%U%!%$%k$rJ#@=$7$?>l9g!"(B
foozy@708: Mercurial $B$O$=$N%U%!%$%k$,85%U%!%$%k$NJ#@=$G$"$k$3$H$r5-O?$7$^$9!#(B
foozy@708: $B%A%'%s%8%;%C%H$N%^!<%8$N:]$K$O!"(B
foozy@708: Mercurial $B$O$3$NJ#@=%U%!%$%k$rFCJL07$$$7$^$9!#(B
foozy@708: 
foozy@708: \subsection{The results of copying during a merge}
foozy@708: 
foozy@708: $BJ#@=%U%!%$%k$N%^!<%8$N:]$K$O!"(B
foozy@708: $BJQ99FbMF$,J#@=%U%!%$%k$^$G(B``$BDI=>(B''$B$7$F$-$^$9!#(B
foozy@708: $B$3$N$3$H$,;}$D0UL#$r>e<j$/@bL@$9$k$?$a$K!"(B
foozy@708: $B4JC1$JNc$r:n@.$7$^$7$g$&!#(B
foozy@708: $B$3$l$^$G$NNc$HF1MM$K!"(B
foozy@708: $B#1$D$@$1%U%!%$%k$r;}$D4J0WE*$J%j%]%8%H%j$r:n@.$7$^$9!#(B
foozy@708: 
foozy@708: \interaction{daily.copy.init}
foozy@708: 
foozy@708: $B%^!<%8$r9T$&$?$a$K$O!"(B
foozy@708: $BJL!9$N:n6H$rJ?9T$7$F9T$&I,MW$,$"$j$^$9$N$G!"(B
foozy@708: $B%j%]%8%H%j$rJ#@=$7$^$7$g$&!#(B
foozy@708: 
foozy@708: \interaction{daily.copy.clone}
foozy@708: 
foozy@708: $B:G=i$N%j%]%8%H%j$KLa$j!"(B
foozy@708: \hgcmd{copy} $B%3%^%s%I$G:G=i$K:n@.$7$?%U%!%$%k$rJ#@=$7$^$9!#(B
foozy@708: 
foozy@708: \interaction{daily.copy.copy}
foozy@708: 
foozy@708: $BJ#@=8e$N(B \hgcmd{status} $B%3%^%s%I$N=PNO$G$O!"(B
foozy@708: $BJ#@=$5$l$?%U%!%$%k$OC1$KDI2C$5$l$?IaDL$N%U%!%$%k$HF1$8$h$&$K8+$($^$9!#(B
foozy@708: 
foozy@708: \interaction{daily.copy.status}
foozy@708: 
foozy@708: $B$7$+$7(B
foozy@708: \hgopt{status}{-C} $B%*%W%7%g%sIU$-$G(B
foozy@708: \hgcmd{status} $B$r<B9T$9$k$3$H$G!"(B
foozy@708: $BJL$J9T$,I=<($5$l$^$9!#(B
foozy@708: $B$3$N9T$O!"?7$?$KDI2C$5$l$?%U%!%$%k$NJ#@=(B\emph{$B85(B}$B$G$"$k$3$H$r0UL#$7$^$9!#(B
foozy@708: 
foozy@708: \interaction{daily.copy.status-copy}
foozy@708: 
foozy@708: $BJ#@=$7$?%j%]%8%H%j$KLa$j!"(B
foozy@708: $BJ?9T$7$FJQ99:n6H$r9T$$$^$9!#(B
foozy@708: $BJ#@=85$K$J$C$?%U%!%$%k$KBP$7$F9T$rDI2C$7$^$9!#(B
foozy@708: 
foozy@708: \interaction{daily.copy.other}
foozy@708: 
foozy@708: $B$3$N%j%]%8%H%j$G$OJ#@=85$N(B \filename{file} $B$,JQ99$5$l$^$7$?!#(B
foozy@708: $B:G=i$N%j%]%8%H%j$+$iJQ99FbMF$r(B 
foozy@708: \hgcmd{pull} $B$7$F#2$D$N(B head $B$r%^!<%8$9$k:]$K(B Mercurial $B$O!"(B
foozy@708: \filename{file} $B$KBP$7$F$@$19T$C$?JQ99FbMF$r!"(B
foozy@708: $B$=$NJ#@=$G$"$k(B \filename{new-file} $B$K$^$GEAGE$5$;$^$9!#(B
foozy@708: 
foozy@708: \interaction{daily.copy.merge}
foozy@708: 
foozy@708: \subsection{Why should changes follow copies?}
foozy@708: \label{sec:daily:why-copy}
foozy@708: 
foozy@708: $B%U%!%$%k$NJ#@=$KBP$7$F$kJQ99$,EAGE$5$l$k5sF0$O!"(B
foozy@708: $BFq2r$K;W$($k$+$b$7$l$^$;$s$,!"(B
foozy@708: $BB?$/$N>l9g$OHs>o$K9%$^$7$$?6$kIq$$$H$J$j$^$9!#(B
foozy@708: 
foozy@708: $B$^$:$O!"(B
foozy@708: $B$3$NEAGE$,%^!<%8$N;~(B\emph{$B$@$1(B}$B$K9T$o$l$k!"(B
foozy@708: $B$H$$$&$3$H$KCm0U$7$F$/$@$5$$!#(B
foozy@708: $B%U%!%$%k$r(B \hgcmd{copy} $B$GJ#@=$7!"(B
foozy@708: $B$=$l$K0z$-B3$-J#@=85%U%!%$%k$rJQ99$9$k!"(B
foozy@708: $B$H$$$&DL=j$N:n6H$K$*$$$F$O2?$bFCJL$J$3$H$O9T$o$l$^$;$s!#(B
foozy@708: 
foozy@708: $B$b$&0lE@!"(B
foozy@708: $BJQ99$r<h$j9~$s$@%j%]%8%H%j$,!"(B
foozy@708: $B%U%!%$%k$rJ#@=$7$?$3$H$r(B\emph{$BCN$i$J$+$C$?(B}$B>l9g$K8B$j!"(B
foozy@708: $BJQ99FbMF$,J#@=@h%U%!%$%k$KEAGE$9$k!"(B
foozy@708: $B$H$$$&$3$H$K$bCm0U$7$F$/$@$5$$!#(B
foozy@708: 
foozy@708: Mercurial $B$,$3$N$h$&$K?6Iq$&$N$O0J2<$N$h$&$JM}M3$N$?$a$G$9!#(B
foozy@708: $BNc$($PI.<T$,!"(B
foozy@708: $B%=!<%9%U%!%$%k$KBP$7$F=EMW$J%P%0=$@5$r9T$$!"(B
foozy@708: $BJQ99FbMF$r%3%_%C%H$7$?$H$7$^$9!#(B
foozy@708: $B$=$NJQ99:n6H$,9T$o$l$F$$$k4V$K!"(B
foozy@708: $B%P%0$N82:_2=$d$=$N=$@5$rBT$D;vL5$/!"(B
foozy@708: $BEv3:%U%!%$%k$r(B \hgcmd{copy} $B$GJ#@=$7!"(B
foozy@708: $B$=$NJ#@=@h%U%!%$%k$NJQ99$rFI<T$,;O$a$F$7$^$&$+$b$7$l$^$;$s!#(B
foozy@708: 
foozy@708: $BFI<T$,I.<T$NJQ99$r<h$j9~$s$G%^!<%8$7$?:]$K!"(B
foozy@708: Mercurial $B$,J#@=$X$NJQ99$NH?1G$r(B\emph{$B9T$o$J$$(B}$B>l9g!"(B
foozy@708: $BFI<T$NJ#@=@h%U%!%$%k$O%P%0$r4^$s$G$$$k$?$a!"(B
foozy@708: $B<jF0$G%P%0=$@5$rH?1G$5$;$kI,MW@-$r;W$$=P$5$J$$8B$j!"(B
foozy@708: $B%P%0$OJ#@=@h%U%!%$%k$K(B\emph{$B;D$jB3$1$k(B}$B$G$7$g$&!#(B
foozy@708: 
foozy@708: $B%P%0=$@5$K4X$9$kJQ99FbMF$N!"(B
foozy@708: $BJ#@=85$+$iJ#@=@h$X$N<+F0H?1G$K$h$j!"(B
foozy@708: Mercurial $B$O$3$N<j$NLdBj$r2sHr$7$F$$$^$9!#(B
foozy@708: $BI.<T$NCN$k8B$j(B Mercurial $B$O!"(B
foozy@708: $BJ#@=%U%!%$%k$KBP$9$k$3$N$h$&$JJQ99EAGE$r9T$&(B\emph{$BM#0l$N(B}$B9=@.4IM}%7%9%F%`$G$9!#(B
foozy@708: 
foozy@708: $B%U%!%$%k$NJ#@=$H$=$l$KB3$/%^!<%8$N<B;\$,0lC6JQ99MzNr$K5-O?$5$l$?$J$i!"(B
foozy@708: $BJ#@=85%U%!%$%k$+$iJ#@=@h%U%!%$%k$X$N$=$l0J>e$NJQ99H?1G$ODL>o$OITMW$J$N$G!"(B
foozy@708: Mercurial $B$O%^!<%8;~E@$^$G$OJ#@=$XJQ99$rEAGE$5$;$^$9$,!"(B
foozy@708: $B$=$l0J>e$O9T$$$^$;$s!#(B
foozy@708: 
foozy@708: \subsection{How to make changes \emph{not} follow a copy}
foozy@708: 
foozy@708: $B2>$K!"2?$i$+$NM}M3$K$h$j!"(B
foozy@708: $BJ#@=%U%!%$%k$X$N<+F0E*$JJQ99H?1G$,I,MW$J$$$HH=CG$7$?$J$i!"(B
foozy@708: $B%7%9%F%`$NDL>o$NJ}K!(B
foozy@708: $B!J(BUnix $BE*$J%7%9%F%`$N>l9g$J$i(B \command{cp}$B!K(B
foozy@708: $B$G%U%!%$%k$rJ#@=$7!"(B
foozy@708: \hgcmd{add} $B$K$h$j<jF0$GJ#@=%U%!%$%k$r9=@.4IM}BP>]$KDI2C$7$F$/$@$5$$!#(B
foozy@708: $B$G$9$,!"$=$NA0$K(B\ref{sec:daily:why-copy}$B@a$rFI$_D>$7$F!"(B
foozy@708: Mercurial $B$K$h$k<+F0JQ99H?1G$NE,@Z@-$r==J,$K8!F$$7$F$/$@$5$$!#(B
foozy@708: 
foozy@708: \subsection{Behaviour of the \hgcmd{copy} command}
foozy@708: 
foozy@708: \hgcmd{copy} $B%3%^%s%I$r;HMQ$7$?>l9g!"(B
foozy@708: Mercurial $B$OB(:B$K:n6HNN0h%G%#%l%/%H%j$K8D!9$N%U%!%$%k$NJ#@=$r:n@.$7$^$9!#(B
foozy@708: $B$=$N$?$a!"(B
foozy@708: $B%U%!%$%k$K=$@5$r2C$($?8e$G!"(B
foozy@708: $B$=$NJQ99$r%A%'%s%8%;%C%H$H$7$F%3%_%C%H$9$k$3$H$J$/(B
foozy@708: \hgcmd{copy} $B$r9T$C$?>l9g!"(B
foozy@708: $BJ#@=@h%U%!%$%k$O$=$N;~E@$^$G$NJQ99FbMF$b4^$s$G$$$k$3$H$K$J$j$^$9(B
foozy@708: $B!J$3$N?6$kIq$$$K$D$$$F$3$3$G=R$Y$?$N$O!"(B
foozy@708: $B>/!9D>46$KH?$9$k$h$&$K46$8$i$l$?$+$i$G$9!K!#(B
foozy@708: 
foozy@708: \hgcmd{copy} $B$O(B
foozy@708: Unix $B$N(B \command{cp} $B%3%^%s%I$HF1MM$K?6Iq$$$^$9(B
foozy@708: $B!J(B\hgcmd{cp} $B$H$$$&JLL>J}$,9%$_$G$"$l$P!"$3$A$i$b;HMQ$G$-$^$9!K!#(B
foozy@708: $BKvHx$N0z?t$O(B\emph{$BJ#@=@h(B}$B$r!"(B
foozy@708: $B$=$l0J30$N@h9T$9$k0z?t$O(B\emph{$BJ#@=85(B}$B$r0UL#$7$^$9!#(B
foozy@708: $BJ#@=85$KC10l$N%U%!%$%k$r!"(B
foozy@708: $BJ#@=@h$KB8:_$7$J$$%Q%9$r;XDj$7$?>l9g!"(B
foozy@708: Mercurial $B$OJ#@=@h$K;XDj$7$?L>A0$G?7$?$J%U%!%$%k$r@8@.$7$^$9!#(B
foozy@708: 
foozy@708: \interaction{daily.copy.simple}
foozy@708: 
foozy@708: $BJ#@=@h$,%G%#%l%/%H%j$N>l9g!"(B
foozy@708: Mercurial $B$OJ#@=85%U%!%$%k$rEv3:%G%#%l%/%H%j$KJ#@=$7$^$9!#(B
foozy@708: 
foozy@708: \interaction{daily.copy.dir-dest}
foozy@708: 
foozy@708: $B%G%#%l%/%H%j$NJ#@=$N>l9g$O!"(B
foozy@708: $B:F5"E*3n$D%G%#%l%/%H%j9=@.$rJ];}$7$D$DJ#@=$5$l$^$9!#(B
foozy@708: 
foozy@708: \interaction{daily.copy.dir-src}
foozy@708: 
foozy@708: $BJ#@=85$HJ#@=@h$NN>J}$,%G%#%l%/%H%j$N>l9g(B\footnote{$BLuCm(B:
foozy@708: $B@h$N!V%G%#%l%/%H%j$NJ#@=$N>l9g!W$O!"(B
foozy@708: $B!VJ#@=@h%G%#%l%/%H%j$,B8:_$7$J$$>l9g!W$r;X$7$^$9!#(B}$B!"(B
foozy@708: $BJ#@=85$N%G%#%l%/%H%j9=B$$O!"(B
foozy@708: $BJ#@=@h%G%#%l%/%H%jG[2<$G:F9=C[$5$l$^$9!#(B
foozy@708: 
foozy@708: \interaction{daily.copy.dir-src-dest}
foozy@708: 
foozy@708: $B<jF0$G%U%!%$%k$rJ#@=$7$?8e$G!"(B
foozy@708: $BEv3:%U%!%$%k$,J#@=$G$"$k$3$H$r(B Mercurial $B$KDLCN$9$k$K$O!"(B
foozy@708: \hgcmd{remove} $B$N>l9g$HF1MM$K!"(B
foozy@708: \hgopt{copy}{--after} $BIU$-$G(B \hgcmd{copy} $B%3%^%s%I$r;HMQ$7$^$9!#(B
foozy@708: 
foozy@708: \interaction{daily.copy.after}
foozy@708: 
foozy@708: \section{Renaming files}
foozy@708: 
foozy@708: $B%U%!%$%k$rJ#@=$9$k$h$j$b!"(B
foozy@708: $B$`$7$m2~L>$NJ}$,I,MW$H$5$l$k$N$G$O$J$$$G$7$g$&$+!#(B
foozy@708: $B%U%!%$%k$N2~L>$h$j$b(B
foozy@708: \hgcmd{copy} $B%3%^%s%I$NJ}$r@h$K@bL@$7$?$N$O!"(B
foozy@708: Mercurial $B$,J#@=$H2~L>$rK\<AE*$K$OF1Ey$K07$C$F$$$k$?$a$G$9!#(B
foozy@708: $B$=$N$?$a!"(B
foozy@708: $B%U%!%$%k$NJ#@=$K$*$1$k(B Mercurial $B$N5sF0$rCN$k$3$H$G!"(B
foozy@708: $B%U%!%$%k$N2~L>$G4|BT$5$l$k?6$kIq$$$rCN$k$3$H$,$G$-$^$9!#(B
foozy@708: 
foozy@708: \hgcmd{rename} $B%3%^%s%I$r;HMQ$7$?>l9g!"(B
foozy@708: Mercurial $B$O8D!9$N2~L>85%U%!%$%k$NJ#@=$r:n@.$7!"(B
foozy@708: $B$=$N>e$G2~L>85%U%!%$%k$r:o=|$7!"(B
foozy@708: $B$=$l$i$r9=@.4IM}BP>]$+$i=|30$7$^$9!#(B
foozy@708: 
foozy@708: \interaction{daily.rename.rename}
foozy@708: 
foozy@708: \hgcmd{status} $B%3%^%s%I$N=PNO$+$i!"(B
foozy@708: $B?7$?$KJ#@=$5$l$?%U%!%$%k$,9=@.4IM}BP>]$KDI2C$5$l!"(B
foozy@708: $B2~L>85%U%!%$%k$,=|30$5$l$F$$$k$3$H$,FI$_<h$l$^$9!#(B
foozy@708: 
foozy@708: \interaction{daily.rename.status}
foozy@708: 
foozy@708: \hgcmd{copy} $B<B9T$N>l9g$HF1MM$K!"(B
foozy@708: \hgopt{status}{-C} $B%*%W%7%g%sIU$-$G(B \hgcmd{status} $B%3%^%s%I$r<B9T$9$k$3$H$G!"(B
foozy@708: $B9=@.4IM}BP>]$KDI2C$5$l$?%U%!%$%k$,<B:]$K$O!"(B
foozy@708: $B:#$O:o=|$5$l$F$7$^$C$?%U%!%$%k$NJ#@=%U%!%$%k!"(B
foozy@708: $B$H(B Mercurial $B$K$_$J$5$l$F$$$k$3$H$,$o$+$j$^$9!#(B
foozy@708: 
foozy@708: \interaction{daily.rename.status-copy}
foozy@708: 
foozy@708: \hgcmd{remove} $B$*$h$S(B \hgcmd{copy} $B$HF1MM$K!"(B
foozy@708: \hgopt{rename}{--after} $B%*%W%7%g%s$r;XDj$9$k$3$H$G!"(B
foozy@708: $B<B:]$K2~L>$7$?8e$G(B Mercurial $B$K$=$N;]$rDLCN$9$k$3$H$,$G$-$^$9!#(B
foozy@708: $B$=$l0J30$NKX$I$NE@$G!"(B
foozy@708: \hgcmd{rename} $B%3%^%s%I$N?6$kIq$$JB$S$K;XDj2DG=$J%*%W%7%g%s$O!"(B
foozy@708: \hgcmd{copy} $B%3%^%s%I$HF1$8$G$9!#(B
foozy@708: 
foozy@708: \subsection{Renaming files and merging changes}
foozy@708: 
foozy@708: Mercurial $B$N2~L>$,!VJ#@=$H:o=|!W$H$7$F<BAu$5$l$F$$$k$?$a!"(B
foozy@708: $BJ#@=$N8e$G$N%^!<%8$N>l9g$HF1MM$K!"(B
foozy@708: $B2~L>$N8e$G%^!<%8$r$7$?>l9g$K$OJQ99$,EAGE$5$l$^$9!#(B
foozy@708: 
foozy@708: $B$"$k%f!<%6$,%U%!%$%k$r=$@5$7!"(B
foozy@708: $BJL$N%f!<%6$,$=$N%U%!%$%k$rJL$J%U%!%$%k$K2~L>$7$?>l9g!"(B
foozy@708: $BN><T$,$*8_$$$NJQ99$r%^!<%8$9$k$H!"(B
foozy@708: $B0lJ}$,9T$C$?2~L>85%U%!%$%k$X$N=$@5$O2~L>@h%U%!%$%k$X$HEAGE$7$^$9(B
foozy@708: $B!J$3$N?6$kIq$$$O(B``$BIaDL$N:n6H(B''$B$G4|BT$9$k$G$"$m$&N`$N$b$N$G$9$,!"(B
foozy@708: $BA4$F$N9=@.4IM}%7%9%F%`$,$3$N$h$&$K?6Iq$&$o$1$G$O$"$j$^$;$s!K!#(B
foozy@708: 
foozy@708: $BJ#@=@h$KBP$9$kJQ99$NEAGE$,!"(B
foozy@708: $BMxMQ<T$K$H$C$F$*$=$i$/M-MQ$H;W$o$l$k5!G=$G$9$+$i!"(B
foozy@708: $B%U%!%$%k$N2~L>$K$*$$$F$bJQ99$NEAGE$,=EMW$G$"$m$&$3$H$O!"(B
foozy@708: $BL@$i$+$H$$$($k$G$7$g$&!#(B
foozy@708: $BJQ99EAGE5!G=$,L5$$>l9g!"(B
foozy@708: $B%U%!%$%k$N2~L>$K$h$C$FJQ99$O4JC1$K9T$/@h$r<:$C$F$7$^$&$3$H$G$7$g$&!#(B
foozy@708: 
foozy@708: \subsection{Divergent renames and merging}
foozy@708: 
foozy@708: $BL>A0$N9-$,$j!J(Bdiverging names$B!K$O!"(B
foozy@708: $BFs?M$N3+H/<T$,$H$"$k%U%!%$%k(B---
foozy@708: $B$3$l$r(B \filename{foo} $B$H8F$S$^$9(B---
foozy@708: $B$r3F<+$N%j%]%8%H%j$G07$&$3$H$GH/@8$7$^$9!#(B
foozy@708: 
foozy@708: \interaction{rename.divergent.clone}
foozy@708: 
foozy@708: Anne $B$,%U%!%$%k$r(B \filename{bar} $B$K2~L>$7$^$9!#(B
foozy@708: 
foozy@708: \interaction{rename.divergent.rename.anne}
foozy@708: 
foozy@708: $B$=$N0lJ}$G!"(BBob $B$,%U%!%$%k$r(B \filename{quux} $B$K2~L>$7$^$9!#(B
foozy@708: 
foozy@708: \interaction{rename.divergent.rename.bob}
foozy@708: 
foozy@708: $B8D!9$N3+H/<T$,%U%!%$%k$NL?L>$K4X$9$k0[$J$k0U8~$rI=L@$7$?$o$1$G$9$+$i!"(B
foozy@708: $BI.<T$O$3$N;vBV$r>WFM$HB*$($k$N$,NI$$$H;W$$$^$9!#(B
foozy@708: 
foozy@708: $B$3$N>l9g$N%^!<%8$O$I$N$h$&$K?6Iq$&$Y$-$@$H;W$$$^$9$+!)(B
foozy@708: $B2~L>$K$h$k;^J,$+$l$,@8$8$k%A%'%s%8%;%C%H$N%^!<%8$N>l9g!"(B
foozy@708: Merging $B$O>o$K(B\emph{$BN>J}(B}$B$N2~L>@h%U%!%$%k$r0];}$7$^$9!#(B
foozy@708: 
foozy@708: \interaction{rename.divergent.merge}
foozy@708: 
foozy@708: $BI.<T8D?M$K$H$C$F$3$N?6$kIq$$$OBgJQ0U30$G$"$j!"(B
foozy@708: $B$=$l$,$3$3$G$3$N?6$kIq$$$r@bL@$7$F$$$kM}M3$G$b$"$j$^$9!#(B
foozy@708: $BI.<T$O(B Mercurial $B$K!"(B
foozy@708: \filename{bar} $B$r;D$9$+!"(B
foozy@708: \filename{quux} $B$r;D$9$+!"(B
foozy@708: $B$"$k$$$ON>J}$r;D$9$+!"(B
foozy@708: $B$H$$$&A*Br;h$K$h$k3NG'$r9T$&$3$H$r4|BT$7$F$$$?$N$G$9!#(B
foozy@708: 
foozy@708: $B<B:]$K$O!"(B
foozy@708: $B%U%!%$%k$N2~L>$r9T$C$?>l9g!"(B
foozy@708: $B2~L>85%U%!%$%k$r;HMQ$7$?%S%k%I$r9T$&B>$N%U%!%$%k(B
foozy@708: $B!JNc$($P(B makefile$B!K$N=$@5$,9T$o$l$k$G$"$m$&$3$H$r0UL#$7$^$9!#(B
foozy@708: $B$=$N$?$a!"(B
foozy@708: Anne $B$,%U%!%$%k$r2~L>$7!"(B
foozy@708: $B2~L>8e$N%U%!%$%k$G%S%k%I$,<B;\$5$l$k$h$&$K(B
foozy@708: \filename{Makefile} $B$r=$@5$7$?>l9g!"(B
foozy@708: $B0lJ}$G(B Bob $B$,F1MM$N=$@5$rJL$JL>A0$G9T$C$F$$$^$9$+$i!"(B
foozy@708: $B%^!<%8$N:]$K$O:n6HNN0h%G%#%l%/%H%j$K0[$J$kL>A0$N%U%!%$%k$N%3%T!<$,B8:_$7!"(B
foozy@708: \emph{$B3n$D(B} Anne $B$H(B Bob $B$N(B
foozy@708: \filename{Makefile} $B$X$N=$@52U=j$,>WFM$7$F$$$kH&$G$9!#(B
foozy@708: 
foozy@708: $BB>$NMxMQ<T$b$3$N?6$kIq$$$K0U30@-$r46$8$F$$$k$h$&$G$9!#(B
foozy@708: $B>\:Y$O(B \bug{455} $B$r;2>H$7$F$/$@$5$$!#(B
foozy@708: 
foozy@708: \subsection{Convergent renames and merging}
foozy@708: 
foozy@708: $B0[$J$k(B\emph{$BJ#@=85(B}$B%U%!%$%k$,F1$8%U%!%$%k$r(B\emph{$BJ#@=@h(B}$B$H$7$?:]$K!"(B
foozy@708: $B2~L>$K$h$kJL$J<oN`$N>WFM$,H/@8$7$^$9!#(B
foozy@708: $B$3$N>l9g!"(BMercurial $B$ODL>o$N%^!<%85!9=$r;HMQ$7!"(B
foozy@708: $BE,@Z$J2r7h$X$NM6F3$rMW5a$7$F$-$^$9!#(B
foozy@708: 
foozy@708: \subsection{Other name-related corner cases}
foozy@708: 
foozy@708: Mercurial $B$O!"(B
foozy@708: $B0lJ}$,%U%!%$%k$K;HMQ$7$?L>A0$rB>J}$,%G%#%l%/%H%j$K;HMQ$7$?>l9g$K!"(B
foozy@708: $B%^!<%8$,<:GT$9$k%P%0$,D9$$4V;D$C$F$$$^$9!#(B
foozy@708: $B$3$NLdBj$O(B \bug{29} $B$K>\:Y$,$"$j$^$9!#(B
foozy@708: 
foozy@708: \interaction{issue29.go}
foozy@708: 
foozy@708: \section{Recovering from mistakes}
foozy@708: 
foozy@708: $B4v$D$+$N$"$j$,$A$J4V0c$$$+$iI|5l$9$k$?$a$K!"(B
foozy@708: Mercurial $B$OM-MQ$J%3%^%s%I$r4v$D$+Ds6!$7$F$$$^$9!#(B
foozy@708: 
foozy@708: \hgcmd{revert} $B%3%^%s%I$O!"(B
foozy@708: $B:n6HNN0h%G%#%l%/%H%j$KBP$9$kJQ99$r<h$j>C$7$^$9!#(B
foozy@708: $BNc$($P!"$&$C$+$j%U%!%$%k$r(B \hgcmd{add} $B$7$F$7$^$C$?>l9g$K!"(B
foozy@708: $BDI2C$7$F$7$^$C$?%U%!%$%kL>$r;XDj$7$F(B
foozy@708: \hgcmd{revert} $B$r<B9T$9$k$3$H$G!"(B
foozy@708: $B%U%!%$%k$K$O0l@ZJQ99$r2C$($k;vL5$/(B
foozy@708: Mercurial $B$K$h$k9=@.4IM}BP>]$+$i=|30$9$k$3$H$,$G$-$^$9!#(B
foozy@708: $B%U%!%$%k$X$N4V0c$C$?JQ99$r<h$j>C$9$N$K$b(B
foozy@708: \hgcmd{revert} $B$,MxMQ$G$-$^$9!#(B
foozy@708: 
foozy@708: \hgcmd{revert} $B%3%^%s%I$OL$%3%_%C%H$JJQ99$KBP$7$FM-8z$G$"$k!"(B
foozy@708: $B$H$$$&$3$H$O21$($F$*$-$^$7$g$&!#(B
foozy@708: $BC"$7!"(B
foozy@708: $B0lC6JQ99$r%3%_%C%H$7$?8e$GJQ99FbMF$,4V0c$$$G$"$k$3$H$K5$$,IU$$$?>l9g$G$b!"(B
foozy@708: $BA*Br;h$O8B$i$l$F$O$$$^$9$,BP=h$9$k$3$H$O$G$-$^$9!#(B
foozy@708: 
foozy@708: \hgcmd{revert} $B%3%^%s%I$K4X$9$k>\:Y$H!"(B
foozy@708: $B%3%_%C%H:Q$_$NJQ99$K4X$9$kBP=h$N>\:Y$K4X$7$F$O!"(B
foozy@708: \ref{chap:undo}~$B>O$r;2>H$7$F$/$@$5$$!#(B
foozy@708: 
foozy@708: %%% Local Variables: 
foozy@708: %%% mode: latex
foozy@708: %%% TeX-master: "00book"
foozy@708: %%% End: 




