Mercurial > hgbook
changeset 320:5357ca303e85
more branch.tex
author | Yoshiki Yazawa <yaz@cc.rim.or.jp> |
---|---|
date | Thu, 27 Mar 2008 06:07:34 +0900 |
parents | 5b5aeb1c5f2f |
children | 2b25fe6e4331 |
files | ja/branch.tex |
diffstat | 1 files changed, 140 insertions(+), 67 deletions(-) [+] |
line wrap: on
line diff
--- a/ja/branch.tex Thu Mar 27 02:29:56 2008 +0900 +++ b/ja/branch.tex Thu Mar 27 06:07:34 2008 +0900 @@ -390,96 +390,169 @@ \interaction{branch-repo.new} %\section{Don't repeat yourself: merging across branches} -\section{$B<j$G7+$jJV$9$Y$-$G$O$J$$!'%V%i%s%A4V$G$N%^!<%8(B} +\section{$B<j$G7+$jJV$5$J$$$3$H!'%V%i%s%A4V$G$N%^!<%8(B} + +%In many cases, if you have a bug to fix on a maintenance branch, the +%chances are good that the bug exists on your project's main branch +%(and possibly other maintenance branches, too). It's a rare developer +%who wants to fix the same bug multiple times, so let's look at a few +%ways that Mercurial can help you to manage these bugfixes without +%duplicating your work. -In many cases, if you have a bug to fix on a maintenance branch, the -chances are good that the bug exists on your project's main branch -(and possibly other maintenance branches, too). It's a rare developer -who wants to fix the same bug multiple times, so let's look at a few -ways that Mercurial can help you to manage these bugfixes without -duplicating your work. +$B%a%s%F%J%s%9%V%i%s%A$G=$@5$9$Y$-%P%0$,$"$k$H$-!$B?$/$N>l9g!$%a%$%s%V%i%s(B +$B%A$K$=$N%P%0$,$"$k2DG=@-$O9b$$!%!J$5$i$KB>$N%a%s%F%J%s%9%V%i%s%A$K$*$$$F(B +$B$b!%!K%P%0$N=$@5$r2?EY$b7+$jJV$7$?$$$H;W$&3+H/<T$O$^$:$$$J$$!%$=$3$G%P%0(B +$B=$@5$r7+$jJV$9Be$o$j$N$G$O$J$/!$(BMercurial$B$G2r7h$G$-$k$$$/$D$+$NJ}K!$r8+(B +$B$F$_$k$3$H$K$7$h$&!%(B -In the simplest instance, all you need to do is pull changes from your -maintenance branch into your local clone of the target branch. +%In the simplest instance, all you need to do is pull changes from your +%maintenance branch into your local clone of the target branch. +%\interaction{branch-repo.pull} +%You'll then need to merge the heads of the two branches, and push back +%to the main branch. +%\interaction{branch-repo.merge} + +$B:G$b4JC1$J$N$O!$%a%s%F%J%s%9%V%i%s%A$+$iJQ99$r%?!<%2%C%H%V%i%s%A$N%m!<%+(B +$B%k%/%m!<%s$K(Bpull$B$9$kJ}K!$G$"$k!%(B \interaction{branch-repo.pull} -You'll then need to merge the heads of the two branches, and push back -to the main branch. +$B$=$N8e(B2$B$D$N%V%i%s%A$N%X%C%IF1;N$r%^!<%8$7!$%a%$%s%V%i%s%A$X%W%C%7%e$9$k!%(B \interaction{branch-repo.merge} %\section{Naming branches within one repository} \section{1$B$D$N%j%]%8%H%jFb$G$N%V%i%s%A$NL?L>(B} -In most instances, isolating branches in repositories is the right -approach. Its simplicity makes it easy to understand; and so it's -hard to make mistakes. There's a one-to-one relationship between -branches you're working in and directories on your system. This lets -you use normal (non-Mercurial-aware) tools to work on files within a -branch/repository. +%In most instances, isolating branches in repositories is the right +%approach. Its simplicity makes it easy to understand; and so it's +%hard to make mistakes. There's a one-to-one relationship between +%branches you're working in and directories on your system. This lets +%you use normal (non-Mercurial-aware) tools to work on files within a +%branch/repository. + +$BB?$/$N>l9g!$%V%i%s%AKh$KJ#?t$N%j%]%8%H%j$rMQ0U$73VN%$9$k$N$O@5$7$$%"%W%m!<(B +$B%A$G$"$k!%$3$l$OC1=c$J$?$aGD0.$,MF0W$G$"$j!$<:GT$rHH$92DG=@-$,Dc$$!%:n6H(B +$B$7$F$$$k%V%i%s%A$H%G%#%l%/%H%j$N4V$K$O(B1$BBP(B1$B$N4X78$,$"$k!%(BMercurial$B$r9MN8$7(B +$B$J$$DL>o$N%D!<%k$r%V%i%s%A!?%j%]%8%H%jFb$N%U%!%$%k$KBg$7$F;H$&$3$H$b2DG=(B +$B$G$"$k!%(B -If you're more in the ``power user'' category (\emph{and} your -collaborators are too), there is an alternative way of handling -branches that you can consider. I've already mentioned the -human-level distinction between ``small picture'' and ``big picture'' -branches. While Mercurial works with multiple ``small picture'' -branches in a repository all the time (for example after you pull -changes in, but before you merge them), it can \emph{also} work with -multiple ``big picture'' branches. +%If you're more in the ``power user'' category (\emph{and} your +%collaborators are too), there is an alternative way of handling +%branches that you can consider. I've already mentioned the +%human-level distinction between ``small picture'' and ``big picture'' +%branches. While Mercurial works with multiple ``small picture'' +%branches in a repository all the time (for example after you pull +%changes in, but before you merge them), it can \emph{also} work with +%multiple ``big picture'' branches. + +$B$"$J$?$H!J$"$J$?$N6(NO<T$,(B\emph{$B6&$K(B}$B!K(B``$B%Q%o!<%f!<%6(B''$B0J>e$N%+%F%4%j$KB0(B +$B$9$J$i!$%V%i%s%A$r<h$j07$&JL$NJ}K!$b9M$($i$l$k!%$9$G$K(B``$B6I=jE*$J%b%G%k(B'' +$B$H(B``$BBg6IE*$J%b%G%k(B''$B$H$$$&!$6hJL$K$D$$$F?($l$?!%(BMercurial$B$O!$J#?t$N(B``$B6I=j(B +$BE*$J(B''$B%V%i%s%A!J$?$H$($PJQ99$r(Bpull$B$7$F%^!<%8$7$F$$$J$$>l9g$J$I!KMQ$$$k$3(B +$B$H$,$G$-$k0lJ}$G!$J#?t$N(B``$BBg6IE*$J(B''$B%V%i%s%A$rMQ$$$k$3$H(B\emph{$B$b(B}$B$G$-$k!%(B + +%The key to working this way is that Mercurial lets you assign a +%persistent \emph{name} to a branch. There always exists a branch +%named \texttt{default}. Even before you start naming branches +%yourself, you can find traces of the \texttt{default} branch if you +%look for them. -The key to working this way is that Mercurial lets you assign a -persistent \emph{name} to a branch. There always exists a branch -named \texttt{default}. Even before you start naming branches -yourself, you can find traces of the \texttt{default} branch if you -look for them. +$B$3$NJ}K!$rMQ$$$k:]$N80$O!$(BMercurial$B$K$h$C$F%V%i%s%A$K1JB3E*$J(B\emph{$BL>A0(B} +$B$rIU$1$k$3$H$G$"$k!%%V%i%s%A$KL>A0$rIU$1$kA0$G$b!$(B\texttt{default}$B%V%i%s(B +$B%A$N%H%l!<%9$r8+$k$3$H$,$G$-$k!%(B + +%As an example, when you run the \hgcmd{commit} command, and it pops up +%your editor so that you can enter a commit message, look for a line +%that contains the text ``\texttt{HG: branch default}'' at the bottom. +%This is telling you that your commit will occur on the branch named +%\texttt{default}. + +$BNc$H$7$F!$(B\hgcmd{commit}$B%3%^%s%I$r<B9T$7!$%3%_%C%H%a%C%;!<%8$r=q$/$?$a$K(B +$B%(%G%#%?$,5/F0$5$l$?;~!$:G2<It$N(B``\texttt{HG: branch default}''$B$H$$$&9T(B +$B$r8+$F$[$7$$!%$3$N9T$O%3%_%C%H$,(B\texttt{default}$B$H$$$&L>A0$N%V%i%s%A$KBP(B +$B$7$F9T$o$l$k$3$H$r<($7$F$$$k!%(B -As an example, when you run the \hgcmd{commit} command, and it pops up -your editor so that you can enter a commit message, look for a line -that contains the text ``\texttt{HG: branch default}'' at the bottom. -This is telling you that your commit will occur on the branch named -\texttt{default}. +%To start working with named branches, use the \hgcmd{branches} +%command. This command lists the named branches already present in +%your repository, telling you which changeset is the tip of each. +%\interaction{branch-named.branches} +%Since you haven't created any named branches yet, the only one that +%exists is \texttt{default}. -To start working with named branches, use the \hgcmd{branches} -command. This command lists the named branches already present in -your repository, telling you which changeset is the tip of each. +$BL>A0IU$-%V%i%s%A$r;H$&$K$"$?$C$F!$$^$:(B\hgcmd{branches}$B$r;H$$!$%j%]%8%H%j(B +$BFb$K$9$G$KB8:_$9$kL>A0IU$-%V%i%s%A$rNs5s$9$k$3$H$+$i;O$a$k!%$3$N%3%^%s%I(B +$B$K$h$C$F$=$l$>$l$N%V%i%s%A$N(Btip$B$K$J$C$F$$$k%A%'%s%8%;%C%H$,$o$+$k!%(B \interaction{branch-named.branches} -Since you haven't created any named branches yet, the only one that -exists is \texttt{default}. +$B$3$3$G$O$^$@L>A0IU$-%V%i%s%A$r:n$C$F$$$J$$$N$G!$(B\texttt{default}$B%V%i%s%A(B +$B$@$1$,B8:_$9$k!%(B -To find out what the ``current'' branch is, run the \hgcmd{branch} -command, giving it no arguments. This tells you what branch the -parent of the current changeset is on. +%To find out what the ``current'' branch is, run the \hgcmd{branch} +%command, giving it no arguments. This tells you what branch the +%parent of the current changeset is on. +%\interaction{branch-named.branch} + +$B8=:_$N%V%i%s%A$,2?$J$N$+$rCN$k$?$a$K$O!$(B\hgcmd{branch}$B%3%^%s%I$r0z?t$J$7(B +$B$G<B9T$9$k!%$3$N%3%^%s%I$G8=:_$N%A%'%s%8%;%C%H$N?F%V%i%s%A$,$o$+$k!%(B \interaction{branch-named.branch} -To create a new branch, run the \hgcmd{branch} command again. This -time, give it one argument: the name of the branch you want to create. +%To create a new branch, run the \hgcmd{branch} command again. This +%time, give it one argument: the name of the branch you want to create. +%\interaction{branch-named.create} + +$B?7$7$$%V%i%s%A$r:n$k$N$K$b(B\hgcmd{branch}$B%3%^%s%I$r;H$&!%$3$N>l9g$O!$:n@.(B +$B$7$?$$%V%i%s%A$NL>A0$r0z?t$H$7$FEO$9!%(B \interaction{branch-named.create} -After you've created a branch, you might wonder what effect the -\hgcmd{branch} command has had. What do the \hgcmd{status} and -\hgcmd{tip} commands report? +%After you've created a branch, you might wonder what effect the +%\hgcmd{branch} command has had. What do the \hgcmd{status} and +%\hgcmd{tip} commands report? +%\interaction{branch-named.status} +%Nothing has changed in the working directory, and there's been no new +%history created. As this suggests, running the \hgcmd{branch} command +%has no permanent effect; it only tells Mercurial what branch name to +%use the \emph{next} time you commit a changeset. + +$B%V%i%s%A$r:n$C$?8e$G(B\hgcmd{branch}$B%3%^%s%I$,$I$N$h$&$J8z2L$r;}$C$F$$$k$N(B +$B$+J,$+$i$J$$$+$b$7$l$J$$!%(B\hgcmd{status}$B%3%^%s%I$H(B\hgcmd{tip}$B%3%^%s%I$O(B +$B$=$l$>$l2?$rI=<($9$k$@$m$&$+!)(B \interaction{branch-named.status} -Nothing has changed in the working directory, and there's been no new -history created. As this suggests, running the \hgcmd{branch} command -has no permanent effect; it only tells Mercurial what branch name to -use the \emph{next} time you commit a changeset. +$B%o!<%-%s%0%G%#%l%/%H%jFb$G$O2?$bJQ2=$O5/$-$:!$2?$N%R%9%H%j$b@8@.$5$l$F$$(B +$B$J$$!%$3$l$+$iJ,$+$k$h$&$K!$(B\hgcmd{branch}$B%3%^%s%I$r<B9T$7$F$b!$1JB3E*$J(B +$B8z2L$O2?$b5/$-$J$$!%$3$N%3%^%s%I$O(B\emph{$B<!$N(B}$B%A%'%s%8%;%C%H$N%3%_%C%H$,(B +$B$I$N%V%i%s%A$KBP$7$F9T$o$l$k$+$r(BMercurial$B%3%^%s%I$K<($9$N$K;H$o$l$k!%(B -When you commit a change, Mercurial records the name of the branch on -which you committed. Once you've switched from the \texttt{default} -branch to another and committed, you'll see the name of the new branch -show up in the output of \hgcmd{log}, \hgcmd{tip}, and other commands -that display the same kind of output. +%When you commit a change, Mercurial records the name of the branch on +%which you committed. Once you've switched from the \texttt{default} +%branch to another and committed, you'll see the name of the new branch +%show up in the output of \hgcmd{log}, \hgcmd{tip}, and other commands +%that display the same kind of output. +%\interaction{branch-named.commit} +%The \hgcmd{log}-like commands will print the branch name of every +%changeset that's not on the \texttt{default} branch. As a result, if +%you never use named branches, you'll never see this information. + +$BJQ99$r%3%_%C%H$9$k;~!$(BMercurial$B$O%3%_%C%H$9$k$NBP>]$K$J$k%V%i%s%A$NL>A0(B +$B$r5-O?$9$k!%$R$H$?$S(B\texttt{default}$B$+$iB>$XJQ99$9$l$P!$?7$7$$%V%i%s%AL>(B +$B$,(B\hgcmd{log}$B$d(B\hgcmd{tip}$B$N=PNO$K4^$^$l$k$N$,8+$F<h$l$k$@$m$&!%(B \interaction{branch-named.commit} -The \hgcmd{log}-like commands will print the branch name of every -changeset that's not on the \texttt{default} branch. As a result, if -you never use named branches, you'll never see this information. +\hgcmd{log}$B$N$h$&$J%3%^%s%I$O!$(B\texttt{default}$B%V%i%s%A0J30$KB0$9$k$9$Y$F(B +$B$N%A%'%s%8%;%C%H$KBP$7$F%V%i%s%AL>$rI=<($9$k!%%V%i%s%A$KL>A0$rIU$1$F$$$J(B +$B$$>l9g$O$3$N=PNO$rL\$K$9$k$3$H$O$J$$!%(B -Once you've named a branch and committed a change with that name, -every subsequent commit that descends from that change will inherit -the same branch name. You can change the name of a branch at any -time, using the \hgcmd{branch} command. +%Once you've named a branch and committed a change with that name, +%every subsequent commit that descends from that change will inherit +%the same branch name. You can change the name of a branch at any +%time, using the \hgcmd{branch} command. +%\interaction{branch-named.rebranch} +%In practice, this is something you won't do very often, as branch +%names tend to have fairly long lifetimes. (This isn't a rule, just an +%observation.) + +$B%V%i%s%A$KL>A0$rIU$1!$$=$NL>A0$r;H$C$FJQ99$N%3%_%C%H$r9T$&$H!$0J8e$KB3$/(B +$BA4$F$N%3%_%C%H$OF1$8L>A0$r;}$D!%L>A0$NJQ99$O(B\hgcmd{branch}$B%3%^%s%I$r;H$&$3(B +$B$H$G$O$$$D$G$b2DG=$@!%(B \interaction{branch-named.rebranch} -In practice, this is something you won't do very often, as branch -names tend to have fairly long lifetimes. (This isn't a rule, just an -observation.) +$B<BMQ$K$*$$$F$O!$%V%i%s%AL>$O$+$J$jD9$$4|4V;H$o$l$k798~$,$"$j!$JQ99$OIQHK(B +$B$K$O9T$o$l$J$$!%!J$3$l$OK!B'$H8@$($k$h$&$J$b$N$G$O$J$/!$C1$J$k4QB,7k2L$G(B +$B$"$k!%!K(B %\section{Dealing with multiple named branches in a repository} \section{$B%j%]%8%H%jFb$GJ#?t$NL>A0$NIU$$$?%V%i%s%A$N<h$j07$$(B}