Mercurial > hgbook
changeset 799:7107b79427a3
Propagate 4e23c220d1b0
Update chapter 2
author | Yoshiki Yazawa <yaz@honeyplanet.jp> |
---|---|
date | Thu, 18 Jun 2009 19:11:36 +0900 |
parents | 09c1609f9bb2 |
children | 1a30d2627512 |
files | ja/tour-merge.tex |
diffstat | 1 files changed, 71 insertions(+), 76 deletions(-) [+] |
line wrap: on
line diff
--- a/ja/tour-merge.tex Thu Jun 18 16:45:47 2009 +0900 +++ b/ja/tour-merge.tex Thu Jun 18 19:11:36 2009 +0900 @@ -132,7 +132,7 @@ %Mercurial is telling us that the \hgcmd{update} command won't do a %merge; it won't update the working directory when it thinks we might -%be wanting to do a merge, unless we force it to do so. Instead, we +%want to do a merge, unless we force it to do so. Instead, we %use the \hgcmd{merge} command to merge the two heads. %\interaction{tour.merge.merge} @@ -142,16 +142,6 @@ $B0lJ}!$(B\hgcmd{merge}$B%3%^%s%I$O(B2$B$D$N%X%C%I$N%^!<%8$r9T$&!%(B \interaction{tour.merge.merge} -\begin{figure}[ht] - \centering - \grafix{tour-merge-merge} -% \caption{Working directory and repository during merge, and -% following commit} - \caption{$B%^!<%8Cf$N%o!<%-%s%0%G%#%l%/%H%j$H%j%]%8%H%j$*$h$S8eB3$N%3%_%C(B - $B%H(B} - \label{fig:tour-merge:merge} -\end{figure} - %This updates the working directory so that it contains changes from %\emph{both} heads, which is reflected in both the output of %\hgcmd{parents} and the contents of \filename{hello.c}. @@ -191,19 +181,39 @@ $B%^!<%8$N4V!$%o!<%-%s%0%G%#%l%/%H%j$O(B2$B$D$N?F%A%'%s%8%;%C%H$r;}$A!$$3$l$i$O(B $B?7$7$$%A%'%s%8%;%C%H$NN>?F$H$J$k!%(B +\begin{figure}[ht] + \centering + \grafix{tour-merge-merge} +% \caption{Working directory and repository during merge, and +% following commit} + \caption{$B%^!<%8Cf$N%o!<%-%s%0%G%#%l%/%H%j$H%j%]%8%H%j$*$h$S8eB3$N%3%_%C(B + $B%H(B} + \label{fig:tour-merge:merge} +\end{figure} + +%We sometimes talk about a merge having \emph{sides}: the left side is +%the first parent in the output of \hgcmd{parents}, and the right side is +%the second. If the working directory was at e.g. revision 5 before we +%began a merge, that revision will become the left side of the merge. + +$B%^!<%8$K$h$j(B\emph{$B%5%$%I(B}$B$,$G$-$k$3$H$,$"$k!%:8$N%5%$%I$O(B\hgcmd{parents} +$B$N=PNO$N:G=i$N?F$G!$1&$N%5%$%I$,(B2$BHVL\$N?F$G$"$k!%Nc$($P!$%^!<%8A0$K%o!<%-(B +$B%s%0%G%#%l%/%H%j$,%j%S%8%g%s(B5$B$G$"$C$?$H$9$k$H!$%^!<%8$N:8$N%5%$%I$,$3$N(B +$B%j%S%8%g%s$K$J$k!%(B + %\section{Merging conflicting changes} \section{$B%3%s%U%j%/%H$N$"$kJQ99$r%^!<%8$9$k(B} %Most merges are simple affairs, but sometimes you'll find yourself -%merging changes where each modifies the same portions of the same +%merging changes where each side modifies the same portions of the same %files. Unless both modifications are identical, this results in a %\emph{conflict}, where you have to decide how to reconcile the %different changes into something coherent. -$BBgH>$N%^!<%8$O%7%s%W%k$J$b$N$@$,!$>l9g$K$h$C$F$OF1$8%U%!%$%k$NF1$82U=j$r(B -$BJQ99$7$F$$$k%A%'%s%8%;%C%H$r%^!<%8$7$J$1$l$P$J$i$J$$$3$H$,$"$k!%J#?t$NJQ(B -$B99$,F1$8FbMF$G$J$$8B$j!$7k2L$O(B\emph{conflict}$B$H$J$k$?$a!$Aj0[$J$kJQ99$r@0(B -$B9g$5$;$k$h$&$K=$@5$9$kI,MW$,$"$k!%(B +$BBgH>$N%^!<%8$O%7%s%W%k$J$b$N$@$,!$F1$8%U%!%$%k$NF1$82U=j$rJQ99$9$k%A%'%s(B +$B%8%;%C%H$r%^!<%8$7$J$1$l$P$J$i$J$$$3$H$b$"$k!%3F!9$NJQ99$,F1$8FbMF$G$J$$(B +$B8B$j!$7k2L$O(B\emph{conflict}$B$H$J$k$?$a!$JQ99$r@09g$5$;$k$h$&$K=$@5$9$kI,MW(B +$B$,$"$k!%(B \begin{figure}[ht] \centering @@ -227,23 +237,21 @@ $B%H$r2r7h$9$k$?$a!$%U%!%$%k$,$I$&$"$k$Y$-$+$rL@$i$+$K$7$h$&!%(B %Mercurial doesn't have a built-in facility for handling conflicts. -%Instead, it runs an external program called \command{hgmerge}. This -%is a shell script that is bundled with Mercurial; you can change it to -%behave however you please. What it does by default is try to find one -%of several different merging tools that are likely to be installed on -%your system. It first tries a few fully automatic merging tools; if -%these don't succeed (because the resolution process requires human -%guidance) or aren't present, the script tries a few different +%Instead, it runs an external program, usually one that displays some +%kind of graphical conflict resolution interface. By default, Mercurial +%tries to find one of several different merging tools that are likely to +%be installed on your system. It first tries a few fully automatic +%merging tools; if these don't succeed (because the resolution process +%requires human guidance) or aren't present, it tries a few different %graphical merging tools. -Mercurial$B$OFbB"$N%3%s%U%j%/%H2r7h5!9=$r;}$?$J$$!%$=$NBe$o(B -$B$j!$(B\command{hgmerge}$B$H$$$&30It%3%^%s%I$r5/F0$9$k!%$3$l$O(BMercurial$B$KF1:-(B -$B$5$l$?%7%'%k%9%/%j%W%H$G!$5sF0$rJQ99$9$k$3$H$b2DG=$G$"$k!%(B -$B%G%U%)%k%H$G$3$N%3%^%s%I$,9T$&$3$H$O!$%7%9%F%`$K%$%s%9%H!<%k$5$l$F$$$k2D(B -$BG=@-$N9b$$$$$/$D$+$N0[$J$C$?%^!<%8%D!<%k$N(B1$B$D$rA\$7=P$9$3$H$G$"$k!%(B -$B:G=i$K(B2,3$B$NA4<+F0$N%^!<%8%D!<%k$r;n$9!%$3$l$G$&$^$/$$$+$J$$>l9g!J2r7h%W(B -$B%m%;%9$K?M$N%,%$%I$,I,MW$J$?$a!K$d%D!<%k$,B8:_$7$J$$>l9g!$%9%/%j%W%H$O(B -$BJL$N(B2,3$B$N%0%i%U%#%+%k%^!<%8%D!<%k$r;n$9!%(B +Mercurial$B$OFbB"$N%3%s%U%j%/%H2r7h5!9=$r;}$?$J$$!%$=$NBe$o$j!$2?$i$+$N%0%i(B +$B%U%#%+%k$J%3%s%U%j%/%H2r7h%$%s%?%U%'!<%9$rI=<($9$k30It%3%^%s%I$r5/F0$9(B +$B$k!%%G%U%)%k%H$G(BMercurial$B$O%7%9%F%`$K%$%s%9%H!<%k$5$l$F$$$k2DG=@-$N9b$$$$(B +$B$/$D$+$N%^!<%8%D!<%k$rA\$9!%(BMercurial$B$O:G=i$K(B2,3$B$NA4<+F0$N%^!<%8%D!<%k$r(B +$B;n$9!%$3$l$G$&$^$/$$$+$J$$>l9g!J2r7h%W%m%;%9$K?M$N%,%$%I$,I,MW$J>l9g!K$d(B +$B%D!<%k$,B8:_$7$J$$>l9g!$%9%/%j%W%H$OJL$N(B2,3$B$N%0%i%U%#%+%k%^!<%8%D!<%k$r;n(B +$B$9!%(B %It's also possible to get Mercurial to run another program or script %instead of \command{hgmerge}, by setting the \envar{HGMERGE} @@ -363,29 +371,15 @@ $B%U%!%$%k$K(B2$B$D$NJL$N%P!<%8%g%s$r:n$j!$%^!<%8$r9T$&$N$KE*2<4D6-$r@_Dj$9$k!%(B \interaction{tour-merge-conflict.pull} -%In this example, I won't use Mercurial's normal \command{hgmerge} -%program to do the merge, because it would drop my nice automated -%example-running tool into a graphical user interface. Instead, I'll -%set \envar{HGMERGE} to tell Mercurial to use the non-interactive -%\command{merge} command. This is bundled with many Unix-like systems. -%If you're following this example on your computer, don't bother -%setting \envar{HGMERGE}. -%\interaction{tour-merge-conflict.merge} -%Because \command{merge} can't resolve the conflicting changes, it -%leaves \emph{merge markers} inside the file that has conflicts, -%indicating which lines have conflicts, and whether they came from our -%version of the file or theirs. +%In this example, I'll set \envar{HGMERGE} to tell Mercurial to use the +%non-interactive \command{merge} command. This is bundled with many +%Unix-like systems. (If you're following this example on your computer, +%don't bother setting \envar{HGMERGE}.) -$B$3$NNc$G$O%^!<%8$K(BMercurial$B$NDL>o%3%^%s%I$G$"$k(B\command{hgmerge}$B$O;H$o$J(B -$B$$!%$3$N%3%^%s%I$O<+F02=$5$l$?%0%i%U%#%+%k%f!<%6%$%s%?!<%U%'%$%9$N%^!<%8(B -$B%D!<%k$r5/F0$7$F$7$^$&$+$i$G$"$k!%$=$NBe$o$j(B\envar{HGMERGE}$B$r@_Dj$7(B -$B$F!$(BMercurial$B$KHsBPOCE*$J(B\command{merge}$B%3%^%s%I$r5/F0$5$;$k!%$3$l$OB?$/(B -$B$N(BUnix$B7O%7%9%F%`$K%P%s%I%k$5$l$F$$$k%3%^%s%I$G$"$k!%$3$NNc$r<j85$N%^%7%s(B -$B$G<B9T$9$k;~$K$O(B\envar{HGMERGE}$B$r@_Dj$9$kI,MW$O$J$$!%(B -\interaction{tour-merge-conflict.merge} \command{merge}$B%3%^%s%I$O%A%'%s%8(B -$B%;%C%H$N%3%s%U%j%/%H$r2r7h$9$k$3$H$O$G$-$:!$(B\emph{merge markers}$B$r%3%s%U(B -$B%j%/%H$N$"$k%U%!%$%kFb$K;D$7!$$I$N9T$K%3%s%U%j%/%H$,$"$k$N$+!$%3%s%U%j%/(B -$B%H$,<j85$NJQ99$HB>$N?M$NJQ99$N$$$:$l$+$iMh$F$$$k$N$+$r<($9!%(B +$B$3$NNc$G$O(B\envar{HGMERGE}$B$r@_Dj$7$F!$(BMercurial$B$KHsBPOCE*$J(B +\command{merge}$B%3%^%s%I$r5/F0$5$;$k!%$3$l$OB?$/$N(BUnix$B7O%7%9%F%`$K%P%s%I%k(B +$B$5$l$F$$$k%3%^%s%I$G$"$k!%!J$3$NNc$r<j85$N%^%7%s$G<B9T$9$k;~$K$O(B +\envar{HGMERGE}$B$r@_Dj$9$kI,MW$O$J$$!%!K(B %Mercurial can tell from the way \command{merge} exits that it wasn't %able to merge successfully, so it tells us what commands we'll need to @@ -418,7 +412,7 @@ $B$D$N%3%^%s%I$r=g$KMQ$$$kI,MW$,$"$C$?!%(B \begin{codesample2} - hg pull + hg pull -u hg merge hg commit -m 'Merged remote changes' \end{codesample2} @@ -449,36 +443,37 @@ %The \hgext{fetch} extension adds a new command called, not %surprisingly, \hgcmd{fetch}. This extension acts as a combination of -%\hgcmd{pull}, \hgcmd{update} and \hgcmd{merge}. It begins by pulling +%\hgopt{pull}{-u}, \hgcmd{merge} and \hgcmd{commit}. It begins by pulling %changes from another repository into the current repository. If it -%finds that the changes added a new head to the repository, it begins a -%merge, then commits the result of the merge with an -%automatically-generated commit message. If no new heads were added, -%it updates the working directory to the new tip changeset. +%finds that the changes added a new head to the repository, it +%begins a merge, then (if the merge succeeded) commits the result +%of the merge with an automatically-generated commit message. If +%no new heads were added, it updates the working directory to the +%new tip changeset. \hgext{fetch}$B%(%/%9%F%s%7%g%s$O$=$NL>$NDL$j$N?7$7$$%3%^%s%I(B\hgcmd{fetch} -$B$rDI2C$9$k!%$3$N%(%/%9%F%s%7%g%s$O(B\hgcmd{pull}$B$H(B\hgcmd{update}$B$*$h$S(B -\hgcmd{merge}$B$rAH$_9g$o$;$?F/$-$r$9$k!%$3$N%(%/%9%F%s%7%g%s$O$^$:B>$N%j%](B -$B%8%H%j$+$iJQ99$r(Bpull$B$7!$%j%]%8%H%j$K?7$7$$%X%C%I$,DI2C$5$l$?>l9g$O%^!<%8(B -$B$r9T$$!$%^!<%87k2L$r<+F0E*$K@8@.$5$l$?%3%_%C%H%a%C%;!<%8$H6&$K%3%_%C%H$9(B -$B$k!%?7$?$J%X%C%I$,DI2C$5$l$J$+$C$?>l9g$O?7$?$J(Btip$B%A%'%s%8%;%C%H$X%o!<%-%s(B -$B%0%G%#%l%/%H%j$r99?7$9$k!%(B +$B$rDI2C$9$k!%$3$N%(%/%9%F%s%7%g%s$O(B\hgopt{pull}{-u}$B$H(B\hgcmd{merge}$B$*$h$S(B +\hgcmd{commit}$B$rAH$_9g$o$;$?F/$-$r$9$k!%$3$N%(%/%9%F%s%7%g%s$O$^$:B>$N%j(B +$B%]%8%H%j$+$iJQ99$r(Bpull$B$7!$%j%]%8%H%j$K?7$7$$%X%C%I$,DI2C$5$l$?>l9g$O%^!<(B +$B%8$r9T$$!$!J%^!<%8$,@.8y$7$?>l9g!K%^!<%87k2L$r<+F0E*$K@8@.$5$l$?%3%_%C%H(B +$B%a%C%;!<%8$H6&$K%3%_%C%H$9$k!%?7$?$J%X%C%I$,DI2C$5$l$J$+$C$?>l9g$O?7$?$J(B +tip$B%A%'%s%8%;%C%H$X%o!<%-%s%0%G%#%l%/%H%j$r99?7$9$k!%(B -%Enabling the \hgext{fetch} extension is easy. Edit your -%\sfilename{.hgrc}, and either go to the \rcsection{extensions} section -%or create an \rcsection{extensions} section. Then add a line that -%simply reads ``\Verb+fetch +''. -$B4JC1$K(B\hgext{fetch}$B%(%/%9%F%s%7%g%s$rM-8z$K$9$k$3$H$,$G$-(B -$B$k!%(B\sfilename{.hgrc}$B%U%!%$%k$N(B\rcsection{extensions}$B%;%/%7%g%s$rJT=8!JB8(B -$B:_$7$J$1$l$PDI2C$9$k!K$7!$(B``\Verb+fetch +''$B$H$$$&9T$rDI2C$9$l$P$h$$!%(B +%Enabling the \hgext{fetch} extension is easy. Edit the +%\sfilename{.hgrc} in your home directory, and either go to the +%\rcsection{extensions} section or create an \rcsection{extensions} +%section. Then add a line that simply reads ``\Verb+fetch +''. + +\hgext{fetch}$B%(%/%9%F%s%7%g%s$O4JC1$KM-8z$K$9$k$3$H$,$G$-$k!%%[!<%`%G%#%l(B +$B%/%H%j$N(B\sfilename{.hgrc}$B%U%!%$%k$rJT=8$7!$(B\rcsection{extensions}$B%;%/%7%g(B +$B%s$K(B``\Verb+fetch +''$B$H$$$&9T$rDI2C$9$l$P$h$$!%(B \begin{codesample2} [extensions] fetch = \end{codesample2} -%(Normally, on the right-hand side of the ``\texttt{=}'' would appear -%the location of the extension, but since the \hgext{fetch} extension -%is in the standard distribution, Mercurial knows where to search for -%it.) +%(Normally, the right-hand side of the ``\texttt{=}'' would indicate +%where to find the extension, but since the \hgext{fetch} extension is in +%the standard distribution, Mercurial knows where to search for it.) $B!JDL>o!$1&JU$N(B``\texttt{=}''$B$O%(%/%9%F%s%7%g%s$NCV$+$l$?>l=j$rI=$9(B $B$,!$(B\hgext{fetch}$B%(%/%9%F%s%7%g%s$OI8=`G[I[J*$K4^$^$l$k$?$a!$(BMercurial$B$O(B $B$=$N=j:_$r$9$G$KCN$C$F$$$k!%!K(B