Mercurial > hgbook
changeset 797:a958bf6d87ed
Propagate c44d5854620b
Fix up chapter 1.
author | Yoshiki Yazawa <yaz@honeyplanet.jp> |
---|---|
date | Thu, 18 Jun 2009 16:43:10 +0900 |
parents | 5cb09396dc35 |
children | 09c1609f9bb2 |
files | ja/tour-basic.tex |
diffstat | 1 files changed, 226 insertions(+), 132 deletions(-) [+] |
line wrap: on
line diff
--- a/ja/tour-basic.tex Thu Jun 18 16:41:21 2009 +0900 +++ b/ja/tour-basic.tex Thu Jun 18 16:43:10 2009 +0900 @@ -14,8 +14,27 @@ $B%1!<%8$,Ds6!$5$l$F$$$k!%$3$l$rMQ$$$l$PFI<T$N7W;;5!$N>e$GD>$A$K(BMercurial $B$r;H$&$3$H$,$G$-$k!%(B +\subsection{Windows} + +%The best version of Mercurial for Windows is TortoiseHg, which can be +%found at \url{http://bitbucket.org/tortoisehg/stable/wiki/Home}. This +%package has no external dependencies; it ``just works''. It +%provides both command line and graphical user interfaces. + +Windows$B8~$1(BMercurial$B$N:G$bM%$l$?%P!<%8%g%s$G$"$k(BTortoiseHg$B$O!$(B +\url{http://bitbucket.org/tortoisehg/stable/wiki/Home}$B$GF~<j$G$-$k!%(B +$B$3$N%Q%C%1!<%8$O30It$N%Q%C%1!<%8$X0MB8$;$:!$$9$0$KF0:n$9$k!%%3%^%s%I%i%$(B +$B%s%$%s%?%U%'!<%9$H%0%i%U%#%+%k%f!<%6%$%s%?%U%'!<%9$NN>J}$,MxMQ$G$-$k!%(B + +\subsection{Mac OS X} + +%Lee Cantey publishes an installer of Mercurial for Mac OS X at +% \url{http://mercurial.berkwood.com}. + +Lee Cantey$B$O(BMac OS~X$B8~$1$N(BMercurial$B%$%s%9%H!<%i$r(B +\url{http://mercurial.berkwood.com}$B$GG[I[$7$F$$$k!%(B + \subsection{Linux} - %Because each Linux distribution has its own packaging tools, policies, %and rate of development, it's difficult to give a comprehensive set of %instructions on how to install Mercurial binaries. The version of @@ -39,12 +58,12 @@ $B$h$&$J%0%i%U%#%+%k$J%Q%C%1!<%8%^%M!<%8%c$rMQ0U$7$F$$$k!%(B \begin{itemize} -\item[Debian] +\item[Debian and Ubuntu] \begin{codesample4} apt-get install mercurial \end{codesample4} -\item[Fedora Core] +\item[Fedora and OpenSUSE] \begin{codesample4} yum install mercurial \end{codesample4} @@ -54,18 +73,6 @@ emerge mercurial \end{codesample4} -\item[OpenSUSE] - \begin{codesample4} - yum install mercurial - \end{codesample4} - -%\item[Ubuntu] Ubuntu's Mercurial package is based on Debian's. To -% install it, run the following command. -\item[Ubuntu] Ubuntu$B$N(BMercurial package$B$O(BDebian$B$N$b$N$r85$K$7$F$$$k!%$3(B - $B$l$r%$%s%9%H!<%k$9$k$?$a$K$O<!$N%3%^%s%I$r<B9T$9$k!%(B - \begin{codesample4} - apt-get install mercurial - \end{codesample4} % The Ubuntu package for Mercurial tends to lag behind the Debian % version by a considerable time margin (at the time of writing, seven % months), which in some cases will mean that on Ubuntu, you may run @@ -77,47 +84,10 @@ \subsection{Solaris} -%SunFreeWare, at \url{http://www.sunfreeware.com}, is a good source for a -%large number of pre-built Solaris packages for 32 and 64 bit Intel and -%Sparc architectures, including current versions of Mercurial. - -\url{http://www.sunfreeware.com}$B$K$"$k(BSunFreeWare$B$O!$8=9T$N(BMercurial$B$r4^(B -$B$`!$(B32$B%S%C%H5Z$S(B64$B%S%C%H$N(BIntel$B$H(BSparc$B%"!<%-%F%/%A%cMQ$K%S%k%I$5$l$?(B -Solaris$B%Q%C%1!<%8$NBg5,LO$J%3%l%/%7%g%s$G$"$k!%(B - -\subsection{Mac OS X} - -%Lee Cantey publishes an installer of Mercurial for Mac OS~X at -%\url{http://mercurial.berkwood.com}. This package works on both -%Intel-~and Power-based Macs. Before you can use it, you must install -%a compatible version of Universal MacPython~\cite{web:macpython}. This -%is easy to do; simply follow the instructions on Lee's site. - -Lee Cantey$B$O(BMac OS~X$B8~$1$N(BMercurial$B%$%s%9%H!<%i$r(B -\url{http://mercurial.berkwood.com}$B$GG[I[$7$F$$$k!%$3$N%Q%C%1!<%8$O(B -Intel-~$B$H(BPower-$B%Y!<%9$N(BMac$BN>J}$GF0:n$9$k!%$3$l$r;H$&A0$K!$8_49@-$N$"$k%P!<(B -$B%8%g%s$N(BUniversal MacPython~\cite{web:macpython}$B$r%$%s%9%H!<%k$9$kI,MW$,(B -$B$"$k!%%$%s%9%H!<%k$O4JC1$G!$(BLee$B$N%5%$%H$K$"$k<j=g$K=>$&$@$1$G$"$k!%(B - -\subsection{Windows} - -%Lee Cantey also publishes an installer of Mercurial for Windows at -%\url{http://mercurial.berkwood.com}. This package has no external -%dependencies; it ``just works''. - -Lee Cantey$B$O(BWindows$B8~$1$N(BMercurial$B%$%s%9%H!<%i$b(B -\url{http://mercurial.berkwood.com}$B$GG[I[$7$F$$$k!%$3$N%Q%C%1!<%8$O30It(B -$B$N%=%U%H%&%'%"$K0MB8$;$:!$C1FH$G<B9T2DG=$G$"$k!%(B - -\begin{note} -% The Windows version of Mercurial does not automatically convert line -% endings between Windows and Unix styles. If you want to share work -% with Unix users, you must do a little additional configuration -% work. XXX Flesh this out. - Windows$B%P!<%8%g%s$N(BMercurial$B$O!$(BWindows$B$H(BUnix$B$N4V$G9TKv$N2~9T%3!<%I$r<+(B - $BF0$GJQ49$7$J$$!%(BUnix$B%f!<%6$H:n6H$r9T$$$?$$>l9g$O!$DI2C$N@_Dj$r9T$&I,MW(B - $B$,$"$k!%(BXXX Flesh this out. -\end{note} +%SunFreeWare, at \url{http://www.sunfreeware.com}, provides prebuilt +%packages of Mercurial. +\url{http://www.sunfreeware.com}$B$+$i%S%k%I:Q$_$N(BMercurial$B%Q%C%1!<%8$,F~(B +$B<j$G$-$k!%(B %\section{Getting started} \section{Mercurial$B$r;H$&(B} @@ -184,36 +154,49 @@ %\emph{Copying} a repository is just a little bit special. While you %could use a normal file copying command to make a copy of a %repository, it's best to use a built-in command that Mercurial -%provides. This command is called \hgcmd{clone}, because it creates an +%provides. This command is called \hgcmd{clone}, because it makes an %identical copy of an existing repository. %\interaction{tour.clone} -%If our clone succeeded, we should now have a local directory called -%\dirname{hello}. This directory will contain some files. -%\interaction{tour.ls} -%These files have the same contents and history in our repository as -%they do in the repository we cloned. $B%j%]%8%H%j$N(B\emph{$B%3%T!<(B}$B$O$d$dFC<l$G$"$k!%DL>o$N%U%!%$%k%3%T!<%3%^%s%I$r(B $B;H$C$F%j%]%8%H%j$N%3%T!<$r:n@.$9$k$3$H$b$G$-$k$,!$(BMercurial$B$NAH$_9~$_%3%^(B $B%s%I$r;H$C$F%3%T!<$9$k$N$,0lHVNI$$!%$3$N%3%^%s%I$O(B\hgcmd{clone}$B$H8F$P$l!$(B $B4{B8$N%j%]%8%H%j$N40A4$J%3%T!<$r:n@.$9$k!%(B \interaction{tour.clone} + +%One advantage of using \hgcmd{clone} is that, as we can see above, it +%lets us clone repositories over the network. Another is that it +%remembers where we cloned from, which we'll find useful soon when we +%want to fetch new changes from another repository. + +\hgcmd{clone}$B%3%^%s%I$r;H$&MxE@$N0l$D$O!$>e$G8+$?$h$&$K%j%]%8%H%j$r%M%C%H(B +$B%o!<%/1[$7$K%/%m!<%s$G$-$kE@$G$"$k!%$^$?$b$&0lE@!$$3$N%3%^%s%I$O$I$3$+$i(B +$B%/%m!<%s$7$?$N$+$r5-O?$9$k$?$a!$?7$?$JJQ99$rJL$N%j%]%8%H%j$+$i<hF@$7$h$&(B +$B$H$9$k:]$KJXMx$G$"$k!%(B + +%If our clone succeeded, we should now have a local directory called +%\dirname{hello}. This directory will contain some files. +%\interaction{tour.ls} +%These files have the same contents and history in our repository as +%they do in the repository we cloned. + $B%/%m!<%s$,@.8y$9$k$H(B\dirname{hello}$B$H$$$&%m!<%+%k%G%#%l%/%H%j$,$G$-$k!%(B $B$3$N%G%#%l%/%H%j$K$O%*%j%8%J%k$HF10l$N%U%!%$%k$,4^$^$l$k!%(B \interaction{tour.ls} $B$3$l$i$N%U%!%$%k$O%/%m!<%s$7$?%j%]%8%H%jFb$HA4$/F1$8FbMF$HMzNr$r;}$C$F$$(B $B$k!%(B -%Every Mercurial repository is complete, self-contained, and -%independent. It contains its own private copy of a project's files -%and history. A cloned repository remembers the location of the +%Every Mercurial repository is complete, self-contained, and independent. +%It contains its own private copy of a project's files and history. As we +%just mentioned, A cloned repository remembers the location of the %repository it was cloned from, but it does not communicate with that %repository, or any other, unless you tell it to. $BA4$F$N(BMercurial$B%j%]%8%H%j$O40A4$+$D<+8J=<B-E*$GFHN)$G$"$k!%%j%]%8%H%j$O%W(B -$B%m%8%'%/%H$KB0$9%U%!%$%k$N%W%i%$%Y!<%H%3%T!<$HMzNr$r;}$D!%%/%m!<%s$5$l$?(B -$B%j%]%8%H%j$O%/%m!<%s85$N%j%]%8%H%j$N>l=j$r5-21$7$F$$$k$,!$%f!<%6$,;X<($7(B -$B$J$$8B$j!$$=$N%j%]%8%H%j$dB>$N%j%]%8%H%j$HDL?.$r9T$&$3$H$O$J$$!%(B +$B%m%8%'%/%H$KB0$9%U%!%$%k$N%W%i%$%Y!<%H%3%T!<$HMzNr$r;}$D!%:#=R$Y$?$h$&(B +$B$K!$%/%m!<%s$5$l$?%j%]%8%H%j$O%/%m!<%s85$N%j%]%8%H%j$N>l=j$r5-21$7$F$$$k(B +$B$,!$%f!<%6$,;X<($7$J$$8B$j!$$=$N%j%]%8%H%j$dB>$N%j%]%8%H%j$HDL?.$r9T$&$3(B +$B$H$O$J$$!%(B %What this means for now is that we're free to experiment with our %repository, safe in the knowledge that it's a private ``sandbox'' that @@ -264,15 +247,15 @@ %One of the first things we might want to do with a new, unfamiliar %repository is understand its history. The \hgcmd{log} command gives -%us a view of history. +%us a view of the history of changes in the repository. %\interaction{tour.log} %By default, this command prints a brief paragraph of output for each %change to the project that was recorded. In Mercurial terminology, we %call each of these recorded events a \emph{changeset}, because it can %contain a record of changes to several files. -$BL$CN$N%j%]%8%H%j$KBP$7$F$^$:$7$h$&$H;W$&$3$H$O!$$=$NMzNr$rCN$k$3$H$@$m$&!%(B -$BMzNr$O(B\hgcmd{log}$B%3%^%s%I$G8+$k$3$H$,$G$-$k!%(B +$BL$CN$N%j%]%8%H%j$KBP$7$F$^$:$7$h$&$H;W$&$3$H$O!$$=$N%j%]%8%H%j$G$NJQ99$N(B +$BMzNr$rCN$k$3$H$@$m$&!%MzNr$O(B\hgcmd{log}$B%3%^%s%I$G8+$k$3$H$,$G$-$k!%(B \interaction{tour.log} $B%G%U%)%k%H$G$O!$$3$N%3%^%s%I$O%W%m%8%'%/%H$KBP$7$F9T$o$l$?JQ99$N3F!9$K$D(B $B$$$F4J7i$J%Q%i%0%i%U$rI=<($9$k!%(B Mercurial$B$NMQ8l$G$O!$MzNrCf$NJQ99$N%$%Y(B @@ -283,18 +266,27 @@ \hgcmd{log}$B$+$i=PNO$5$l$k5-O?$N3F%U%#!<%k%I$O<!$N$h$&$K$J$C$F$$$k!%(B \begin{itemize} %\item[\texttt{changeset}] This field has the format of a number, -% followed by a colon, followed by a hexadecimal string. These are -% \emph{identifiers} for the changeset. There are two identifiers -% because the number is shorter and easier to type than the hex -% string. -\item[\texttt{changeset}] $B?t;z!$$=$l$KB3$/%3%m%s$*$h$S(B16$B?JJ8;zNs!%$3$l$O(B - $B%A%'%s%8%;%C%H$N(B\emph{$B<1JL;R(B}$B$G$"$k!%?t;z$OC;$/F~NO$bMF0W$G(B - $B$"$k$?$aMQ0U$5$l$F$$$k!%(B +% followed by a colon, followed by a hexadecimal (or +% \emph{hex}) string. These are \emph{identifiers} for the +% changeset. The hex string is a unique identifier: the same +% hex string will always refer to the same changeset. The +% number is shorter and easier to type than the hex string, +% but it isn't unique: the same number in two different +% clones of a repository may identify different changesets. +% Why provide the number at all, then? For local +% convenience. +\item[\texttt{changeset}] $BHV9f!$$=$l$KB3$/%3%m%s$*$h$S(B16$B?JJ8;zNs!%$3$l$O(B + $B%A%'%s%8%;%C%H$N(B\emph{$B<1JL;R(B}$B$G$"$k!%(B16$B?JJ8;zNs$O8GM-$N<1JL(B + $B;R$G!$F10l$N<1JL;R$O>o$KF1$8%A%'%s%8%;%C%H$r;X$9!%HV9f$OC;$/(B + $BF~NO$b(B16$B?JJ8;zNs$h$jMF0W$G$"$k$,!$%A%'%s%8%;%C%H$K8GM-$G$O$J(B + $B$$!%F1$8HV9f$G$b%j%]%8%H%j$NJL$N%/%m!<%s$G$O!$0c$&%A%'%s%8%;%C(B + $B%H$r;X$92DG=@-$,$"$k!%HV9f$OC1$K%m!<%+%k$JMxJX$N$?$a$KDs6!$5(B + $B$l$F$$$k!%(B %\item[\texttt{user}] The identity of the person who created the % changeset. This is a free-form field, but it most often contains a % person's name and email address. \item[\texttt{user}] $B%A%'%s%8%;%C%H:n@.<T!%$3$N%U%#!<%k%I$N=q<0$O<+M3$@(B - $B$,!$KX$s$I$N>l9g;aL>$H(Bemail$B%"%I%l%9$G$"$k!%(B + $B$,!$$[$H$s$I$N>l9g;aL>$H(Bemail$B%"%I%l%9$G$"$k!%(B %\item[\texttt{date}] The date and time on which the changeset was % created, and the timezone in which it was created. (The date and % time are local to that timezone; they display what time and date it @@ -306,6 +298,15 @@ % creator of the changeset entered to describe the changeset. \item[\texttt{summary}] $B%F%-%9%H%a%C%;!<%8$N:G=i$N9T$O%A%'%s%8%;%C%H$N@b(B $BL@$KF~NO$5$l$?%A%'%s%8%;%C%H$N:n@.<T$G$"$k!%(B +% \item Some changesets, such as the first in the list above, have a +% \texttt{tag} field. A tag is another way to identify a +% changeset, by giving it an easy-to-remember name. (The tag +% named \texttt{tip} is special: it always refers to the +% newest change in a repository.) + \item $B>e$N%j%9%H$N:G=i$N%A%'%s%8%;%C%H$N$h$&$K(B\texttt{tag}$B%U%#!<%k%I$r;}(B + $B$D%A%'%s%8%;%C%H$b$"$k!%%?%0$O%A%'%s%8%;%C%H$r<1JL$9$k$?$a$N$b$&(B + $B0l$D$NJ}K!$G!$3P$($d$9$$L>A0$r<+M3$KIU$1$k$3$H$,$G$-$k!%!J%?%0(B + \texttt{tip}$B$OFCJL$G!$>o$K%j%]%8%H%j$N:G?7$N%A%'%s%8%;%C%H$r;X$9!%!K(B \end{itemize} %The default output printed by \hgcmd{log} is purely a summary; it is %missing a lot of detail. @@ -360,15 +361,16 @@ $B%s%8%;%C%H$rHV9f$H(B16$B?JJ8;zNs$GI=$7$F$$$?$3$H$r;W$$=P$7$FM_$7$$!%(B %\begin{itemize} -%\item The revision number is \emph{only valid in that repository}, -%\item while the hex string is the \emph{permanent, unchanging +%\item The revision number is a handy notation that \emph{only valid in +% that repository}. +%\item The hexadecimal string is the \emph{permanent, unchanging % identifier} that will always identify that exact changeset in % \emph{every} copy of the repository. %\end{itemize} \begin{itemize} -\item $B%j%S%8%g%sHV9f$O(B\emph{$B$=$N%j%]%8%H%j$K8B$C$FM-8z$G$"$j(B}$B!$(B -\item $B$=$l$KBP$7$F(B16$B?JJ8;zNs$O(B\emph{$B1JB3E*$+$DITJQ$N<1JL;R(B}$B$G!$%j%]%8%H(B - $B%j$N%3%T!<(B\emph{$BA4$F(B}$B$G>o$KFCDj$N%A%'%s%8%;%C%H$r<($9!%(B +\item $B%j%S%8%g%sHV9f$O(B\emph{$B$=$N%j%]%8%H%j$K8B$C$FM-8z(B}$B$J4JJX5-K!$G$"$k!%(B +\item 16$B?JJ8;zNs$O(B\emph{$B1JB3E*$+$DITJQ$N<1JL;R(B}$B$G!$%j%]%8%H%j$N%3%T!<(B + \emph{$BA4$F(B}$B$G>o$KFCDj$N%A%'%s%8%;%C%H$r<($9!%(B \end{itemize} %This distinction is important. If you send someone an email talking @@ -378,14 +380,14 @@ %arrived in a repository, and there is no guarantee that the same %changes will happen in the same order in different repositories. %Three changes $a,b,c$ can easily appear in one repository as $0,1,2$, -%while in another as $1,0,2$. +%while in another as $0,2,1$. $B$3$N6hJL$O=EMW$G$"$k!%C/$+$K(B``revision~33''$B$H8@$C$?;~!$$=$N%j%S%8%g%s(B33$B$,(B $B<+J,$N%j%]%8%H%j$N%j%]%8%H%j$N$b$N$H$O(B\emph{$B0c$&$b$N$G$"$k(B}$B2DG=@-$O9b$$!%(B $B$=$NM}M3$O!$%j%S%8%g%sHV9f$O%j%]%8%H%j$KJQ99$,8=$l$?=g=x$K$h$C$F7h$^(B $B$j!$(BMercurial$B$G$OJL$N%j%]%8%H%j$GF1$8JQ99$,F1$8=g=x$G5/$3$kJ]>Z$O$J$$$?$a(B $B$G$"$k!%(B 3$B$D$NJQ99(B$a,b,c$$B$O!$$"$k%j%]%8%H%j$G(B$0,1,2$$B$N=g$G5/$3$j!$JL$N%j(B -$B%]%8%H%j$G$O(B$1,0,2$$B$N=g=x$G5/$3$jF@$k!%(B +$B%]%8%H%j$G$O(B$0,2,1$$B$N=g=x$G5/$3$jF@$k!%(B %Mercurial uses revision numbers purely as a convenient shorthand. If %you need to discuss a changeset with someone, or make a record of a @@ -401,13 +403,13 @@ %To narrow the output of \hgcmd{log} down to a single revision, use the %\hgopt{log}{-r} (or \hgopt{log}{--rev}) option. You can use either a -%revision number or a long-form changeset identifier, and you can +%revision number or a hexadecimal changeset identifier, and you can %provide as many revisions as you want. \interaction{tour.log-r} \hgcmd{log}$B$N=PNO$r$"$k(B1$B$D$N%j%S%8%g%s$K@)8B$9$k$?$a$K$O!$(B \hgopt{log}{-r}$B!J$^$?$O(B \hgopt{log}{--rev}$B!K%*%W%7%g%s$rMQ$$$k!%%j%S%8%g(B -$B%sHV9f$bD97A<0$N%A%'%s%8%;%C%H<1JL;R$bMxMQ2DG=$G$"$j!$;XDj$G$-$k%j%S%8%g(B -$B%s$N?t$K@)8B$O$J$$!%(B +$B%sHV9f$b(B16$B?JJ8;zNs$N%A%'%s%8%;%C%H<1JL;R$bMxMQ2DG=$G$"$j!$;XDj$G$-$k%j%S(B +$B%8%g%s$N?t$K@)8B$O$J$$!%(B \interaction{tour.log-r} %If you want to see the history of several revisions without having to @@ -456,6 +458,11 @@ $B$P35N,$r(B\ref{sec:mq:patch}$B@a$G8+$k$3$H$,$G$-$k!%!K(B \interaction{tour.log-vp} +%The \hgopt{log}{-p} option is tremendously useful, so it's well worth +%remembering. + +\hgopt{log}{-p}$B%*%W%7%g%s$O6C0[E*$KJXMx$J$N$G3P$($F$*$/$HNI$$!%(B + %\section{All about command options} \section{$B%3%^%s%I%*%W%7%g%s$N$9$Y$F(B} @@ -498,6 +505,12 @@ \item $B%*%W%7%g%s$NL?L>$H;HMQK!$O%3%^%s%I4V$G0l4S$7$F$$$k!%Nc$r5s$2$k$H!$(B $B%A%'%s%8%;%C%H(BID$B$^$?$O%j%S%8%g%sHV9f$r;XDj$5$;$k%3%^%s%I$NA4$F$G(B \hgopt{log}{-r}$B$H(B\hgopt{log}{--rev}$B$NN>J}$r<u$1IU$1$k!%(B +% \item If you are using short options, you can save typing by running +% them together. For example, the command \hgopt{log}{-v -p -r 2} +% can be written as \hgopt{log}{-vpr2} + \item $BC;7A<0$N%*%W%7%g%s$r;H$C$F$$$k;~$O$"!$J#?t$N%*%W%7%g%s$rAH$_9g$o$;(B + $B$FF~NO$N<j4V$r>J$/$3$H$,$G$-$k!%Nc$($P(B\hgopt{log}{-v -p -r 2}$B$O(B + \hgopt{log}{-vpr2}$B$H=q$/$3$H$,$G$-$k!%(B \end{itemize} %In the examples throughout this book, I use short options instead of %long. This just reflects my own preference, so don't read anything @@ -512,6 +525,26 @@ $B%*%W%7%g%s$rIU$1$k$H$h$j>\:Y$J=PNO$r9T$$!$(B\hggopt{-q}$B!J$^$?$O(B \hggopt{--quiet}$B!K%*%W%7%g%s$rIU$1$k$H$h$j4J7i$J=PNO$H$J$k!%(B +%\begin{note} +%Option naming consistency +% +%Almost always, Mercurial commands use consistent option names to refer +%to the same concepts. For instance, if a command deals with changesets, +%you'll always identify them with \hgopt{log}{--rev} or \hgopt{log}{-r} + +%This consistent use of option names makes it easier to remember what +%options a particular command takes. +%\end{note} + +\begin{note} +$B%*%W%7%g%sL>$N0l4S@-(B + +Mercurial$B%3%^%s%I$G$O!$F1$8BP>]$r07$&:]!$$[$H$s$I>o$KF1$8%*%W%7%g%sL>$r;H(B +$B$&$h$&$K$J$C$F$$$k!%Nc$r5s$2$k$H!$%A%'%s%8%;%C%H$r07$&%3%^%s%I$N>l9g$O>o(B +$B$K(B\hgopt{log}{--rev}$B$d(B\hgopt{log}{-r}$B$G%A%'%s%8%;%C%H$N;XDj$,$G$-$k!%$3$N(B +$B0l4S@-$K$h$j!$AH$^$s$I$N%*%W%7%g%s$,3P$($d$9$/$J$C$F$$$k!%(B +\end{note} + %\section{Making and reviewing changes} \section{$BJQ99$N;EJ}!$JQ99$N%l%S%e!<(B} @@ -527,6 +560,13 @@ %of it locally, we can just clone that instead. This is much faster %than cloning over the network, and cloning a local repository uses %less disk space in most cases, too. +%\begin{footnote} +%The saving of space arises when source and destination repositories are +%on the same filesystem, in which case Mercurial will use hardlinks to do +%copy-on-write sharing of its internal metadata. If that explanation +%meant nothing to you, don't worry: everything happens transparently and +%automatically, and you don't need to understand it. +%\end{footnote} %\interaction{tour.reclone} %As an aside, it's often good practice to keep a ``pristine'' copy of a %remote repository around, which you can then make temporary clones of @@ -541,6 +581,12 @@ $B$h$/!$%j%b!<%H$N%j%]%8%H%j$r%3%T!<$9$kI,MW$O$J$$!%%m!<%+%k$J%/%m!<%s$O%M%C(B $B%H%o!<%/1[$7$K9T$&%/%m!<%s$h$j$b$:$C$HB.$/!$B?$/$N>l9g;HMQ$9$k%G%#%9%/MF(B $BNL$b>/$J$$!%(B +\begin{footnote} +$BF10l%U%!%$%k%7%9%F%`>e$G%j%]%8%H%j$N%/%m!<%s$r9T$&>l9g!$(B Mercurial$B$O%O!<(B +$B%I%j%s%/$r;H$$!$FbIt%a%?%G!<%?$r%3%T!<%*%s%i%$%H$G6&M-$7!$%G%#%9%/;HMQNL(B +$B$N@aLs$r9T$&!%$3$N@bL@$,$h$/$o$+$i$J$/$F$b?4G[$9$kI,MW$O$J$$!%$3$NF0:n$O(B +$B$9$Y$FF)2aE*$+$D<+F0E*$K9T$o$l$k$?$a!$5$$K$9$kI,MW$O$J$$!%(B +\end{footnote} \interaction{tour.reclone} $B$^$?!$2?$+:n6H$r$7$?$$;~$K%5%s%I%\%C%/%9$H$9$k$?$a$K0l;~E*$J%/%m!<%s$r:n(B $B@.$7!$%j%b!<%H%j%]%8%H%j$N%3%T!<$r(B``$B@67i(B''$B$KJ]$D$3$H$O$7$P$7$PLr$KN)$D!%(B @@ -551,20 +597,15 @@ %In our \dirname{my-hello} repository, we have a file %\filename{hello.c} that contains the classic ``hello, world'' program. -%Let's use the ancient and venerable \command{sed} command to edit this -%file so that it prints a second line of output. (I'm only using -%\command{sed} to do this because it's easy to write a scripted example -%this way. Since you're not under the same constraint, you probably -%won't want to use \command{sed}; simply use your preferred text editor to -%do the same thing.) -%\interaction{tour.sed} +%\interaction{tour.cat1} +\dirname{my-hello}$B%j%]%8%H%jFb$K$O%/%i%7%C%/$J(B``hello, world''$B%W%m%0%i%`(B +$B$G$"$k(B\filename{hello.c}$B$,$"$k!%(B +\interaction{tour.cat1} -\dirname{my-hello}$B%j%]%8%H%jFb$K$O%/%i%7%C%/$J(B``hello, world''$B%W%m%0%i%`(B -$B$G$"$k(B\filename{hello.c}$B$,$"$k!%8E$/$5$/?987$J(B\command{sed}$B$rMQ$$$F(B2$B9TL\(B -$B$N=PNO$r9T$&$h$&$KJQ99$9$k!%!J(B\command{sed}$B$r;H$&$N$O%9%/%j%W%H$K$h$kNc$r(B -$B:n$k$N$,4JC1$@$+$i$K2a$.$J$$!%FI<T$^$G(B\command{sed}$B$r;H$&I,MW$O$J$/!$9%$-(B -$B$J%F%-%9%H%(%G%#%?$GJT=8$7$F$h$$!%!K(B -\interaction{tour.sed} +%Let's edit this file so that it prints a second line of output. +%\interaction{tour.cat2} +$B$3$N%U%!%$%k$r(B2$B9TL\$,=PNO$5$l$k$h$&$KJT=8$9$k!%(B +\interaction{tour.cat2} %Mercurial's \hgcmd{status} command will tell us what Mercurial knows %about the files in the repository. @@ -573,7 +614,6 @@ %starting with ``\texttt{M}'' for \filename{hello.c}. Unless you tell %it to, \hgcmd{status} will not print any output for files that have %not been modified. - $B%j%]%8%H%jFb$N%U%!%$%k$KBP$7$F(BMercurial$B$,GD0.$7$F$$$kFbMF$r(B \hgcmd{status}$B%3%^%s%I$G8+$k$3$H$,$G$-$k!%(B \interaction{tour.status} @@ -593,7 +633,7 @@ $B$iJQ99$9$k%U%!%$%k$rEPO?$9$kI,MW$O$J$$$7!$JQ998e$K9T$&I,MW$b$J$$!%JQ99$5(B $B$l$?%U%!%$%k$NH/8+$O<+F0E*$K9T$o$l$k!%(B -%It's a little bit helpful to know that we've modified +%It's a somewhat helpful to know that we've modified %\filename{hello.c}, but we might prefer to know exactly \emph{what} %changes we've made to it. To do this, we use the \hgcmd{diff} %command. @@ -603,6 +643,19 @@ $B$`$7$m(B\emph{$B2?$r(B}$BJQ99$7$?$N$+$G$"$k!%(B\hgcmd{diff}$B%3%^%s%I$r;H$($P$3$l$rCN(B $B$k$3$H$,$G$-$k!%(B \interaction{tour.diff} +%\begin{note} +%Understanding patches +% +%Remember to take a look at section~\ref{sec:mq:patch} if you don't know +%how to read output above. +%\end{note} + +\begin{note} +$B%Q%C%A$K$D$$$F(B + +$B>e$N=PNO$NFI$_J}$,J,$+$i$J$$>l9g$O!$(B\ref{sec:mq:patch}$B@a$r;2>H$5$l$?$$!%(B +\end{note} + %\section{Recording changes in a new changeset} \section{$B?7$?$J%A%'%s%8%;%C%H$XJQ99$r5-O?$9$k(B} @@ -690,6 +743,9 @@ %\sfilename{.hgrc} in your home directory. Mercurial will use this %file to look up your personalised configuration settings. The initial %contents of your \sfilename{.hgrc} should look like this. +%\begin{footnote} +%Figure out what the appropriate directory is on Windows. +%\end{footnote} %\begin{codesample2} % # This is a Mercurial configuration file. % [ui] @@ -706,6 +762,9 @@ \sfilename{.hgrc}$B$H$$$&%U%!%$%k$r:n@.$9$k!%(B Mercurial$B$O$3$N%U%!%$%k$+$i8D(B $B?M@_Dj$r<hF@$7!$;HMQ$9$k!%(B\sfilename{.hgrc}$B%U%!%$%k$N:G=i$NFbMF$O0J2<$N$h(B $B$&$J=q<0$K$9$k!%(B +\begin{footnote} +Windows$B$G$NE,@Z$J%G%#%l%/%H%j$r<($9$3$H!%(B +\end{footnote} \begin{codesample2} # This is a Mercurial configuration file. [ui] @@ -723,14 +782,14 @@ %You can use any text you like as the value of the \texttt{username} %config item, since this information is for reading by other people, -%but for interpreting by Mercurial. The convention that most people -%follow is to use their name and email address, as in the example +%but will not be interpreted by Mercurial. The convention that most +%people follow is to use their name and email address, as in the example %above. -\texttt{username}$B$N@_Dj$K;HMQ$9$kJ8;zNs$O!$$3$l$,(BMercurial$B$K$h$C$F=hM}$5(B -$B$l$k$H$$$&E@$r=|$1$P!$C1$KB>$N%f!<%6$,FI$`$H$$$&$@$1$N>pJs$G$"$k$3$H$+(B -$B$i!$$I$N$h$&$JJ8;zNs$G$b9=$o$J$$!%B?$/$N%f!<%6$,=>$&=,47$O!$>e$NNc$N$h$&(B -$B$KL>A0$H(Bemail$B%"%I%l%9$r;H$&$b$N$G$"$k!%(B +\texttt{username}$B$N@_Dj$K;HMQ$9$kJ8;zNs$O!$B>$N%f!<%6$,FI$`>pJs$G$"$k$K2a(B +$B$.$:!$(BMercurial$B$K$h$C$F=hM}$5$l$k$b$N$G$O$J$$$?$a!$$I$N$h$&$JJ8;zNs$G$b9=(B +$B$o$J$$!%B?$/$N%f!<%6$,=>$&=,47$O!$>e$NNc$N$h$&$KL>A0$H(Bemail$B%"%I%l%9$r;H$&(B +$B$b$N$G$"$k!%(B \begin{note} % Mercurial's built-in web server obfuscates email addresses, to make @@ -760,11 +819,16 @@ \interaction{tour.commit} %The editor that the \hgcmd{commit} command drops us into will contain -%an empty line, followed by a number of lines starting with +%an empty line or two, followed by a number of lines starting with %``\texttt{HG:}''. -%\begin{codesample2} -% \emph{empty line} -% HG: changed hello.c +%%\begin{codesample2} +%This is where I type my commit comment. +% +%HG: Enter commit message. Lines beginning with 'HG:' are removed. +%HG: -- +%HG: user: Bryan O'Sullivan <bos@serpentine.com> +%HG: branch 'default' +%HG: changed hello.c</programlisting> %\end{codesample2} %Mercurial ignores the lines that start with ``\texttt{HG:}''; it uses %them only to tell us which files it's recording changes to. Modifying @@ -773,8 +837,13 @@ \hgcmd{commit}$B%3%^%s%I$,5/F0$9$k%(%G%#%?$O!$6u9T$H(B``\texttt{HG:}''$B$G;O$^(B $B$k?t9T$r$9$G$K4^$s$G$$$k!%(B \begin{codesample2} - \emph{empty line} - HG: changed hello.c +This is where I type my commit comment. + +HG: Enter commit message. Lines beginning with 'HG:' are removed. +HG: -- +HG: user: Bryan O'Sullivan <bos@serpentine.com> +HG: branch 'default' +HG: changed hello.c</programlisting> \end{codesample2} Mercurial$B$O(B``\texttt{HG:}''$B$G;O$^$k9T$rL5;k$9$k!%$3$l$i$N9T$O$I$N%U%!%$%k(B $B$X$NJQ99$J$N$+$r%f!<%6$KEA$($k$@$1$NL\E*$GB8:_$9$k!%$3$l$i$N9T$rJQ99$7$?(B @@ -848,14 +917,26 @@ %that is identical to \hgcmd{log}, but it only displays the newest %revision in the repository. %\interaction{tour.tip} -%We refer to the newest revision in the repository as the tip revision, -%or simply the tip. +%We refer to the newest revision in the repository as the \emph{tip revision}, +%or simply the \emph{tip}. $B%3%_%C%H$N40N;8e!$(B\hgcmd{tip}$B%3%^%s%I$G:#:n@.$7$?%A%'%s%8%;%C%H$rCN$k$3$H(B $B$,$G$-$k!%$3$N%3%^%s%I$N=PNO$O%j%]%8%H%j$N:G?7%j%S%8%g%s$N$_$rI=<($9$k$H(B $B$$$&E@$r=|$1$P(B\hgcmd{log}$B$HA4$/F1$8$G$"$k!%(B \interaction{tour.tip} -$B%j%]%8%H%j$N:G?7%j%S%8%g%s$O(Btip$B%j%S%8%g%s$^$?$OC1$K(Btip$B$H8F$P$l$k!%(B +$B%j%]%8%H%j$N:G?7%j%S%8%g%s$O(B\emph{tip$B%j%S%8%g%s(B}$B$^$?$OC1$K(B\emph{tip}$B$H8F(B +$B$P$l$k!%(B + +%By the way, the \hgcmpd{tip} command accepts many of the same options as +%\hgcmd{log}, so \hgopt{log}{-v} above indicates ``be verbose'', +%\hgopt{log}{-p} specifies ``print a patch''. The use of \hgopt{log}{-p} +%to print patches is another example of the consistent naming we +%mentioned earlier. + +\hgcmpd{tip}$B%3%^%s%I$G$O(B\hgcmd{log}$B%3%^%s%I$N%*%W%7%g%s$NB?$/$,;H$($k!%>e(B +$B5-$N(B\hgopt{log}{-v}$B$O(B``$B>iD9(B''$B$JI=<($r9T$&$7!$(B\hgopt{log}{-p}$B$O(B``$B%Q%C%A$N(B +$BI=<((B''$B$r9T$&!%(B\hgopt{log}{-p}$B$G%Q%C%A$,I=<($5$l$k$N$O!$A0=R$N%*%W%7%g%sL>(B +$B$N0l4S@-$r<($9$b$&0l$D$NNc$G$"$k!%(B %\section{Sharing changes} \section{$BJQ99$r6&M-$9$k(B} @@ -890,10 +971,6 @@ %what changes the \hgcmd{pull} command \emph{would} pull into the %repository, without actually pulling the changes in. %\interaction{tour.incoming} -%(Of course, someone could cause more changesets to appear in the -%repository that we ran \hgcmd{incoming} in, before we get a chance to -%\hgcmd{pull} the changes, so that we could end up pulling changes that we -%didn't expect.) \hgcmd{pull}$B%3%^%s%I$GJQ99$r(B\dirname{my-hello}$B$+$i(B\dirname{hello-pull}$B$K(B $B<h$j9~$`!%L$CN$NJQ99$rLUL\E*$K%j%]%8%H%j$K(Bpull$B$9$k$3$H$O>/!962$m$7(B @@ -901,9 +978,17 @@ $B$^$l$k$N$+$r<B:]$K$O(Bpull$B$9$k$3$H$J$/I=<($9$k(B\hgcmd{incoming}$B%3%^%s%I$,$"(B $B$k!%(B \interaction{tour.incoming} -$B!J$b$A$m$s(B\hgcmd{incoming}$B$r<B9T$7$F$+$i<B:]$K(B\hgcmd{pull}$B$9$k$^$G$N4V$K(B -$BC/$+$,?7$?$J%A%'%s%8%;%C%H$rDI2C$7!$$=$N7k2L!$M=4|$7$J$$%A%'%s%8%;%C%H$r(B -pull$B$7$F$7$^$&2DG=@-$O$"$k!%!K(B + +%Suppose you're pulling changes from a repository on the network +%somewhere. While you are looking at the \hgcmd{incoming} output, and +%before you pull those changes, someone might have committed something in +%the remote repository. This means that it's possible to pull more +%changes than you saw when using \hgcmd{incoming}. + +$B$*$=$i$/FI<T$O%M%C%H%o!<%/>e$N$I$3$+$+$i%j%]%8%H%j$r(Bpull$B$9$k$K0c$$$J$$!%(B +$BJQ99$r(Bpull$B$9$kA0!$(B\hgcmd{incoming}$B$N=PNO$r8+$F$$$k4V$KC/$+$,%j%b!<%H%j%](B +$B%8%H%j$K2?$+%3%_%C%H$9$k$3$H$bM-$jF@$k!%$3$N>l9g!$(B\hgcmd{incoming}$B$G8+$?(B +$B$b$N$h$j$bB?$/$NJQ99$,(Bpull$B$5$l$k$3$H$K$J$k!%(B %Bringing changes into a repository is a simple matter of running the %\hgcmd{pull} command, and telling it which repository to pull from. @@ -1028,10 +1113,6 @@ %\interaction{tour.outgoing} %And the \hgcmd{push} command does the actual push. %\interaction{tour.push} -%As with \hgcmd{pull}, the \hgcmd{push} command does not update the -%working directory in the repository that it's pushing changes into. -%(Unlike \hgcmd{pull}, \hgcmd{push} does not provide a \texttt{-u} -%option that updates the other repository's working directory.) Mercurial$B$G$O8=:_;HMQ$7$F$$$k%j%]%8%H%j$+$iB>$N%j%]%8%H%j$KJQ99$r(Bpush$B$9$k(B $B$3$H$,$G$-$k!%A0=R$N(B\hgcmd{pull}$B%3%^%s%I$N$h$&$K!$0l;~E*$J%j%]%8%H%j$r:n$C(B @@ -1042,10 +1123,23 @@ \interaction{tour.outgoing} \hgcmd{push}$B%3%^%s%I$G<B:]$K(Bpush$B$r9T$&!%(B \interaction{tour.push} + +%As with \hgcmd{pull}, the \hgcmd{push} command does not update the +%working directory in the repository that it's pushing changes into. +%Unlike \hgcmd{pull}, \hgcmd{push} does not provide a \texttt{-u} option +%that updates the other repository's working directory. This asymmetry +%is deliberate: the repository we're pushing to might be on a remote +%server and shared between several people. If we were to update its +%working directory while someone was working in it, their work would be +%disrupted. + \hgcmd{pull}$B%3%^%s%I$HF1MM$K!$(B\hgcmd{push}$B%3%^%s%I$O(Bpush$B@h$N%j%]%8%H%j$N(B -$B%o!<%-%s%0%G%#%l%/%H%j$N99?7$r9T$o$J$$!%!J(B\hgcmd{pull}$B%3%^%s%I$H0c$C$F(B +$B%o!<%-%s%0%G%#%l%/%H%j$N99?7$r9T$o$J$$!%(B\hgcmd{pull}$B%3%^%s%I$H0c$C$F(B \hgcmd{push}$B%3%^%s%I$O!$%o!<%-%s%0%G%#%l%/%H%j$N99?7$r9T$&(B\texttt{-u}$B%*%W(B -$B%7%g%s$r;}$?$J$$!%!K(B +$B%7%g%s$r;}$?$J$$!%$3$NHsBP>N@-$O0U?^E*$J$b$N$G!$(Bpush$B@h$N%j%]%8%H%j$O%j%b!<(B +$B%H%5!<%P>e$K$"$k$+$b$7$l$:!$J#?t$N%f!<%6$+$i6&M-$5$l$F$$$k2DG=@-$,$"$k!%(B +$B$b$7C/$+$,:n6HCf$N%o!<%-%s%0%G%#%l%/%H%j$r99?7$7$?$i!$$=$N:n6HFbMF$OBfL5(B +$B$7$K$J$C$F$7$^$&!%(B %What happens if we try to pull or push changes and the receiving %repository already has those changes? Nothing too exciting.