annotate ja/branch.tex @ 317:0a551d1b44a6

more branch.tex
author Yoshiki Yazawa <yaz@cc.rim.or.jp>
date Tue, 19 Feb 2008 00:33:24 +0900
parents 2052bee9f074
children 5357ca303e85
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
296
89db0aaf6a29 translated chapter & section name within branch.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 293
diff changeset
1 %\chapter{Managing releases and branchy development}
89db0aaf6a29 translated chapter & section name within branch.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 293
diff changeset
2 \chapter{$B%j%j!<%9$H%V%i%s%A3+H/$N4IM}(B}
187
b60e2de6dbc3 Add chapter on branch management.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
3 \label{chap:branch}
b60e2de6dbc3 Add chapter on branch management.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
4
301
828f5606faf0 started branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 296
diff changeset
5 %Mercurial provides several mechanisms for you to manage a project that
828f5606faf0 started branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 296
diff changeset
6 %is making progress on multiple fronts at once. To understand these
828f5606faf0 started branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 296
diff changeset
7 %mechanisms, let's first take a brief look at a fairly normal software
828f5606faf0 started branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 296
diff changeset
8 %project structure.
828f5606faf0 started branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 296
diff changeset
9
828f5606faf0 started branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 296
diff changeset
10 Mercurial$B$OF1;~$KJ#?t$N6ILL$G?J9T$7$F$$$/%W%m%8%'%/%H$r4IM}$9$k$N$KLrN)(B
828f5606faf0 started branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 296
diff changeset
11 $B$D5!G=$r;}$C$F$$$k!%$3$l$i$N5!G=$rM}2r$9$k$?$a!$$^$:DL>o$N%=%U%H%&%'%"%W(B
828f5606faf0 started branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 296
diff changeset
12 $B%m%8%'%/%H$N9=B$$r9M$($k!%(B
187
b60e2de6dbc3 Add chapter on branch management.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
13
301
828f5606faf0 started branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 296
diff changeset
14 %Many software projects issue periodic ``major'' releases that contain
828f5606faf0 started branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 296
diff changeset
15 %substantial new features. In parallel, they may issue ``minor''
828f5606faf0 started branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 296
diff changeset
16 %releases. These are usually identical to the major releases off which
828f5606faf0 started branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 296
diff changeset
17 %they're based, but with a few bugs fixed.
828f5606faf0 started branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 296
diff changeset
18
828f5606faf0 started branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 296
diff changeset
19 $BB?$/$N%=%U%H%&%'%"%W%m%8%'%/%H$G$O!$?75!G=$r;}$D%a%8%c!<%j%j!<%9$rDj4|E*(B
828f5606faf0 started branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 296
diff changeset
20 $B$K%j%j!<%9$9$k!%JB9T$7$FB??t$N%^%$%J!<%j%j!<%9$b9T$J$o$l$k!%$3$l$i$O%a(B
828f5606faf0 started branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 296
diff changeset
21 $B%8%c!<%j%j!<%9$N%P%0$r=$@5$7$?$b$N$G$"$k!%(B
196
4237e45506ee Add early material describing tags.
Bryan O'Sullivan <bos@serpentine.com>
parents: 187
diff changeset
22
301
828f5606faf0 started branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 296
diff changeset
23 %In this chapter, we'll start by talking about how to keep records of
828f5606faf0 started branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 296
diff changeset
24 %project milestones such as releases. We'll then continue on to talk
828f5606faf0 started branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 296
diff changeset
25 %about the flow of work between different phases of a project, and how
828f5606faf0 started branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 296
diff changeset
26 %Mercurial can help you to isolate and manage this work.
828f5606faf0 started branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 296
diff changeset
27
828f5606faf0 started branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 296
diff changeset
28 $B$3$N>O$G$O$^$:%j%j!<%9$N$h$&$J%W%m%8%'%/%H$N%^%$%k%9%H!<%s$K8@5Z$9$k!%<!$$(B
828f5606faf0 started branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 296
diff changeset
29 $B$G%W%m%8%'%/%H$N3F%U%'!<%:$G$NN.$l$r@bL@$7!$(BMercurial$B$G$I$N$h$&$K6hJ,$1(B
828f5606faf0 started branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 296
diff changeset
30 $B$7!$4IM}$G$-$k$N$+$r@bL@$9$k!%(B
197
76697ae503db Local branches.
Bryan O'Sullivan <bos@serpentine.com>
parents: 196
diff changeset
31
296
89db0aaf6a29 translated chapter & section name within branch.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 293
diff changeset
32 %\section{Giving a persistent name to a revision}
89db0aaf6a29 translated chapter & section name within branch.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 293
diff changeset
33 \section{$B%j%S%8%g%s$K1JB3E*$JL>A0$rIU$1$k(B}
196
4237e45506ee Add early material describing tags.
Bryan O'Sullivan <bos@serpentine.com>
parents: 187
diff changeset
34
301
828f5606faf0 started branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 296
diff changeset
35 %Once you decide that you'd like to call a particular revision a
828f5606faf0 started branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 296
diff changeset
36 %``release'', it's a good idea to record the identity of that revision.
828f5606faf0 started branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 296
diff changeset
37 %This will let you reproduce that release at a later date, for whatever
828f5606faf0 started branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 296
diff changeset
38 %purpose you might need at the time (reproducing a bug, porting to a
828f5606faf0 started branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 296
diff changeset
39 %new platform, etc).
828f5606faf0 started branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 296
diff changeset
40 %\interaction{tag.init}
828f5606faf0 started branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 296
diff changeset
41
828f5606faf0 started branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 296
diff changeset
42 $B$"$k%j%S%8%g%s$r%j%j!<%9$H7h$a$?;~$K!$$3$l$r5-O?$7$F$*$/$N$ONI$$9M$($G$"(B
828f5606faf0 started branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 296
diff changeset
43 $B$k!%$3$l$O8eF|!$%P%0$N:F8=$d%=%U%H%&%'%"$N0\?"$J$I$NL\E*$G%j%j!<%9$r:F8=(B
828f5606faf0 started branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 296
diff changeset
44 $B$9$k$N$KLrN)$D!%(B
196
4237e45506ee Add early material describing tags.
Bryan O'Sullivan <bos@serpentine.com>
parents: 187
diff changeset
45 \interaction{tag.init}
4237e45506ee Add early material describing tags.
Bryan O'Sullivan <bos@serpentine.com>
parents: 187
diff changeset
46
301
828f5606faf0 started branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 296
diff changeset
47 %Mercurial lets you give a permanent name to any revision using the
828f5606faf0 started branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 296
diff changeset
48 %\hgcmd{tag} command. Not surprisingly, these names are called
828f5606faf0 started branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 296
diff changeset
49 %``tags''.
828f5606faf0 started branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 296
diff changeset
50 %\interaction{tag.tag}
828f5606faf0 started branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 296
diff changeset
51
828f5606faf0 started branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 296
diff changeset
52 $BFCDj$N%j%S%8%g%s$K(BMercurial$B$G1JB3E*$JL>A0$rIU$1$k$3$H$,$G$-$k!%$3$NL>A0(B
828f5606faf0 started branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 296
diff changeset
53 $B$O%?%0$H8F$P$l$k!%(B
196
4237e45506ee Add early material describing tags.
Bryan O'Sullivan <bos@serpentine.com>
parents: 187
diff changeset
54 \interaction{tag.tag}
4237e45506ee Add early material describing tags.
Bryan O'Sullivan <bos@serpentine.com>
parents: 187
diff changeset
55
301
828f5606faf0 started branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 296
diff changeset
56 %A tag is nothing more than a ``symbolic name'' for a revision. Tags
828f5606faf0 started branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 296
diff changeset
57 %exist purely for your convenience, so that you have a handy permanent
828f5606faf0 started branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 296
diff changeset
58 %way to refer to a revision; Mercurial doesn't interpret the tag names
828f5606faf0 started branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 296
diff changeset
59 %you use in any way.
828f5606faf0 started branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 296
diff changeset
60 %Neither does Mercurial place any restrictions on
828f5606faf0 started branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 296
diff changeset
61 %the name of a tag, beyond a few that are necessary to ensure that a
828f5606faf0 started branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 296
diff changeset
62 %tag can be parsed unambiguously. A tag name cannot contain any of the
828f5606faf0 started branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 296
diff changeset
63 %following characters:
828f5606faf0 started branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 296
diff changeset
64 %\begin{itemize}
828f5606faf0 started branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 296
diff changeset
65 %\item Colon (ASCII 58, ``\texttt{:}'')
828f5606faf0 started branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 296
diff changeset
66 %\item Carriage return (ASCII 13, ``\Verb+\r+'')
828f5606faf0 started branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 296
diff changeset
67 %\item Newline (ASCII 10, ``\Verb+\n+'')
828f5606faf0 started branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 296
diff changeset
68 %\end{itemize}
828f5606faf0 started branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 296
diff changeset
69
828f5606faf0 started branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 296
diff changeset
70 $B%?%0$O<B$N$H$3$m%j%S%8%g%s$KIU$1$i$l$?%7%s%\%j%C%/%M!<%`$KB>$J$i$J$$!%%?(B
828f5606faf0 started branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 296
diff changeset
71 $B%0$OC1$K%f!<%6$NJX59$N$?$a$KIU$1$i$l$k!%%?%0$OFCDj$N%j%S%8%g%s$r;2>H$9$k(B
828f5606faf0 started branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 296
diff changeset
72 $B$?$a$N<j7Z$G1JB3E*$JJ}K!$G!$(BMercurial$B$O%?%0$rK]Lu$7$J$$!%%?%0$NL>A0$K$O!$(B
828f5606faf0 started branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 296
diff changeset
73 $BL@3N$K%Q!<%9$9$k$?$a$N$$$/$D$+$N$b$N0J30$N@)8B$O$J$$!%%?%0%M!<%`$O0J2<$N(B
828f5606faf0 started branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 296
diff changeset
74 $BJ8;z$r4^$`$3$H$O$G$-$J$$!%(B
196
4237e45506ee Add early material describing tags.
Bryan O'Sullivan <bos@serpentine.com>
parents: 187
diff changeset
75 \begin{itemize}
301
828f5606faf0 started branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 296
diff changeset
76 \item $B%3%m%s(B (ASCII 58, ``\texttt{:}'')
828f5606faf0 started branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 296
diff changeset
77 \item $BI|5"J8;z(B (ASCII 13, ``\Verb+\r+'')
828f5606faf0 started branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 296
diff changeset
78 \item $B2~9TJ8;z(B (ASCII 10, ``\Verb+\n+'')
196
4237e45506ee Add early material describing tags.
Bryan O'Sullivan <bos@serpentine.com>
parents: 187
diff changeset
79 \end{itemize}
4237e45506ee Add early material describing tags.
Bryan O'Sullivan <bos@serpentine.com>
parents: 187
diff changeset
80
301
828f5606faf0 started branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 296
diff changeset
81
828f5606faf0 started branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 296
diff changeset
82 %You can use the \hgcmd{tags} command to display the tags present in
828f5606faf0 started branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 296
diff changeset
83 %your repository. In the output, each tagged revision is identified
828f5606faf0 started branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 296
diff changeset
84 %first by its name, then by revision number, and finally by the unique
828f5606faf0 started branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 296
diff changeset
85 %hash of the revision.
828f5606faf0 started branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 296
diff changeset
86 %\interaction{tag.tags}
828f5606faf0 started branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 296
diff changeset
87 %Notice that \texttt{tip} is listed in the output of \hgcmd{tags}. The
828f5606faf0 started branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 296
diff changeset
88 %\texttt{tip} tag is a special ``floating'' tag, which always
828f5606faf0 started branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 296
diff changeset
89 %identifies the newest revision in the repository.
828f5606faf0 started branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 296
diff changeset
90
828f5606faf0 started branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 296
diff changeset
91 \hgcmd{tags}$B%3%^%s%I$G%j%]%8%H%j$KB8:_$9$k%?%0$rI=<($9$k$3$H$,$G$-$k!%=P(B
828f5606faf0 started branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 296
diff changeset
92 $BNO$G$O!$%?%0IU$1$5$l$?%j%S%8%g%s$OL>A0!$%j%S%8%g%sHV9f!$8GM-$N%O%C%7%eCM(B
828f5606faf0 started branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 296
diff changeset
93 $B$N=g$K6hJL$5$l$k!%(B
196
4237e45506ee Add early material describing tags.
Bryan O'Sullivan <bos@serpentine.com>
parents: 187
diff changeset
94 \interaction{tag.tags}
301
828f5606faf0 started branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 296
diff changeset
95 \hgcmd{tags}$B$N=PNO$K(B\texttt{tip}$B$,4^$^$l$F$$$k$3$H$KCm0U!%(B\texttt{tip}$B%?(B
828f5606faf0 started branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 296
diff changeset
96 $B%0$O!$%j%]%8%H%j$NCf$G>o$K:G?7$N%j%S%8%g%s$KIU$1$i$l$F$$$kFCJL$J%U%m!<%F%#(B
828f5606faf0 started branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 296
diff changeset
97 $B%s%0%?%0$G$"$k!%(B
828f5606faf0 started branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 296
diff changeset
98
828f5606faf0 started branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 296
diff changeset
99 %In the output of the \hgcmd{tags} command, tags are listed in reverse
828f5606faf0 started branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 296
diff changeset
100 %order, by revision number. This usually means that recent tags are
828f5606faf0 started branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 296
diff changeset
101 %listed before older tags. It also means that \texttt{tip} is always
828f5606faf0 started branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 296
diff changeset
102 %going to be the first tag listed in the output of \hgcmd{tags}.
196
4237e45506ee Add early material describing tags.
Bryan O'Sullivan <bos@serpentine.com>
parents: 187
diff changeset
103
301
828f5606faf0 started branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 296
diff changeset
104 \hgcmd{tags}$B%3%^%s%I$N=PNO$K$*$$$F!$%?%0$O%j%S%8%g%sHV9f$K$h$C$F5U=g$GI=(B
828f5606faf0 started branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 296
diff changeset
105 $B<($5$l$F$$$k!%$3$l$K$h$C$F!$DL>o!$?7$7$$%?%0$,8E$$%?%0$h$j$bA0$KI=<($5$l(B
828f5606faf0 started branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 296
diff changeset
106 $B$k!%(B\texttt{tip}$B%?%0$O(B\hgcmd{tags}$B%3%^%s%I$N=PNO$N0lHV@hF,$KI=<($5$l$k!%(B
196
4237e45506ee Add early material describing tags.
Bryan O'Sullivan <bos@serpentine.com>
parents: 187
diff changeset
107
301
828f5606faf0 started branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 296
diff changeset
108 %When you run \hgcmd{log}, if it displays a revision that has tags
828f5606faf0 started branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 296
diff changeset
109 %associated with it, it will print those tags.
828f5606faf0 started branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 296
diff changeset
110 %\interaction{tag.log}
828f5606faf0 started branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 296
diff changeset
111
828f5606faf0 started branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 296
diff changeset
112 \hgcmd{log}$B%3%^%s%I$O%?%0$N7k$S$D$1$i$l$?%j%S%8%g%s$rI=<($9$k:]$K%?%0$b(B
828f5606faf0 started branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 296
diff changeset
113 $BI=<($9$k!%(B
196
4237e45506ee Add early material describing tags.
Bryan O'Sullivan <bos@serpentine.com>
parents: 187
diff changeset
114 \interaction{tag.log}
4237e45506ee Add early material describing tags.
Bryan O'Sullivan <bos@serpentine.com>
parents: 187
diff changeset
115
302
6a31e428ba3b more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 301
diff changeset
116 %Any time you need to provide a revision~ID to a Mercurial command, the
6a31e428ba3b more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 301
diff changeset
117 %command will accept a tag name in its place. Internally, Mercurial
6a31e428ba3b more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 301
diff changeset
118 %will translate your tag name into the corresponding revision~ID, then
6a31e428ba3b more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 301
diff changeset
119 %use that.
6a31e428ba3b more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 301
diff changeset
120 %\interaction{tag.log.v1.0}
6a31e428ba3b more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 301
diff changeset
121
6a31e428ba3b more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 301
diff changeset
122 Mecurial$B%3%^%s%I$K%j%S%8%g%sHV9f$rEO$9I,MW$,$"$k>l9g!$>o$K%?%0%M!<%`$r;H(B
6a31e428ba3b more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 301
diff changeset
123 $B$&$3$H$,$G$-$k!%FbItE*$K$O(BMercurial$B$O%?%0%M!<%`$rBP1~$9$k%j%S%8%g%s(BID$B$K(B
6a31e428ba3b more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 301
diff changeset
124 $BJQ49$7$F;HMQ$7$F$$$k!%(B
196
4237e45506ee Add early material describing tags.
Bryan O'Sullivan <bos@serpentine.com>
parents: 187
diff changeset
125 \interaction{tag.log.v1.0}
4237e45506ee Add early material describing tags.
Bryan O'Sullivan <bos@serpentine.com>
parents: 187
diff changeset
126
302
6a31e428ba3b more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 301
diff changeset
127 %There's no limit on the number of tags you can have in a repository, or
6a31e428ba3b more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 301
diff changeset
128 %on the number of tags that a single revision can have. As a practical
6a31e428ba3b more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 301
diff changeset
129 %matter, it's not a great idea to have ``too many'' (a number which will
6a31e428ba3b more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 301
diff changeset
130 %vary from project to project), simply because tags are supposed to help
6a31e428ba3b more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 301
diff changeset
131 %you to find revisions. If you have lots of tags, the ease of using them
6a31e428ba3b more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 301
diff changeset
132 %to identify revisions diminishes rapidly.
6a31e428ba3b more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 301
diff changeset
133
6a31e428ba3b more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 301
diff changeset
134 $B%j%]%8%H%j$NCf$G;H$($k%?%0?t!$0l$D$N%j%S%8%g%s$KIU$1$i$l$k%?%0?t$K>e8B$O(B
6a31e428ba3b more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 301
diff changeset
135 $B$J$$!%;v>p$O%W%m%8%'%/%H$K$h$C$F0[$J$k$@$m$&$,!$<BMQE*$K$O%?%0$rB?$/IU$1(B
6a31e428ba3b more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 301
diff changeset
136 $B$9$.$k$3$H$O$"$^$jNI$$9M$($H$O8@$($J$$!%%?%0$H$O%j%S%8%g%s$r8+$D$10W$/$9(B
6a31e428ba3b more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 301
diff changeset
137 $B$k$?$a$K;H$&$b$N$@$+$i$@!%%?%0$rB?$/IU$1$9$.$k$H!$%?%0$K$h$C$F%j%S%8%g%s(B
6a31e428ba3b more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 301
diff changeset
138 $B$N6hJL$r$9$k$3$H$,$H$?$s$KFq$7$/$J$k!%(B
196
4237e45506ee Add early material describing tags.
Bryan O'Sullivan <bos@serpentine.com>
parents: 187
diff changeset
139
302
6a31e428ba3b more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 301
diff changeset
140 %For example, if your project has milestones as frequent as every few
6a31e428ba3b more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 301
diff changeset
141 %days, it's perfectly reasonable to tag each one of those. But if you
6a31e428ba3b more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 301
diff changeset
142 %have a continuous build system that makes sure every revision can be
6a31e428ba3b more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 301
diff changeset
143 %built cleanly, you'd be introducing a lot of noise if you were to tag
6a31e428ba3b more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 301
diff changeset
144 %every clean build. Instead, you could tag failed builds (on the
6a31e428ba3b more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 301
diff changeset
145 %assumption that they're rare!), or simply not use tags to track
6a31e428ba3b more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 301
diff changeset
146 %buildability.
6a31e428ba3b more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 301
diff changeset
147
6a31e428ba3b more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 301
diff changeset
148 $BNc$($P$"$J$?$N%W%m%8%'%/%H$,?tF|Kh$K%^%$%k%9%H!<%s$r7^$($F$$$k>l9g!$$=$l(B
6a31e428ba3b more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 301
diff changeset
149 $B$>$l$K%?%0$rIU$1$k$3$H$OM}$KE,$C$F$$$k!%$7$+$7!$$=$l$>$l$N%j%S%8%g%s$,%/(B
6a31e428ba3b more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 301
diff changeset
150 $B%j!<%s$K%S%k%I$G$-$k$+8!>Z$9$k$?$a$N%S%k%I%7%9%F%`$r;}$C$F$$$k$h$&$J>l9g!$(B
6a31e428ba3b more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 301
diff changeset
151 $B$=$l$>$l$N%/%j!<%s%S%k%I$K%?%0$rIU$1$F$$$?$i<}=&$,$D$+$J$/$J$k$@$m$&!%$`(B
6a31e428ba3b more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 301
diff changeset
152 $B$7$m%S%k%I$,<:GT$9$k$3$H$,>/$J$$$N$G$"$l$P!$<:GT$7$?%j%S%8%g%s$K%?%0$r$D(B
6a31e428ba3b more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 301
diff changeset
153 $B$1$?J}$,NI$$$7!$C1$K%S%k%I$,DL$C$?$3$H$r<($9$N$K%?%0$rMQ$$$k$Y$-$G$O$J$$(B
6a31e428ba3b more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 301
diff changeset
154 $B$+$bCN$l$J$$!%(B
196
4237e45506ee Add early material describing tags.
Bryan O'Sullivan <bos@serpentine.com>
parents: 187
diff changeset
155
302
6a31e428ba3b more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 301
diff changeset
156 %If you want to remove a tag that you no longer want, use
6a31e428ba3b more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 301
diff changeset
157 %\hgcmdargs{tag}{--remove}.
6a31e428ba3b more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 301
diff changeset
158 %\interaction{tag.remove}
6a31e428ba3b more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 301
diff changeset
159 %You can also modify a tag at any time, so that it identifies a
6a31e428ba3b more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 301
diff changeset
160 %different revision, by simply issuing a new \hgcmd{tag} command.
6a31e428ba3b more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 301
diff changeset
161 %You'll have to use the \hgopt{tag}{-f} option to tell Mercurial that
6a31e428ba3b more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 301
diff changeset
162 %you \emph{really} want to update the tag.
6a31e428ba3b more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 301
diff changeset
163 %\interaction{tag.replace}
6a31e428ba3b more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 301
diff changeset
164 %There will still be a permanent record of the previous identity of the
6a31e428ba3b more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 301
diff changeset
165 %tag, but Mercurial will no longer use it. There's thus no penalty to
6a31e428ba3b more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 301
diff changeset
166 %tagging the wrong revision; all you have to do is turn around and tag
6a31e428ba3b more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 301
diff changeset
167 %the correct revision once you discover your error.
6a31e428ba3b more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 301
diff changeset
168
6a31e428ba3b more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 301
diff changeset
169 $B%?%0$,I,MW$J$/$J$C$?;~$O(B\hgcmdargs{tag}{--remove}$B%3%^%s%I$G>C$9$3$H$,$G(B
6a31e428ba3b more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 301
diff changeset
170 $B$-$k!%(B
196
4237e45506ee Add early material describing tags.
Bryan O'Sullivan <bos@serpentine.com>
parents: 187
diff changeset
171 \interaction{tag.remove}
302
6a31e428ba3b more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 301
diff changeset
172 $B%?%0$O$$$D$G$bJQ99$G$-$k$N$G!$$"$k%?%0$rB>$N%j%S%8%g%s$KIU$1BX$($k$h$&$J(B
6a31e428ba3b more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 301
diff changeset
173 $B$3$H$b$G$-$k!%(B
6a31e428ba3b more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 301
diff changeset
174 $B%?%0$r(B\emph{$BK\Ev(B}$B$K99?7$7$?$$>l9g$O(B\hgopt{tag}{-f}$B%*%W%7%g%s$r;XDj$9$kI,(B
6a31e428ba3b more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 301
diff changeset
175 $BMW$,$"$k!%(B
196
4237e45506ee Add early material describing tags.
Bryan O'Sullivan <bos@serpentine.com>
parents: 187
diff changeset
176 \interaction{tag.replace}
302
6a31e428ba3b more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 301
diff changeset
177 $B%?%0$N0JA0$N%"%$%G%s%F%#%F%#!<$N1JB3E*$J5-O?$O;D$C$F$$$k$,!$(BMercurial$B$O$b(B
6a31e428ba3b more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 301
diff changeset
178 $B$O$d$3$l$rMxMQ$7$J$$!%$h$C$F!$4V0c$C$?%j%S%8%g%s$K%?%0$rIU$1$k$3$H$G%Z%J(B
6a31e428ba3b more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 301
diff changeset
179 $B%k%F%#$,2]$;$i$l$k$H$$$&$3$H$O$J$$!%4V0c$$$r8+$D$1$?;~$OC1$K$d$jD>$7$F@5(B
6a31e428ba3b more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 301
diff changeset
180 $B$7$$%j%S%8%g%s$K%?%0$rIU$1$l$P$h$$!%(B
196
4237e45506ee Add early material describing tags.
Bryan O'Sullivan <bos@serpentine.com>
parents: 187
diff changeset
181
302
6a31e428ba3b more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 301
diff changeset
182 %Mercurial stores tags in a normal revision-controlled file in your
6a31e428ba3b more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 301
diff changeset
183 %repository.If you've created any tags, you'll find them in a file
6a31e428ba3b more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 301
diff changeset
184 %named \sfilename{.hgtags}.When you run the \hgcmd{tag} command,
6a31e428ba3b more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 301
diff changeset
185 %Mercurial modifies this file, then automatically commits the change to
6a31e428ba3b more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 301
diff changeset
186 %it.This means that every time you run \hgcmd{tag}, you'll see a
6a31e428ba3b more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 301
diff changeset
187 %corresponding changeset in the output of \hgcmd{log}.
6a31e428ba3b more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 301
diff changeset
188 %\interaction{tag.tip}
6a31e428ba3b more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 301
diff changeset
189
6a31e428ba3b more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 301
diff changeset
190 Mercurial$B$O%?%0$r%j%]%8%H%j$NCf$NDL>o$N%j%S%8%g%s4IM}%U%!%$%k$KJ]B8$9$k!%(B
6a31e428ba3b more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 301
diff changeset
191 $B%?%0$r:n@.$7$?;~!$(B\sfilename{.hgtags}$B$H$$$&%U%!%$%k$K%?%0$,J]B8$5$l$F$$(B
6a31e428ba3b more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 301
diff changeset
192 $B$k$N$,J,$+$k$@$m$&!%(B\hgcmd{tag}$B%3%^%s%I$r<B9T$9$k$H(BMercurial$B$O$3$N%U%!%$(B
6a31e428ba3b more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 301
diff changeset
193 $B%k$rJQ99$7!$JQ99$r$3$N%U%!%$%k$K%3%_%C%H$9$k!%$D$^$j(B\hgcmd{tag}$B$r<B9T$9(B
6a31e428ba3b more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 301
diff changeset
194 $B$k$H$$$D$b(B\hgcmd{log}$B$N=PNO$NCf$KBP1~$9$k%A%'%s%8%;%C%H$r8+$k$3$H$K$J$k!%(B
196
4237e45506ee Add early material describing tags.
Bryan O'Sullivan <bos@serpentine.com>
parents: 187
diff changeset
195 \interaction{tag.tip}
4237e45506ee Add early material describing tags.
Bryan O'Sullivan <bos@serpentine.com>
parents: 187
diff changeset
196
296
89db0aaf6a29 translated chapter & section name within branch.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 293
diff changeset
197 %\subsection{Handling tag conflicts during a merge}
89db0aaf6a29 translated chapter & section name within branch.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 293
diff changeset
198 \subsection{$B%^!<%8$N:]$K%?%0$N%3%s%U%j%/%H$r2r7h$9$k(B}
196
4237e45506ee Add early material describing tags.
Bryan O'Sullivan <bos@serpentine.com>
parents: 187
diff changeset
199
316
2052bee9f074 more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 302
diff changeset
200 %You won't often need to care about the \sfilename{.hgtags} file, but
2052bee9f074 more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 302
diff changeset
201 %it sometimes makes its presence known during a merge. The format of
2052bee9f074 more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 302
diff changeset
202 %the file is simple: it consists of a series of lines. Each line
2052bee9f074 more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 302
diff changeset
203 %starts with a changeset hash, followed by a space, followed by the
2052bee9f074 more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 302
diff changeset
204 %name of a tag.
2052bee9f074 more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 302
diff changeset
205
2052bee9f074 more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 302
diff changeset
206 \sfilename{.hgtags}$B$r5$$K$7$J$1$l$P$J$i$J$$$3$H$OB?$/$J$$$,!$%^!<%8$N:]$K(B
2052bee9f074 more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 302
diff changeset
207 $B$OB8:_$rL@$i$+$K$9$k!%%U%!%$%k%U%)!<%^%C%H$O%7%s%W%k$G!$0lO"$N9T$r4^$`$@(B
2052bee9f074 more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 302
diff changeset
208 $B$1$G$"$k!%$=$l$>$l$N9T$O%A%'%s%8%;%C%H$N%O%C%7%e$G;O$^$j!$(B1$B$D$N%9%Z!<%9(B
2052bee9f074 more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 302
diff changeset
209 $B$,B3$-!$%?%0$NL>>N$,B3$/!%(B
2052bee9f074 more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 302
diff changeset
210
2052bee9f074 more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 302
diff changeset
211 %If you're resolving a conflict in the \sfilename{.hgtags} file during
2052bee9f074 more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 302
diff changeset
212 %a merge, there's one twist to modifying the \sfilename{.hgtags} file:
2052bee9f074 more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 302
diff changeset
213 %when Mercurial is parsing the tags in a repository, it \emph{never}
2052bee9f074 more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 302
diff changeset
214 %reads the working copy of the \sfilename{.hgtags} file. Instead, it
2052bee9f074 more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 302
diff changeset
215 %reads the \emph{most recently committed} revision of the file.
196
4237e45506ee Add early material describing tags.
Bryan O'Sullivan <bos@serpentine.com>
parents: 187
diff changeset
216
316
2052bee9f074 more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 302
diff changeset
217 $B%^!<%8Cf$K(B\sfilename{.hgtags}$B%U%!%$%kFb$N%3%s%U%j%/%H$r2r7h$7$F$$$k>l9g!$(B
2052bee9f074 more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 302
diff changeset
218 \sfilename{.hgtags}$B$rJQ99$9$k0lG1$j$,$"$k!%(BMercurial$B$,%j%]%8%H%jCf$N%?%0(B
2052bee9f074 more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 302
diff changeset
219 $B$r%Q!<%9$9$k;~!$(BMercurial$B$O(B\sfilename{.hgtags}$B$N%o!<%-%s%0%3%T!<$r(B
2052bee9f074 more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 302
diff changeset
220 \emph{$B7h$7$F(B}$BFI$^$J$$!%$=$NBe$o$j(B\emph{$B:G$b?7$7$/%3%_%C%H$5$l$?(B}$B%j%S%8%g(B
2052bee9f074 more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 302
diff changeset
221 $B%s$rFI$`!%(B
196
4237e45506ee Add early material describing tags.
Bryan O'Sullivan <bos@serpentine.com>
parents: 187
diff changeset
222
316
2052bee9f074 more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 302
diff changeset
223 %An unfortunate consequence of this design is that you can't actually
2052bee9f074 more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 302
diff changeset
224 %verify that your merged \sfilename{.hgtags} file is correct until
2052bee9f074 more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 302
diff changeset
225 %\emph{after} you've committed a change. So if you find yourself
2052bee9f074 more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 302
diff changeset
226 %resolving a conflict on \sfilename{.hgtags} during a merge, be sure to
2052bee9f074 more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 302
diff changeset
227 %run \hgcmd{tags} after you commit.If it finds an error in the
2052bee9f074 more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 302
diff changeset
228 %\sfilename{.hgtags} file, it will report the location of the error,
2052bee9f074 more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 302
diff changeset
229 %which you can then fix and commit. You should then run \hgcmd{tags}
2052bee9f074 more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 302
diff changeset
230 %again, just to be sure that your fix is correct.
2052bee9f074 more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 302
diff changeset
231
317
0a551d1b44a6 more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 316
diff changeset
232 $B$3$N@_7W$N;DG0$J7k2L$O!$JQ99$r%3%_%C%H$7$?(B\emph{$B8e(B}$B$G$J$$$H%^!<%8$7$?(B
0a551d1b44a6 more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 316
diff changeset
233 \sfilename{.hgtags}$B%U%!%$%k$r<B:]$K$O%Y%j%U%!%$$G$-$J$$$3$H$G$"$k!%$=$N$?(B
0a551d1b44a6 more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 316
diff changeset
234 $B$a!$%^!<%8Cf$K(B\sfilename{.hgtags}$B$N%3%s%U%j%/%H2r7h$r$7$F$$$k>l9g$O!$%3%_%C(B
0a551d1b44a6 more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 316
diff changeset
235 $B%H8e$KK:$l$:(B\hgcmd{tags}$B$r<B9T$9$kI,MW$,$"$k!%(B\sfilename{.hgtags}$B$K%(%i!<(B
0a551d1b44a6 more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 316
diff changeset
236 $B$,8+$D$+$C$?>l9g!$%(%i!<$N$"$k>l=j$rJs9p$9$k!%$=$l$r8+$F=$@5$7!$%3%_%C%H(B
0a551d1b44a6 more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 316
diff changeset
237 $B$9$k$3$H$,$G$-$k!%$=$3$G(B\hgcmd{tags}$B$r:F$SAv$i$;!$=$@5$,@5$7$$$3$H$r3NG'(B
0a551d1b44a6 more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 316
diff changeset
238 $B$9$Y$-$G$"$k!%(B
316
2052bee9f074 more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 302
diff changeset
239
187
b60e2de6dbc3 Add chapter on branch management.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
240
296
89db0aaf6a29 translated chapter & section name within branch.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 293
diff changeset
241 %\subsection{Tags and cloning}
89db0aaf6a29 translated chapter & section name within branch.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 293
diff changeset
242 \subsection{$B%?%0$H%/%m!<%s(B}
198
615f3c6b30e1 Start to describe branch management.
Bryan O'Sullivan <bos@serpentine.com>
parents: 197
diff changeset
243
302
6a31e428ba3b more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 301
diff changeset
244 %You may have noticed that the \hgcmd{clone} command has a
6a31e428ba3b more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 301
diff changeset
245 %\hgopt{clone}{-r} option that lets you clone an exact copy of the
6a31e428ba3b more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 301
diff changeset
246 %repository as of a particular changeset.The new clone will not contain
6a31e428ba3b more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 301
diff changeset
247 %any project history that comes after the revision you specified. This
6a31e428ba3b more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 301
diff changeset
248 %has an interaction with tags that can surprise the unwary.
6a31e428ba3b more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 301
diff changeset
249
6a31e428ba3b more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 301
diff changeset
250 \hgcmd{clone}$B%3%^%s%I$,(B\hgopt{clone}{-r}$B%*%W%7%g%s$r;}$C$F$$$k$3$H$K$9$G(B
6a31e428ba3b more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 301
diff changeset
251 $B$K5$$E$$$F$$$k$+$bCN$l$J$$!%$3$N%*%W%7%g%s$GFCDj$N%A%'%s%8%;%C%H$N%3%T!<(B
6a31e428ba3b more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 301
diff changeset
252 $B$r%/%m!<%s$9$k$3$H$,$G$-$k$,!"%/%m!<%s$7$?%3%T!<$O!$;XDj$7$?%j%S%8%g%s8e(B
6a31e428ba3b more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 301
diff changeset
253 $B$NMzNr$r;}$?$J$$$?$a!"ITMQ?4$J%f!<%6$O$7$P$7$P6C$/$3$H$K$J$k!#(B
198
615f3c6b30e1 Start to describe branch management.
Bryan O'Sullivan <bos@serpentine.com>
parents: 197
diff changeset
254
317
0a551d1b44a6 more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 316
diff changeset
255 %Recall that a tag is stored as a revision to the \sfilename{.hgtags}
0a551d1b44a6 more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 316
diff changeset
256 %file, so that when you create a tag, the changeset in which it's
0a551d1b44a6 more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 316
diff changeset
257 %recorded necessarily refers to an older changeset.
0a551d1b44a6 more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 316
diff changeset
258 %When you run \hgcmdargs{clone}{-r foo} to clone a repository as of tag
0a551d1b44a6 more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 316
diff changeset
259 %\texttt{foo}, the new clone \emph{will not contain the history that
0a551d1b44a6 more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 316
diff changeset
260 %created the tag} that you used to clone the repository.
0a551d1b44a6 more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 316
diff changeset
261 %The resultis that you'll get exactly the right subset of the project's
0a551d1b44a6 more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 316
diff changeset
262 %history in the new repository, but \emph{not} the tag you might have
0a551d1b44a6 more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 316
diff changeset
263 %expected.
198
615f3c6b30e1 Start to describe branch management.
Bryan O'Sullivan <bos@serpentine.com>
parents: 197
diff changeset
264
317
0a551d1b44a6 more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 316
diff changeset
265 $B%?%0$O(B\sfilename{.hgtags}$B%U%!%$%kFb$N%j%S%8%g%s$H$7$F5-O?$5$l$F$$$k$3$H$r(B
0a551d1b44a6 more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 316
diff changeset
266 $B;W$$=P$7$FM_$7$$!%$3$N$?$a!$%?%0:n@.;~$K!$%?%0$,5-O?$5$l$F$$$k%A%'%s%8%;%C(B
0a551d1b44a6 more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 316
diff changeset
267 $B%H$+$i8E$$%A%'%s%8%;%C%H$X$N;2>H$,@8$8$k!%%?%0(B\texttt{foo}$B$,IU$$$F$$$k%j(B
0a551d1b44a6 more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 316
diff changeset
268 $B%]%8%H%j$r%/%m!<%s$9$k$?$a$K(B\hgcmdargs{clone}{-r foo}$B<B9T$9$k;~!$?7$7$$%/(B
0a551d1b44a6 more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 316
diff changeset
269 $B%m!<%s$O%?%0$r@8@.$7$?MzNr$r(B\emph{$B4^$^$J$$(B}$B!%7k2L$H$7$F!$?7$7$$%j%]%8%H%j(B
0a551d1b44a6 more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 316
diff changeset
270 $B$K4^$^$l$kMzNr$O!$%W%m%8%'%/%HMzNr$N%5%V%;%C%H$K$J$j!$%?%0$O4^$^$l$J$$!%(B
316
2052bee9f074 more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 302
diff changeset
271
2052bee9f074 more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 302
diff changeset
272
296
89db0aaf6a29 translated chapter & section name within branch.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 293
diff changeset
273 %\subsection{When permanent tags are too much}
89db0aaf6a29 translated chapter & section name within branch.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 293
diff changeset
274 \subsection{$B1J5W%?%0$,I,MW$G$J$$>l9g(B}
197
76697ae503db Local branches.
Bryan O'Sullivan <bos@serpentine.com>
parents: 196
diff changeset
275
317
0a551d1b44a6 more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 316
diff changeset
276 %Since Mercurial's tags are revision controlled and carried around with
0a551d1b44a6 more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 316
diff changeset
277 %a project's history, everyone you work with will see the tags you
0a551d1b44a6 more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 316
diff changeset
278 %create. But giving names to revisions has uses beyond simply noting
0a551d1b44a6 more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 316
diff changeset
279 %that revision \texttt{4237e45506ee} is really \texttt{v2.0.2}. If
0a551d1b44a6 more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 316
diff changeset
280 %you're trying to track down a subtle bug, you might want a tag to
0a551d1b44a6 more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 316
diff changeset
281 %remind you of something like ``Anne saw the symptoms with this
0a551d1b44a6 more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 316
diff changeset
282 %revision''.
0a551d1b44a6 more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 316
diff changeset
283
0a551d1b44a6 more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 316
diff changeset
284 Mercurial$B$N%?%0$O%j%S%8%g%s%3%s%H%m!<%k$5$l!$%W%m%8%'%/%HMzNr$KIU?o$7$F$$(B
0a551d1b44a6 more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 316
diff changeset
285 $B$k$?$a!$F1$8%W%m%8%'%/%H$GF/$/?M$O3'%?%0$rCN$k$3$H$K$J$k!%%j%S%8%g%s$KL>(B
0a551d1b44a6 more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 316
diff changeset
286 $BA0$rIU$1$k$3$H$O!$C1$K%j%S%8%g%s(B\texttt{4237e45506ee}$B$,%P!<%8%g%s(B
0a551d1b44a6 more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 316
diff changeset
287 \texttt{v2.0.2}$B$G$"$k$H5-=R$9$k0J>e$N0UL#$r;}$D!%$b$7%P%0$rDI@W$7$F$$$k$J(B
0a551d1b44a6 more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 316
diff changeset
288 $B$i!$(B``Anne saw the symptoms with this revision''$B!J%"%s$O$3$N%j%S%8%g%s$G(B
0a551d1b44a6 more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 316
diff changeset
289 $B>I>u$r8+$?!K$J$I$N%?%0$rIU$1$?$/$J$k$@$m$&!%(B
197
76697ae503db Local branches.
Bryan O'Sullivan <bos@serpentine.com>
parents: 196
diff changeset
290
317
0a551d1b44a6 more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 316
diff changeset
291 %For cases like this, what you might want to use are \emph{local} tags.
0a551d1b44a6 more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 316
diff changeset
292 %You can create a local tag with the \hgopt{tag}{-l} option to the
0a551d1b44a6 more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 316
diff changeset
293 %\hgcmd{tag} command. This will store the tag in a file called
0a551d1b44a6 more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 316
diff changeset
294 %\sfilename{.hg/localtags}. Unlike \sfilename{.hgtags},
0a551d1b44a6 more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 316
diff changeset
295 %\sfilename{.hg/localtags} is not revision controlled. Any tags you
0a551d1b44a6 more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 316
diff changeset
296 %create using \hgopt{tag}{-l} remain strictly local to the repository
0a551d1b44a6 more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 316
diff changeset
297 %you're currently working in.
0a551d1b44a6 more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 316
diff changeset
298
0a551d1b44a6 more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 316
diff changeset
299 $B$3$N$h$&$J>l9g!$(B\emph{$B%m!<%+%k(B}$B%?%0$r;H$$$?$/$J$k$O$:$@!%%m!<%+%k%?%0$O(B
0a551d1b44a6 more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 316
diff changeset
300 \hgcmd{tag}$B%3%^%s%I$r(B\hgopt{tag}{-l}$B%*%W%7%g%sIU$-$G;H$&$3$H$G:n@.$G$-$k!%(B
0a551d1b44a6 more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 316
diff changeset
301 $B$3$N%*%W%7%g%s$r;H$&$H!$%?%0$O(B\sfilename{.hg/localtags}$B$H$$$&%U%!%$%k$KJ](B
0a551d1b44a6 more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 316
diff changeset
302 $BB8$5$l$k!%(B\sfilename{.hgtags}$B$H0c$C$F!$(B\sfilename{.hg/localtags}$B$O%j%S%8%g(B
0a551d1b44a6 more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 316
diff changeset
303 $B%s%3%s%H%m!<%k$5$l$J$$!%(B\hgopt{tag}{-l}$B%*%W%7%g%s$G:n@.$7$?$"$i$f$k%?%0(B
0a551d1b44a6 more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 316
diff changeset
304 $B$O87L)$K%m!<%+%k$K4IM}$5$l!$:#:n6H$7$F$$$k$m%]%8<h$j$K$O0l@ZH?1G$5$l$J$$!%(B
0a551d1b44a6 more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 316
diff changeset
305
197
76697ae503db Local branches.
Bryan O'Sullivan <bos@serpentine.com>
parents: 196
diff changeset
306
296
89db0aaf6a29 translated chapter & section name within branch.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 293
diff changeset
307 %\section{The flow of changes---big picture vs. little}
89db0aaf6a29 translated chapter & section name within branch.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 293
diff changeset
308 \section{$B99?7$NN.$l(B---$BBg6IE*(B vs.$B6I=jE*(B}
198
615f3c6b30e1 Start to describe branch management.
Bryan O'Sullivan <bos@serpentine.com>
parents: 197
diff changeset
309
317
0a551d1b44a6 more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 316
diff changeset
310 %To return to the outline I sketched at the beginning of a chapter,
0a551d1b44a6 more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 316
diff changeset
311 %let's think about a project that has multiple concurrent pieces of
0a551d1b44a6 more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 316
diff changeset
312 %work under development at once.
0a551d1b44a6 more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 316
diff changeset
313
0a551d1b44a6 more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 316
diff changeset
314 $B$3$N>O$N:G=i$G<($7$?%"%&%H%i%$%s$KLa$k$?$a$K!$%W%m%8%'%/%H$,3+H/Cf!$0lEY(B
0a551d1b44a6 more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 316
diff changeset
315 $B$KJ#?t$NJB9T$7$?ItJ,$r;}$D$H9M$($h$&!%(B
198
615f3c6b30e1 Start to describe branch management.
Bryan O'Sullivan <bos@serpentine.com>
parents: 197
diff changeset
316
317
0a551d1b44a6 more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 316
diff changeset
317 %There might be a push for a new ``main'' release; a new minor bugfix
0a551d1b44a6 more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 316
diff changeset
318 %release to the last main release; and an unexpected ``hot fix'' to an
0a551d1b44a6 more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 316
diff changeset
319 %old release that is now in maintenance mode.
0a551d1b44a6 more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 316
diff changeset
320
0a551d1b44a6 more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 316
diff changeset
321 $B?7$7$$(B``main''$B$r%j%j!<%9$9$k>u67$G!$:G?7$N%a%$%s%j%j!<%9$KBP$9$k?7$7$$>.(B
0a551d1b44a6 more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 316
diff changeset
322 $B5,LO$J%P%0%U%#%C%/%9%j%j!<%9$H4{$K%a%s%F%J%s%9%b!<%I$K$J$C$F$$$k8E$$%j%j!<(B
0a551d1b44a6 more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 316
diff changeset
323 $B%98~$1$NM=4|$;$L(B``hot fix'' $B$r%j%j!<%9$9$k>u67$r9M$($k!%(B
0a551d1b44a6 more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 316
diff changeset
324
198
615f3c6b30e1 Start to describe branch management.
Bryan O'Sullivan <bos@serpentine.com>
parents: 197
diff changeset
325
317
0a551d1b44a6 more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 316
diff changeset
326 %The usual way people refer to these different concurrent directions of
0a551d1b44a6 more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 316
diff changeset
327 %development is as ``branches''. However, we've already seen numerous
0a551d1b44a6 more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 316
diff changeset
328 %times that Mercurial treats \emph{all of history} as a series of
0a551d1b44a6 more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 316
diff changeset
329 %branches and merges. Really, what we have here is two ideas that are
0a551d1b44a6 more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 316
diff changeset
330 %peripherally related, but which happen to share a name.
0a551d1b44a6 more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 316
diff changeset
331 %\begin{itemize}
0a551d1b44a6 more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 316
diff changeset
332 %\item ``Big picture'' branches represent the sweep of a project's
0a551d1b44a6 more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 316
diff changeset
333 % evolution; people give them names, and talk about them in
0a551d1b44a6 more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 316
diff changeset
334 % conversation.
0a551d1b44a6 more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 316
diff changeset
335 %\item ``Little picture'' branches are artefacts of the day-to-day
0a551d1b44a6 more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 316
diff changeset
336 % activity of developing and merging changes. They expose the
0a551d1b44a6 more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 316
diff changeset
337 % narrative of how the code was developed.
0a551d1b44a6 more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 316
diff changeset
338 %\end{itemize}
0a551d1b44a6 more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 316
diff changeset
339
0a551d1b44a6 more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 316
diff changeset
340 $B?M!9$,!$0[$J$C$?JB9TE*$J3+H/$NJ}8~@-$K$D$$$F?($l$k;~$O!$(B``$B%V%i%s%A(B''$B$H$7(B
0a551d1b44a6 more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 316
diff changeset
341 $B$F8@5Z$9$k!%$7$+$7!$4{$K4vEY$H$J$/(BMercurial$B$,(B\emph{$BA4$F$NMzNr(B}$B$r0lO"$N%V(B
0a551d1b44a6 more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 316
diff changeset
342 $B%i%s%A$H%^!<%8$H$7$F<h$j07$C$F$$$k$N$r8+$F$-$?!%$3$3$G$O!$$o$:$+$K4XO"$7(B
0a551d1b44a6 more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 316
diff changeset
343 $B$F$$$k$,L>A0$r6&M-$7$F$$$k(B2$B$D$N%"%$%G%#%"$r9M$($k!%(B
198
615f3c6b30e1 Start to describe branch management.
Bryan O'Sullivan <bos@serpentine.com>
parents: 197
diff changeset
344 \begin{itemize}
317
0a551d1b44a6 more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 316
diff changeset
345 \item ``Big picture''$B%V%i%s%A$O%W%m%8%'%/%H$N?J2=$rI=$9!%3+H/<T$O$3$l$i(B
0a551d1b44a6 more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 316
diff changeset
346 $B$KL>A0$rM?$(!$2qOC$GMQ$$$k!%(B
0a551d1b44a6 more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 316
diff changeset
347 \item ``Little picture''$B%V%i%s%A$OF|!9$N3+H/$H%^!<%8$N=j;:$G!$%3!<%I$,$I(B
0a551d1b44a6 more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 316
diff changeset
348 $B$N$h$&$K3+H/$5$l$?$+$r<($9$b$N$G$"$k!%(B
198
615f3c6b30e1 Start to describe branch management.
Bryan O'Sullivan <bos@serpentine.com>
parents: 197
diff changeset
349 \end{itemize}
615f3c6b30e1 Start to describe branch management.
Bryan O'Sullivan <bos@serpentine.com>
parents: 197
diff changeset
350
296
89db0aaf6a29 translated chapter & section name within branch.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 293
diff changeset
351 %\section{Managing big-picture branches in repositories}
89db0aaf6a29 translated chapter & section name within branch.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 293
diff changeset
352 \section{$B%j%]%8%H%j4V$G$NBg6IE*%V%i%s%A$N4IM}(B}
198
615f3c6b30e1 Start to describe branch management.
Bryan O'Sullivan <bos@serpentine.com>
parents: 197
diff changeset
353
317
0a551d1b44a6 more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 316
diff changeset
354 %The easiest way to isolate a ``big picture'' branch in Mercurial is in
0a551d1b44a6 more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 316
diff changeset
355 %a dedicated repository. If you have an existing shared
0a551d1b44a6 more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 316
diff changeset
356 %repository---let's call it \texttt{myproject}---that reaches a ``1.0''
0a551d1b44a6 more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 316
diff changeset
357 %milestone, you can start to prepare for future maintenance releases on
0a551d1b44a6 more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 316
diff changeset
358 %top of version~1.0 by tagging the revision from which you prepared
0a551d1b44a6 more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 316
diff changeset
359 %the~1.0 release.
0a551d1b44a6 more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 316
diff changeset
360 %\interaction{branch-repo.tag}
0a551d1b44a6 more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 316
diff changeset
361 %You can then clone a new shared \texttt{myproject-1.0.1} repository as
0a551d1b44a6 more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 316
diff changeset
362 %of that tag.
0a551d1b44a6 more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 316
diff changeset
363 %\interaction{branch-repo.clone}
0a551d1b44a6 more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 316
diff changeset
364
0a551d1b44a6 more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 316
diff changeset
365 Mercurial$B$G(B``bit picture''$B$r3VN%$9$k:G$b4JC1$JJ}K!$O!$@lMQ$N%j%]%8%H%j$r(B
0a551d1b44a6 more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 316
diff changeset
366 $BMQ0U$9$k$3$H$G$"$k!%$b$70l$D$N6&M-%j%]%8%H%j$r;}$C$F$$$k>l9g!$$3$l$r(B
0a551d1b44a6 more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 316
diff changeset
367 \texttt{myproject}$B$H8F$V$3$H$K$7$k!%$3$l$,(B``1.0''$B%^%$%k%9%H!<%s$KE~C#$7$?(B
0a551d1b44a6 more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 316
diff changeset
368 $B$i!$(B1.0$B$K(B1.0$B%j%j!<%9$H%?%0$rIU$1!$>-Mh$N%a%s%F%J%s%9%j%j!<%9$KHw$($k$3$H(B
0a551d1b44a6 more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 316
diff changeset
369 $B$,$G$-$k!%(B
198
615f3c6b30e1 Start to describe branch management.
Bryan O'Sullivan <bos@serpentine.com>
parents: 197
diff changeset
370 \interaction{branch-repo.tag}
317
0a551d1b44a6 more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 316
diff changeset
371 $B$=$7$F?7$?$K(B\texttt{myproject-1.0.1}$B$H%?%0$rIU$1$F%j%]%8%H%j$r%/%m!<%s$9(B
0a551d1b44a6 more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 316
diff changeset
372 $B$k!%(B
198
615f3c6b30e1 Start to describe branch management.
Bryan O'Sullivan <bos@serpentine.com>
parents: 197
diff changeset
373 \interaction{branch-repo.clone}
615f3c6b30e1 Start to describe branch management.
Bryan O'Sullivan <bos@serpentine.com>
parents: 197
diff changeset
374
317
0a551d1b44a6 more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 316
diff changeset
375 %Afterwards, if someone needs to work on a bug fix that ought to go
0a551d1b44a6 more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 316
diff changeset
376 %into an upcoming~1.0.1 minor release, they clone the
0a551d1b44a6 more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 316
diff changeset
377 %\texttt{myproject-1.0.1} repository, make their changes, and push them
0a551d1b44a6 more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 316
diff changeset
378 %back.
0a551d1b44a6 more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 316
diff changeset
379 %\interaction{branch-repo.bugfix}
0a551d1b44a6 more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 316
diff changeset
380 %Meanwhile, development for the next major release can continue,
0a551d1b44a6 more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 316
diff changeset
381 %isolated and unabated, in the \texttt{myproject} repository.
0a551d1b44a6 more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 316
diff changeset
382 %\interaction{branch-repo.new}
0a551d1b44a6 more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 316
diff changeset
383
0a551d1b44a6 more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 316
diff changeset
384 $B0J8e!$%P%0%U%#%C%/%9$r$7$?$$?M$O(B1.0.1$B%^%$%J!<%j%j!<%9$X$$$/$Y$-$G$"$k!%(B
0a551d1b44a6 more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 316
diff changeset
385 $BH`$i$O(B\texttt{myproject-1.0.1}$B%j%]%8%H%j$r%/%m!<%s$7!$JQ99$r2C$(!$%W%C%7%e(B
0a551d1b44a6 more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 316
diff changeset
386 $B$9$k!%(B
198
615f3c6b30e1 Start to describe branch management.
Bryan O'Sullivan <bos@serpentine.com>
parents: 197
diff changeset
387 \interaction{branch-repo.bugfix}
317
0a551d1b44a6 more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 316
diff changeset
388 $B0lJ}$G<!$N%a%8%c!<%j%j!<%9$K8~$1$F$N3+H/$O!$(B\texttt{myproject}$B%j%]%8%H%j(B
0a551d1b44a6 more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 316
diff changeset
389 $B$NCf$G3VN%$5$l!$BZ$k;v$J$/7QB3$9$k$3$H$,2DG=$G$"$k!%(B
198
615f3c6b30e1 Start to describe branch management.
Bryan O'Sullivan <bos@serpentine.com>
parents: 197
diff changeset
390 \interaction{branch-repo.new}
615f3c6b30e1 Start to describe branch management.
Bryan O'Sullivan <bos@serpentine.com>
parents: 197
diff changeset
391
296
89db0aaf6a29 translated chapter & section name within branch.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 293
diff changeset
392 %\section{Don't repeat yourself: merging across branches}
302
6a31e428ba3b more branch.tex
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 301
diff changeset
393 \section{$B<j$G7+$jJV$9$Y$-$G$O$J$$!'%V%i%s%A4V$G$N%^!<%8(B}
198
615f3c6b30e1 Start to describe branch management.
Bryan O'Sullivan <bos@serpentine.com>
parents: 197
diff changeset
394
199
58e3a6c76725 More branch/merge stuff.
Bryan O'Sullivan <bos@serpentine.com>
parents: 198
diff changeset
395 In many cases, if you have a bug to fix on a maintenance branch, the
58e3a6c76725 More branch/merge stuff.
Bryan O'Sullivan <bos@serpentine.com>
parents: 198
diff changeset
396 chances are good that the bug exists on your project's main branch
58e3a6c76725 More branch/merge stuff.
Bryan O'Sullivan <bos@serpentine.com>
parents: 198
diff changeset
397 (and possibly other maintenance branches, too). It's a rare developer
58e3a6c76725 More branch/merge stuff.
Bryan O'Sullivan <bos@serpentine.com>
parents: 198
diff changeset
398 who wants to fix the same bug multiple times, so let's look at a few
58e3a6c76725 More branch/merge stuff.
Bryan O'Sullivan <bos@serpentine.com>
parents: 198
diff changeset
399 ways that Mercurial can help you to manage these bugfixes without
58e3a6c76725 More branch/merge stuff.
Bryan O'Sullivan <bos@serpentine.com>
parents: 198
diff changeset
400 duplicating your work.
58e3a6c76725 More branch/merge stuff.
Bryan O'Sullivan <bos@serpentine.com>
parents: 198
diff changeset
401
58e3a6c76725 More branch/merge stuff.
Bryan O'Sullivan <bos@serpentine.com>
parents: 198
diff changeset
402 In the simplest instance, all you need to do is pull changes from your
58e3a6c76725 More branch/merge stuff.
Bryan O'Sullivan <bos@serpentine.com>
parents: 198
diff changeset
403 maintenance branch into your local clone of the target branch.
58e3a6c76725 More branch/merge stuff.
Bryan O'Sullivan <bos@serpentine.com>
parents: 198
diff changeset
404 \interaction{branch-repo.pull}
58e3a6c76725 More branch/merge stuff.
Bryan O'Sullivan <bos@serpentine.com>
parents: 198
diff changeset
405 You'll then need to merge the heads of the two branches, and push back
58e3a6c76725 More branch/merge stuff.
Bryan O'Sullivan <bos@serpentine.com>
parents: 198
diff changeset
406 to the main branch.
58e3a6c76725 More branch/merge stuff.
Bryan O'Sullivan <bos@serpentine.com>
parents: 198
diff changeset
407 \interaction{branch-repo.merge}
197
76697ae503db Local branches.
Bryan O'Sullivan <bos@serpentine.com>
parents: 196
diff changeset
408
296
89db0aaf6a29 translated chapter & section name within branch.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 293
diff changeset
409 %\section{Naming branches within one repository}
89db0aaf6a29 translated chapter & section name within branch.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 293
diff changeset
410 \section{1$B$D$N%j%]%8%H%jFb$G$N%V%i%s%A$NL?L>(B}
202
6f167e644762 Start writing about named branches.
Bryan O'Sullivan <bos@serpentine.com>
parents: 199
diff changeset
411
6f167e644762 Start writing about named branches.
Bryan O'Sullivan <bos@serpentine.com>
parents: 199
diff changeset
412 In most instances, isolating branches in repositories is the right
6f167e644762 Start writing about named branches.
Bryan O'Sullivan <bos@serpentine.com>
parents: 199
diff changeset
413 approach. Its simplicity makes it easy to understand; and so it's
6f167e644762 Start writing about named branches.
Bryan O'Sullivan <bos@serpentine.com>
parents: 199
diff changeset
414 hard to make mistakes. There's a one-to-one relationship between
6f167e644762 Start writing about named branches.
Bryan O'Sullivan <bos@serpentine.com>
parents: 199
diff changeset
415 branches you're working in and directories on your system. This lets
6f167e644762 Start writing about named branches.
Bryan O'Sullivan <bos@serpentine.com>
parents: 199
diff changeset
416 you use normal (non-Mercurial-aware) tools to work on files within a
6f167e644762 Start writing about named branches.
Bryan O'Sullivan <bos@serpentine.com>
parents: 199
diff changeset
417 branch/repository.
6f167e644762 Start writing about named branches.
Bryan O'Sullivan <bos@serpentine.com>
parents: 199
diff changeset
418
6f167e644762 Start writing about named branches.
Bryan O'Sullivan <bos@serpentine.com>
parents: 199
diff changeset
419 If you're more in the ``power user'' category (\emph{and} your
6f167e644762 Start writing about named branches.
Bryan O'Sullivan <bos@serpentine.com>
parents: 199
diff changeset
420 collaborators are too), there is an alternative way of handling
6f167e644762 Start writing about named branches.
Bryan O'Sullivan <bos@serpentine.com>
parents: 199
diff changeset
421 branches that you can consider. I've already mentioned the
6f167e644762 Start writing about named branches.
Bryan O'Sullivan <bos@serpentine.com>
parents: 199
diff changeset
422 human-level distinction between ``small picture'' and ``big picture''
6f167e644762 Start writing about named branches.
Bryan O'Sullivan <bos@serpentine.com>
parents: 199
diff changeset
423 branches. While Mercurial works with multiple ``small picture''
6f167e644762 Start writing about named branches.
Bryan O'Sullivan <bos@serpentine.com>
parents: 199
diff changeset
424 branches in a repository all the time (for example after you pull
6f167e644762 Start writing about named branches.
Bryan O'Sullivan <bos@serpentine.com>
parents: 199
diff changeset
425 changes in, but before you merge them), it can \emph{also} work with
6f167e644762 Start writing about named branches.
Bryan O'Sullivan <bos@serpentine.com>
parents: 199
diff changeset
426 multiple ``big picture'' branches.
6f167e644762 Start writing about named branches.
Bryan O'Sullivan <bos@serpentine.com>
parents: 199
diff changeset
427
6f167e644762 Start writing about named branches.
Bryan O'Sullivan <bos@serpentine.com>
parents: 199
diff changeset
428 The key to working this way is that Mercurial lets you assign a
6f167e644762 Start writing about named branches.
Bryan O'Sullivan <bos@serpentine.com>
parents: 199
diff changeset
429 persistent \emph{name} to a branch. There always exists a branch
6f167e644762 Start writing about named branches.
Bryan O'Sullivan <bos@serpentine.com>
parents: 199
diff changeset
430 named \texttt{default}. Even before you start naming branches
6f167e644762 Start writing about named branches.
Bryan O'Sullivan <bos@serpentine.com>
parents: 199
diff changeset
431 yourself, you can find traces of the \texttt{default} branch if you
6f167e644762 Start writing about named branches.
Bryan O'Sullivan <bos@serpentine.com>
parents: 199
diff changeset
432 look for them.
6f167e644762 Start writing about named branches.
Bryan O'Sullivan <bos@serpentine.com>
parents: 199
diff changeset
433
6f167e644762 Start writing about named branches.
Bryan O'Sullivan <bos@serpentine.com>
parents: 199
diff changeset
434 As an example, when you run the \hgcmd{commit} command, and it pops up
6f167e644762 Start writing about named branches.
Bryan O'Sullivan <bos@serpentine.com>
parents: 199
diff changeset
435 your editor so that you can enter a commit message, look for a line
6f167e644762 Start writing about named branches.
Bryan O'Sullivan <bos@serpentine.com>
parents: 199
diff changeset
436 that contains the text ``\texttt{HG: branch default}'' at the bottom.
6f167e644762 Start writing about named branches.
Bryan O'Sullivan <bos@serpentine.com>
parents: 199
diff changeset
437 This is telling you that your commit will occur on the branch named
6f167e644762 Start writing about named branches.
Bryan O'Sullivan <bos@serpentine.com>
parents: 199
diff changeset
438 \texttt{default}.
6f167e644762 Start writing about named branches.
Bryan O'Sullivan <bos@serpentine.com>
parents: 199
diff changeset
439
6f167e644762 Start writing about named branches.
Bryan O'Sullivan <bos@serpentine.com>
parents: 199
diff changeset
440 To start working with named branches, use the \hgcmd{branches}
6f167e644762 Start writing about named branches.
Bryan O'Sullivan <bos@serpentine.com>
parents: 199
diff changeset
441 command. This command lists the named branches already present in
203
d7615e15510f More about named branches, and early use of them.
Bryan O'Sullivan <bos@serpentine.com>
parents: 202
diff changeset
442 your repository, telling you which changeset is the tip of each.
202
6f167e644762 Start writing about named branches.
Bryan O'Sullivan <bos@serpentine.com>
parents: 199
diff changeset
443 \interaction{branch-named.branches}
203
d7615e15510f More about named branches, and early use of them.
Bryan O'Sullivan <bos@serpentine.com>
parents: 202
diff changeset
444 Since you haven't created any named branches yet, the only one that
d7615e15510f More about named branches, and early use of them.
Bryan O'Sullivan <bos@serpentine.com>
parents: 202
diff changeset
445 exists is \texttt{default}.
d7615e15510f More about named branches, and early use of them.
Bryan O'Sullivan <bos@serpentine.com>
parents: 202
diff changeset
446
d7615e15510f More about named branches, and early use of them.
Bryan O'Sullivan <bos@serpentine.com>
parents: 202
diff changeset
447 To find out what the ``current'' branch is, run the \hgcmd{branch}
d7615e15510f More about named branches, and early use of them.
Bryan O'Sullivan <bos@serpentine.com>
parents: 202
diff changeset
448 command, giving it no arguments. This tells you what branch the
d7615e15510f More about named branches, and early use of them.
Bryan O'Sullivan <bos@serpentine.com>
parents: 202
diff changeset
449 parent of the current changeset is on.
d7615e15510f More about named branches, and early use of them.
Bryan O'Sullivan <bos@serpentine.com>
parents: 202
diff changeset
450 \interaction{branch-named.branch}
d7615e15510f More about named branches, and early use of them.
Bryan O'Sullivan <bos@serpentine.com>
parents: 202
diff changeset
451
d7615e15510f More about named branches, and early use of them.
Bryan O'Sullivan <bos@serpentine.com>
parents: 202
diff changeset
452 To create a new branch, run the \hgcmd{branch} command again. This
d7615e15510f More about named branches, and early use of them.
Bryan O'Sullivan <bos@serpentine.com>
parents: 202
diff changeset
453 time, give it one argument: the name of the branch you want to create.
d7615e15510f More about named branches, and early use of them.
Bryan O'Sullivan <bos@serpentine.com>
parents: 202
diff changeset
454 \interaction{branch-named.create}
d7615e15510f More about named branches, and early use of them.
Bryan O'Sullivan <bos@serpentine.com>
parents: 202
diff changeset
455
d7615e15510f More about named branches, and early use of them.
Bryan O'Sullivan <bos@serpentine.com>
parents: 202
diff changeset
456 After you've created a branch, you might wonder what effect the
d7615e15510f More about named branches, and early use of them.
Bryan O'Sullivan <bos@serpentine.com>
parents: 202
diff changeset
457 \hgcmd{branch} command has had. What do the \hgcmd{status} and
d7615e15510f More about named branches, and early use of them.
Bryan O'Sullivan <bos@serpentine.com>
parents: 202
diff changeset
458 \hgcmd{tip} commands report?
d7615e15510f More about named branches, and early use of them.
Bryan O'Sullivan <bos@serpentine.com>
parents: 202
diff changeset
459 \interaction{branch-named.status}
d7615e15510f More about named branches, and early use of them.
Bryan O'Sullivan <bos@serpentine.com>
parents: 202
diff changeset
460 Nothing has changed in the working directory, and there's been no new
d7615e15510f More about named branches, and early use of them.
Bryan O'Sullivan <bos@serpentine.com>
parents: 202
diff changeset
461 history created. As this suggests, running the \hgcmd{branch} command
d7615e15510f More about named branches, and early use of them.
Bryan O'Sullivan <bos@serpentine.com>
parents: 202
diff changeset
462 has no permanent effect; it only tells Mercurial what branch name to
d7615e15510f More about named branches, and early use of them.
Bryan O'Sullivan <bos@serpentine.com>
parents: 202
diff changeset
463 use the \emph{next} time you commit a changeset.
d7615e15510f More about named branches, and early use of them.
Bryan O'Sullivan <bos@serpentine.com>
parents: 202
diff changeset
464
d7615e15510f More about named branches, and early use of them.
Bryan O'Sullivan <bos@serpentine.com>
parents: 202
diff changeset
465 When you commit a change, Mercurial records the name of the branch on
d7615e15510f More about named branches, and early use of them.
Bryan O'Sullivan <bos@serpentine.com>
parents: 202
diff changeset
466 which you committed. Once you've switched from the \texttt{default}
d7615e15510f More about named branches, and early use of them.
Bryan O'Sullivan <bos@serpentine.com>
parents: 202
diff changeset
467 branch to another and committed, you'll see the name of the new branch
d7615e15510f More about named branches, and early use of them.
Bryan O'Sullivan <bos@serpentine.com>
parents: 202
diff changeset
468 show up in the output of \hgcmd{log}, \hgcmd{tip}, and other commands
d7615e15510f More about named branches, and early use of them.
Bryan O'Sullivan <bos@serpentine.com>
parents: 202
diff changeset
469 that display the same kind of output.
d7615e15510f More about named branches, and early use of them.
Bryan O'Sullivan <bos@serpentine.com>
parents: 202
diff changeset
470 \interaction{branch-named.commit}
d7615e15510f More about named branches, and early use of them.
Bryan O'Sullivan <bos@serpentine.com>
parents: 202
diff changeset
471 The \hgcmd{log}-like commands will print the branch name of every
205
c76a3e2a600c Brief update.
Bryan O'Sullivan <bos@serpentine.com>
parents: 203
diff changeset
472 changeset that's not on the \texttt{default} branch. As a result, if
c76a3e2a600c Brief update.
Bryan O'Sullivan <bos@serpentine.com>
parents: 203
diff changeset
473 you never use named branches, you'll never see this information.
c76a3e2a600c Brief update.
Bryan O'Sullivan <bos@serpentine.com>
parents: 203
diff changeset
474
c76a3e2a600c Brief update.
Bryan O'Sullivan <bos@serpentine.com>
parents: 203
diff changeset
475 Once you've named a branch and committed a change with that name,
c76a3e2a600c Brief update.
Bryan O'Sullivan <bos@serpentine.com>
parents: 203
diff changeset
476 every subsequent commit that descends from that change will inherit
206
6519f3b983b4 More material about named branches.
Bryan O'Sullivan <bos@serpentine.com>
parents: 205
diff changeset
477 the same branch name. You can change the name of a branch at any
6519f3b983b4 More material about named branches.
Bryan O'Sullivan <bos@serpentine.com>
parents: 205
diff changeset
478 time, using the \hgcmd{branch} command.
6519f3b983b4 More material about named branches.
Bryan O'Sullivan <bos@serpentine.com>
parents: 205
diff changeset
479 \interaction{branch-named.rebranch}
6519f3b983b4 More material about named branches.
Bryan O'Sullivan <bos@serpentine.com>
parents: 205
diff changeset
480 In practice, this is something you won't do very often, as branch
6519f3b983b4 More material about named branches.
Bryan O'Sullivan <bos@serpentine.com>
parents: 205
diff changeset
481 names tend to have fairly long lifetimes. (This isn't a rule, just an
6519f3b983b4 More material about named branches.
Bryan O'Sullivan <bos@serpentine.com>
parents: 205
diff changeset
482 observation.)
6519f3b983b4 More material about named branches.
Bryan O'Sullivan <bos@serpentine.com>
parents: 205
diff changeset
483
296
89db0aaf6a29 translated chapter & section name within branch.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 293
diff changeset
484 %\section{Dealing with multiple named branches in a repository}
89db0aaf6a29 translated chapter & section name within branch.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 293
diff changeset
485 \section{$B%j%]%8%H%jFb$GJ#?t$NL>A0$NIU$$$?%V%i%s%A$N<h$j07$$(B}
206
6519f3b983b4 More material about named branches.
Bryan O'Sullivan <bos@serpentine.com>
parents: 205
diff changeset
486
6519f3b983b4 More material about named branches.
Bryan O'Sullivan <bos@serpentine.com>
parents: 205
diff changeset
487 If you have more than one named branch in a repository, Mercurial will
6519f3b983b4 More material about named branches.
Bryan O'Sullivan <bos@serpentine.com>
parents: 205
diff changeset
488 remember the branch that your working directory on when you start a
6519f3b983b4 More material about named branches.
Bryan O'Sullivan <bos@serpentine.com>
parents: 205
diff changeset
489 command like \hgcmd{update} or \hgcmdargs{pull}{-u}. It will update
6519f3b983b4 More material about named branches.
Bryan O'Sullivan <bos@serpentine.com>
parents: 205
diff changeset
490 the working directory to the tip of this branch, no matter what the
6519f3b983b4 More material about named branches.
Bryan O'Sullivan <bos@serpentine.com>
parents: 205
diff changeset
491 ``repo-wide'' tip is. To update to a revision that's on a different
6519f3b983b4 More material about named branches.
Bryan O'Sullivan <bos@serpentine.com>
parents: 205
diff changeset
492 named branch, you may need to use the \hgopt{update}{-C} option to
6519f3b983b4 More material about named branches.
Bryan O'Sullivan <bos@serpentine.com>
parents: 205
diff changeset
493 \hgcmd{update}.
6519f3b983b4 More material about named branches.
Bryan O'Sullivan <bos@serpentine.com>
parents: 205
diff changeset
494
6519f3b983b4 More material about named branches.
Bryan O'Sullivan <bos@serpentine.com>
parents: 205
diff changeset
495 This behaviour is a little subtle, so let's see it in action. First,
6519f3b983b4 More material about named branches.
Bryan O'Sullivan <bos@serpentine.com>
parents: 205
diff changeset
496 let's remind ourselves what branch we're currently on, and what
6519f3b983b4 More material about named branches.
Bryan O'Sullivan <bos@serpentine.com>
parents: 205
diff changeset
497 branches are in our repository.
6519f3b983b4 More material about named branches.
Bryan O'Sullivan <bos@serpentine.com>
parents: 205
diff changeset
498 \interaction{branch-named.parents}
6519f3b983b4 More material about named branches.
Bryan O'Sullivan <bos@serpentine.com>
parents: 205
diff changeset
499 We're on the \texttt{bar} branch, but there also exists an older
6519f3b983b4 More material about named branches.
Bryan O'Sullivan <bos@serpentine.com>
parents: 205
diff changeset
500 \hgcmd{foo} branch.
6519f3b983b4 More material about named branches.
Bryan O'Sullivan <bos@serpentine.com>
parents: 205
diff changeset
501
6519f3b983b4 More material about named branches.
Bryan O'Sullivan <bos@serpentine.com>
parents: 205
diff changeset
502 We can \hgcmd{update} back and forth between the tips of the
6519f3b983b4 More material about named branches.
Bryan O'Sullivan <bos@serpentine.com>
parents: 205
diff changeset
503 \texttt{foo} and \texttt{bar} branches without needing to use the
6519f3b983b4 More material about named branches.
Bryan O'Sullivan <bos@serpentine.com>
parents: 205
diff changeset
504 \hgopt{update}{-C} option, because this only involves going backwards
6519f3b983b4 More material about named branches.
Bryan O'Sullivan <bos@serpentine.com>
parents: 205
diff changeset
505 and forwards linearly through our change history.
6519f3b983b4 More material about named branches.
Bryan O'Sullivan <bos@serpentine.com>
parents: 205
diff changeset
506 \interaction{branch-named.update-switchy}
6519f3b983b4 More material about named branches.
Bryan O'Sullivan <bos@serpentine.com>
parents: 205
diff changeset
507
6519f3b983b4 More material about named branches.
Bryan O'Sullivan <bos@serpentine.com>
parents: 205
diff changeset
508 If we go back to the \texttt{foo} branch and then run \hgcmd{update},
6519f3b983b4 More material about named branches.
Bryan O'Sullivan <bos@serpentine.com>
parents: 205
diff changeset
509 it will keep us on \texttt{foo}, not move us to the tip of
6519f3b983b4 More material about named branches.
Bryan O'Sullivan <bos@serpentine.com>
parents: 205
diff changeset
510 \texttt{bar}.
6519f3b983b4 More material about named branches.
Bryan O'Sullivan <bos@serpentine.com>
parents: 205
diff changeset
511 \interaction{branch-named.update-nothing}
6519f3b983b4 More material about named branches.
Bryan O'Sullivan <bos@serpentine.com>
parents: 205
diff changeset
512
6519f3b983b4 More material about named branches.
Bryan O'Sullivan <bos@serpentine.com>
parents: 205
diff changeset
513 Committing a new change on the \texttt{foo} branch introduces a new
6519f3b983b4 More material about named branches.
Bryan O'Sullivan <bos@serpentine.com>
parents: 205
diff changeset
514 head.
6519f3b983b4 More material about named branches.
Bryan O'Sullivan <bos@serpentine.com>
parents: 205
diff changeset
515 \interaction{branch-named.foo-commit}
6519f3b983b4 More material about named branches.
Bryan O'Sullivan <bos@serpentine.com>
parents: 205
diff changeset
516 We can no longer update from \texttt{foo} to \texttt{bar} without
6519f3b983b4 More material about named branches.
Bryan O'Sullivan <bos@serpentine.com>
parents: 205
diff changeset
517 going ``sideways'' in history, so Mercurial forces us to provide the
6519f3b983b4 More material about named branches.
Bryan O'Sullivan <bos@serpentine.com>
parents: 205
diff changeset
518 \hgopt{update}{-C} option to \hgcmd{update}.
6519f3b983b4 More material about named branches.
Bryan O'Sullivan <bos@serpentine.com>
parents: 205
diff changeset
519 \interaction{branch-named.update-bar}
205
c76a3e2a600c Brief update.
Bryan O'Sullivan <bos@serpentine.com>
parents: 203
diff changeset
520
296
89db0aaf6a29 translated chapter & section name within branch.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 293
diff changeset
521 %\section{Branch names and merging}
89db0aaf6a29 translated chapter & section name within branch.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 293
diff changeset
522 \section{$B%V%i%s%AL>$H%^!<%8(B}
205
c76a3e2a600c Brief update.
Bryan O'Sullivan <bos@serpentine.com>
parents: 203
diff changeset
523
c76a3e2a600c Brief update.
Bryan O'Sullivan <bos@serpentine.com>
parents: 203
diff changeset
524 As you've probably noticed, merges in Mercurial are not symmetrical.
c76a3e2a600c Brief update.
Bryan O'Sullivan <bos@serpentine.com>
parents: 203
diff changeset
525 Let's say our repository has two heads, 17 and 23. If I
c76a3e2a600c Brief update.
Bryan O'Sullivan <bos@serpentine.com>
parents: 203
diff changeset
526 \hgcmd{update} to 17 and then \hgcmd{merge} with 23, Mercurial records
c76a3e2a600c Brief update.
Bryan O'Sullivan <bos@serpentine.com>
parents: 203
diff changeset
527 17 as the first parent of the merge, and 23 as the second. Whereas if
c76a3e2a600c Brief update.
Bryan O'Sullivan <bos@serpentine.com>
parents: 203
diff changeset
528 I \hgcmd{update} to 23 and then \hgcmd{merge} with 17, it records 23
c76a3e2a600c Brief update.
Bryan O'Sullivan <bos@serpentine.com>
parents: 203
diff changeset
529 as the first parent, and 17 as the second.
c76a3e2a600c Brief update.
Bryan O'Sullivan <bos@serpentine.com>
parents: 203
diff changeset
530
206
6519f3b983b4 More material about named branches.
Bryan O'Sullivan <bos@serpentine.com>
parents: 205
diff changeset
531 This affects Mercurial's choice of branch name when you merge. After
6519f3b983b4 More material about named branches.
Bryan O'Sullivan <bos@serpentine.com>
parents: 205
diff changeset
532 a merge, Mercurial will retain the branch name of the first parent
6519f3b983b4 More material about named branches.
Bryan O'Sullivan <bos@serpentine.com>
parents: 205
diff changeset
533 when you commit the result of the merge. If your first parent's
6519f3b983b4 More material about named branches.
Bryan O'Sullivan <bos@serpentine.com>
parents: 205
diff changeset
534 branch name is \texttt{foo}, and you merge with \texttt{bar}, the
6519f3b983b4 More material about named branches.
Bryan O'Sullivan <bos@serpentine.com>
parents: 205
diff changeset
535 branch name will still be \texttt{foo} after you merge.
6519f3b983b4 More material about named branches.
Bryan O'Sullivan <bos@serpentine.com>
parents: 205
diff changeset
536
6519f3b983b4 More material about named branches.
Bryan O'Sullivan <bos@serpentine.com>
parents: 205
diff changeset
537 It's not unusual for a repository to contain multiple heads, each with
6519f3b983b4 More material about named branches.
Bryan O'Sullivan <bos@serpentine.com>
parents: 205
diff changeset
538 the same branch name. Let's say I'm working on the \texttt{foo}
6519f3b983b4 More material about named branches.
Bryan O'Sullivan <bos@serpentine.com>
parents: 205
diff changeset
539 branch, and so are you. We commit different changes; I pull your
6519f3b983b4 More material about named branches.
Bryan O'Sullivan <bos@serpentine.com>
parents: 205
diff changeset
540 changes; I now have two heads, each claiming to be on the \texttt{foo}
6519f3b983b4 More material about named branches.
Bryan O'Sullivan <bos@serpentine.com>
parents: 205
diff changeset
541 branch. The result of a merge will be a single head on the
6519f3b983b4 More material about named branches.
Bryan O'Sullivan <bos@serpentine.com>
parents: 205
diff changeset
542 \texttt{foo} branch, as you might hope.
6519f3b983b4 More material about named branches.
Bryan O'Sullivan <bos@serpentine.com>
parents: 205
diff changeset
543
6519f3b983b4 More material about named branches.
Bryan O'Sullivan <bos@serpentine.com>
parents: 205
diff changeset
544 But if I'm working on the \texttt{bar} branch, and I merge work from
6519f3b983b4 More material about named branches.
Bryan O'Sullivan <bos@serpentine.com>
parents: 205
diff changeset
545 the \texttt{foo} branch, the result will remain on the \texttt{bar}
6519f3b983b4 More material about named branches.
Bryan O'Sullivan <bos@serpentine.com>
parents: 205
diff changeset
546 branch.
6519f3b983b4 More material about named branches.
Bryan O'Sullivan <bos@serpentine.com>
parents: 205
diff changeset
547 \interaction{branch-named.merge}
205
c76a3e2a600c Brief update.
Bryan O'Sullivan <bos@serpentine.com>
parents: 203
diff changeset
548
206
6519f3b983b4 More material about named branches.
Bryan O'Sullivan <bos@serpentine.com>
parents: 205
diff changeset
549 To give a more concrete example, if I'm working on the
6519f3b983b4 More material about named branches.
Bryan O'Sullivan <bos@serpentine.com>
parents: 205
diff changeset
550 \texttt{bleeding-edge} branch, and I want to bring in the latest fixes
6519f3b983b4 More material about named branches.
Bryan O'Sullivan <bos@serpentine.com>
parents: 205
diff changeset
551 from the \texttt{stable} branch, Mercurial will choose the ``right''
6519f3b983b4 More material about named branches.
Bryan O'Sullivan <bos@serpentine.com>
parents: 205
diff changeset
552 (\texttt{bleeding-edge}) branch name when I pull and merge from
6519f3b983b4 More material about named branches.
Bryan O'Sullivan <bos@serpentine.com>
parents: 205
diff changeset
553 \texttt{stable}.
6519f3b983b4 More material about named branches.
Bryan O'Sullivan <bos@serpentine.com>
parents: 205
diff changeset
554
296
89db0aaf6a29 translated chapter & section name within branch.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 293
diff changeset
555 %\section{Branch naming is generally useful}
89db0aaf6a29 translated chapter & section name within branch.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 293
diff changeset
556 \section{$B%V%i%s%A$KL>A0$rIU$1$k$3$H$OLr$KN)$D(B}
206
6519f3b983b4 More material about named branches.
Bryan O'Sullivan <bos@serpentine.com>
parents: 205
diff changeset
557
6519f3b983b4 More material about named branches.
Bryan O'Sullivan <bos@serpentine.com>
parents: 205
diff changeset
558 You shouldn't think of named branches as applicable only to situations
6519f3b983b4 More material about named branches.
Bryan O'Sullivan <bos@serpentine.com>
parents: 205
diff changeset
559 where you have multiple long-lived branches cohabiting in a single
6519f3b983b4 More material about named branches.
Bryan O'Sullivan <bos@serpentine.com>
parents: 205
diff changeset
560 repository. They're very useful even in the one-branch-per-repository
6519f3b983b4 More material about named branches.
Bryan O'Sullivan <bos@serpentine.com>
parents: 205
diff changeset
561 case.
6519f3b983b4 More material about named branches.
Bryan O'Sullivan <bos@serpentine.com>
parents: 205
diff changeset
562
6519f3b983b4 More material about named branches.
Bryan O'Sullivan <bos@serpentine.com>
parents: 205
diff changeset
563 In the simplest case, giving a name to each branch gives you a
6519f3b983b4 More material about named branches.
Bryan O'Sullivan <bos@serpentine.com>
parents: 205
diff changeset
564 permanent record of which branch a changeset originated on. This
266
08ae82a18abd just another typo
bab@draketo.de
parents: 261
diff changeset
565 gives you more context when you're trying to follow the history of a
206
6519f3b983b4 More material about named branches.
Bryan O'Sullivan <bos@serpentine.com>
parents: 205
diff changeset
566 long-lived branchy project.
6519f3b983b4 More material about named branches.
Bryan O'Sullivan <bos@serpentine.com>
parents: 205
diff changeset
567
207
54ca4e00e569 Add an example hook to enforce branch naming.
Bryan O'Sullivan <bos@serpentine.com>
parents: 206
diff changeset
568 If you're working with shared repositories, you can set up a
54ca4e00e569 Add an example hook to enforce branch naming.
Bryan O'Sullivan <bos@serpentine.com>
parents: 206
diff changeset
569 \hook{pretxnchangegroup} hook on each that will block incoming changes
54ca4e00e569 Add an example hook to enforce branch naming.
Bryan O'Sullivan <bos@serpentine.com>
parents: 206
diff changeset
570 that have the ``wrong'' branch name. This provides a simple, but
54ca4e00e569 Add an example hook to enforce branch naming.
Bryan O'Sullivan <bos@serpentine.com>
parents: 206
diff changeset
571 effective, defence against people accidentally pushing changes from a
54ca4e00e569 Add an example hook to enforce branch naming.
Bryan O'Sullivan <bos@serpentine.com>
parents: 206
diff changeset
572 ``bleeding edge'' branch to a ``stable'' branch. Such a hook might
54ca4e00e569 Add an example hook to enforce branch naming.
Bryan O'Sullivan <bos@serpentine.com>
parents: 206
diff changeset
573 look like this inside the shared repo's \hgrc.
54ca4e00e569 Add an example hook to enforce branch naming.
Bryan O'Sullivan <bos@serpentine.com>
parents: 206
diff changeset
574 \begin{codesample2}
54ca4e00e569 Add an example hook to enforce branch naming.
Bryan O'Sullivan <bos@serpentine.com>
parents: 206
diff changeset
575 [hooks]
54ca4e00e569 Add an example hook to enforce branch naming.
Bryan O'Sullivan <bos@serpentine.com>
parents: 206
diff changeset
576 pretxnchangegroup.branch = hg heads --template '{branches} ' | grep mybranch
54ca4e00e569 Add an example hook to enforce branch naming.
Bryan O'Sullivan <bos@serpentine.com>
parents: 206
diff changeset
577 \end{codesample2}
202
6f167e644762 Start writing about named branches.
Bryan O'Sullivan <bos@serpentine.com>
parents: 199
diff changeset
578
187
b60e2de6dbc3 Add chapter on branch management.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
579 %%% Local Variables:
293
3b1291f24c0d - replaved latex-mode to yatex-mode
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 290
diff changeset
580 %%% mode: yatex
187
b60e2de6dbc3 Add chapter on branch management.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
581 %%% TeX-master: "00book"
b60e2de6dbc3 Add chapter on branch management.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
582 %%% End: