Mercurial > hgbook
annotate ja/branch.tex @ 837:b775f963b18c
Clean up chapter 8, and add content
propagate 7226e5e750a6
author | Yoshiki Yazawa <yaz@honeyplanet.jp> |
---|---|
date | Tue, 15 Sep 2009 22:32:03 +0900 |
parents | 8a3041e6f3cb |
children |
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 | 5 %Mercurial provides several mechanisms for you to manage a project that |
6 %is making progress on multiple fronts at once. To understand these | |
7 %mechanisms, let's first take a brief look at a fairly normal software | |
8 %project structure. | |
9 | |
10 Mercurial$B$OF1;~$KJ#?t$N6ILL$G?J9T$7$F$$$/%W%m%8%'%/%H$r4IM}$9$k$N$KLrN)(B | |
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 | |
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 | 14 %Many software projects issue periodic ``major'' releases that contain |
15 %substantial new features. In parallel, they may issue ``minor'' | |
16 %releases. These are usually identical to the major releases off which | |
17 %they're based, but with a few bugs fixed. | |
18 | |
19 $BB?$/$N%=%U%H%&%'%"%W%m%8%'%/%H$G$O!$?75!G=$r;}$D%a%8%c!<%j%j!<%9$rDj4|E*(B | |
835
8a3041e6f3cb
reflect comments by Hiroshi Someya.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
803
diff
changeset
|
20 $B$K%j%j!<%9$9$k!%JB9T$7$FB??t$N%^%$%J!<%j%j!<%9$b9T$o$l$k!%$3$l$i$O%a(B |
301 | 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 | 23 %In this chapter, we'll start by talking about how to keep records of |
24 %project milestones such as releases. We'll then continue on to talk | |
25 %about the flow of work between different phases of a project, and how | |
26 %Mercurial can help you to isolate and manage this work. | |
27 | |
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 | |
29 $B$G%W%m%8%'%/%H$N3F%U%'!<%:$G$NN.$l$r@bL@$7!$(BMercurial$B$G$I$N$h$&$K6hJ,$1(B | |
30 $B$7!$4IM}$G$-$k$N$+$r@bL@$9$k!%(B | |
197 | 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 | 35 %Once you decide that you'd like to call a particular revision a |
36 %``release'', it's a good idea to record the identity of that revision. | |
37 %This will let you reproduce that release at a later date, for whatever | |
38 %purpose you might need at the time (reproducing a bug, porting to a | |
39 %new platform, etc). | |
40 %\interaction{tag.init} | |
41 | |
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 | |
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 | |
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 | 47 %Mercurial lets you give a permanent name to any revision using the |
48 %\hgcmd{tag} command. Not surprisingly, these names are called | |
49 %``tags''. | |
50 %\interaction{tag.tag} | |
51 | |
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 | |
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 | 56 %A tag is nothing more than a ``symbolic name'' for a revision. Tags |
57 %exist purely for your convenience, so that you have a handy permanent | |
58 %way to refer to a revision; Mercurial doesn't interpret the tag names | |
59 %you use in any way. | |
60 %Neither does Mercurial place any restrictions on | |
61 %the name of a tag, beyond a few that are necessary to ensure that a | |
62 %tag can be parsed unambiguously. A tag name cannot contain any of the | |
63 %following characters: | |
64 %\begin{itemize} | |
65 %\item Colon (ASCII 58, ``\texttt{:}'') | |
66 %\item Carriage return (ASCII 13, ``\Verb+\r+'') | |
67 %\item Newline (ASCII 10, ``\Verb+\n+'') | |
68 %\end{itemize} | |
69 | |
835
8a3041e6f3cb
reflect comments by Hiroshi Someya.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
803
diff
changeset
|
70 $B%?%0$O<B$N$H$3$m%j%S%8%g%s$KIU$1$i$l$?%7%s%\%kL>$KB>$J$i$J$$!%%?%0$OC1$K(B |
8a3041e6f3cb
reflect comments by Hiroshi Someya.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
803
diff
changeset
|
71 $B%f!<%6$NJX59$N$?$a$KIU$1$i$l$k!%%?%0$OFCDj$N%j%S%8%g%s$r;2>H$9$k$?$a$N<j(B |
8a3041e6f3cb
reflect comments by Hiroshi Someya.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
803
diff
changeset
|
72 $B7Z$G1JB3E*$JJ}K!$G!$(BMercurial$B$O%?%0$rK]Lu$7$J$$!%%?%0$NL>A0$K$O!$L@3N$K%Q!<(B |
8a3041e6f3cb
reflect comments by Hiroshi Someya.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
803
diff
changeset
|
73 $B%9$9$k$?$a$KI,MW$J$$$/$D$+$N$b$N0J30$K@)8B$O$J$$!%%?%0%M!<%`$O0J2<$NJ8;z(B |
8a3041e6f3cb
reflect comments by Hiroshi Someya.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
803
diff
changeset
|
74 $B$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 | 76 \item $B%3%m%s(B (ASCII 58, ``\texttt{:}'') |
77 \item $BI|5"J8;z(B (ASCII 13, ``\Verb+\r+'') | |
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 | 81 |
82 %You can use the \hgcmd{tags} command to display the tags present in | |
83 %your repository. In the output, each tagged revision is identified | |
84 %first by its name, then by revision number, and finally by the unique | |
835
8a3041e6f3cb
reflect comments by Hiroshi Someya.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
803
diff
changeset
|
85 %hash of the revision. |
301 | 86 %\interaction{tag.tags} |
87 %Notice that \texttt{tip} is listed in the output of \hgcmd{tags}. The | |
88 %\texttt{tip} tag is a special ``floating'' tag, which always | |
89 %identifies the newest revision in the repository. | |
90 | |
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 | |
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 | |
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 | 95 \hgcmd{tags}$B$N=PNO$K(B\texttt{tip}$B$,4^$^$l$F$$$k$3$H$KCm0U!%(B\texttt{tip}$B%?(B |
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 | |
97 $B%s%0%?%0$G$"$k!%(B | |
98 | |
99 %In the output of the \hgcmd{tags} command, tags are listed in reverse | |
100 %order, by revision number. This usually means that recent tags are | |
101 %listed before older tags. It also means that \texttt{tip} is always | |
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 | 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 |
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 | |
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 | 108 %When you run \hgcmd{log}, if it displays a revision that has tags |
109 %associated with it, it will print those tags. | |
110 %\interaction{tag.log} | |
111 | |
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 | |
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 | 116 %Any time you need to provide a revision~ID to a Mercurial command, the |
117 %command will accept a tag name in its place. Internally, Mercurial | |
118 %will translate your tag name into the corresponding revision~ID, then | |
119 %use that. | |
120 %\interaction{tag.log.v1.0} | |
121 | |
122 Mecurial$B%3%^%s%I$K%j%S%8%g%sHV9f$rEO$9I,MW$,$"$k>l9g!$>o$K%?%0%M!<%`$r;H(B | |
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 | |
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 | 127 %There's no limit on the number of tags you can have in a repository, or |
128 %on the number of tags that a single revision can have. As a practical | |
129 %matter, it's not a great idea to have ``too many'' (a number which will | |
130 %vary from project to project), simply because tags are supposed to help | |
131 %you to find revisions. If you have lots of tags, the ease of using them | |
132 %to identify revisions diminishes rapidly. | |
133 | |
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 | |
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 | |
835
8a3041e6f3cb
reflect comments by Hiroshi Someya.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
803
diff
changeset
|
136 $B$9$.$k$3$H$O$"$^$jNI$$9M$($H$O8@$($J$$!%%?%0$H$O%j%S%8%g%s$r8+$D$1$d$9$/(B |
8a3041e6f3cb
reflect comments by Hiroshi Someya.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
803
diff
changeset
|
137 $B$9$k$?$a$K;H$&$b$N$@$+$i$@!%%?%0$rB?$/IU$1$9$.$k$H!$%?%0$K$h$C$F%j%S%8%g(B |
8a3041e6f3cb
reflect comments by Hiroshi Someya.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
803
diff
changeset
|
138 $B%s$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 | 140 %For example, if your project has milestones as frequent as every few |
141 %days, it's perfectly reasonable to tag each one of those. But if you | |
142 %have a continuous build system that makes sure every revision can be | |
143 %built cleanly, you'd be introducing a lot of noise if you were to tag | |
144 %every clean build. Instead, you could tag failed builds (on the | |
145 %assumption that they're rare!), or simply not use tags to track | |
146 %buildability. | |
147 | |
148 $BNc$($P$"$J$?$N%W%m%8%'%/%H$,?tF|Kh$K%^%$%k%9%H!<%s$r7^$($F$$$k>l9g!$$=$l(B | |
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 | |
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 | |
151 $B$=$l$>$l$N%/%j!<%s%S%k%I$K%?%0$rIU$1$F$$$?$i<}=&$,$D$+$J$/$J$k$@$m$&!%$`(B | |
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 | |
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 | |
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 | 156 %If you want to remove a tag that you no longer want, use |
157 %\hgcmdargs{tag}{--remove}. | |
158 %\interaction{tag.remove} | |
159 %You can also modify a tag at any time, so that it identifies a | |
160 %different revision, by simply issuing a new \hgcmd{tag} command. | |
161 %You'll have to use the \hgopt{tag}{-f} option to tell Mercurial that | |
162 %you \emph{really} want to update the tag. | |
163 %\interaction{tag.replace} | |
164 %There will still be a permanent record of the previous identity of the | |
165 %tag, but Mercurial will no longer use it. There's thus no penalty to | |
166 %tagging the wrong revision; all you have to do is turn around and tag | |
167 %the correct revision once you discover your error. | |
168 | |
169 $B%?%0$,I,MW$J$/$J$C$?;~$O(B\hgcmdargs{tag}{--remove}$B%3%^%s%I$G>C$9$3$H$,$G(B | |
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 | 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 |
173 $B$3$H$b$G$-$k!%(B | |
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 | |
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 | 177 $B%?%0$N0JA0$N%"%$%G%s%F%#%F%#!<$N1JB3E*$J5-O?$O;D$C$F$$$k$,!$(BMercurial$B$O$b(B |
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 | |
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 | |
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 | 182 %Mercurial stores tags in a normal revision-controlled file in your |
803 | 183 %repository. If you've created any tags, you'll find them in a file in |
184 %the root of your repository named \sfilename{.hgtags}.When you run the | |
185 %\hgcmd{tag} command, Mercurial modifies this file, then automatically | |
186 %commits the change to it.This means that every time you run \hgcmd{tag}, | |
187 %you'll see a corresponding changeset in the output of \hgcmd{log}. | |
302 | 188 %\interaction{tag.tip} |
189 | |
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 | |
803 | 191 $B%?%0$r:n@.$7$?;~!$%j%]%8%H%j$N%k!<%H$K$"$k(B\sfilename{.hgtags}$B$H$$$&%U%!%$(B |
192 $B%k$K%?%0$,J]B8$5$l$F$$$k$N$,J,$+$k$@$m$&!%(B\hgcmd{tag}$B%3%^%s%I$r<B9T$9$k$H(B | |
193 Mercurial$B$O$3$N%U%!%$%k$rJQ99$7!$JQ99$r$3$N%U%!%$%k$K%3%_%C%H$9$k!%$D$^$j(B | |
194 \hgcmd{tag}$B$r<B9T$9$k$H$$$D$b(B\hgcmd{log}$B$N=PNO$NCf$KBP1~$9$k%A%'%s%8%;%C(B | |
195 $B%H$r8+$k$3$H$K$J$k!%(B \interaction{tag.tip} | |
196
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 | 200 %You won't often need to care about the \sfilename{.hgtags} file, but |
201 %it sometimes makes its presence known during a merge. The format of | |
202 %the file is simple: it consists of a series of lines. Each line | |
203 %starts with a changeset hash, followed by a space, followed by the | |
204 %name of a tag. | |
205 | |
206 \sfilename{.hgtags}$B$r5$$K$7$J$1$l$P$J$i$J$$$3$H$OB?$/$J$$$,!$%^!<%8$N:]$K(B | |
207 $B$OB8:_$rL@$i$+$K$9$k!%%U%!%$%k%U%)!<%^%C%H$O%7%s%W%k$G!$0lO"$N9T$r4^$`$@(B | |
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 | |
209 $B$,B3$-!$%?%0$NL>>N$,B3$/!%(B | |
210 | |
211 %If you're resolving a conflict in the \sfilename{.hgtags} file during | |
212 %a merge, there's one twist to modifying the \sfilename{.hgtags} file: | |
213 %when Mercurial is parsing the tags in a repository, it \emph{never} | |
214 %reads the working copy of the \sfilename{.hgtags} file. Instead, it | |
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 | 217 $B%^!<%8Cf$K(B\sfilename{.hgtags}$B%U%!%$%kFb$N%3%s%U%j%/%H$r2r7h$7$F$$$k>l9g!$(B |
218 \sfilename{.hgtags}$B$rJQ99$9$k0lG1$j$,$"$k!%(BMercurial$B$,%j%]%8%H%jCf$N%?%0(B | |
219 $B$r%Q!<%9$9$k;~!$(BMercurial$B$O(B\sfilename{.hgtags}$B$N%o!<%-%s%0%3%T!<$r(B | |
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 | |
221 $B%s$rFI$`!%(B | |
196
4237e45506ee
Add early material describing tags.
Bryan O'Sullivan <bos@serpentine.com>
parents:
187
diff
changeset
|
222 |
316 | 223 %An unfortunate consequence of this design is that you can't actually |
224 %verify that your merged \sfilename{.hgtags} file is correct until | |
225 %\emph{after} you've committed a change. So if you find yourself | |
226 %resolving a conflict on \sfilename{.hgtags} during a merge, be sure to | |
227 %run \hgcmd{tags} after you commit.If it finds an error in the | |
228 %\sfilename{.hgtags} file, it will report the location of the error, | |
229 %which you can then fix and commit. You should then run \hgcmd{tags} | |
230 %again, just to be sure that your fix is correct. | |
231 | |
317 | 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 |
233 \sfilename{.hgtags}$B%U%!%$%k$r<B:]$K$O%Y%j%U%!%$$G$-$J$$$3$H$G$"$k!%$=$N$?(B | |
234 $B$a!$%^!<%8Cf$K(B\sfilename{.hgtags}$B$N%3%s%U%j%/%H2r7h$r$7$F$$$k>l9g$O!$%3%_%C(B | |
235 $B%H8e$KK:$l$:(B\hgcmd{tags}$B$r<B9T$9$kI,MW$,$"$k!%(B\sfilename{.hgtags}$B$K%(%i!<(B | |
236 $B$,8+$D$+$C$?>l9g!$%(%i!<$N$"$k>l=j$rJs9p$9$k!%$=$l$r8+$F=$@5$7!$%3%_%C%H(B | |
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 | |
238 $B$9$Y$-$G$"$k!%(B | |
316 | 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 | 244 %You may have noticed that the \hgcmd{clone} command has a |
245 %\hgopt{clone}{-r} option that lets you clone an exact copy of the | |
246 %repository as of a particular changeset.The new clone will not contain | |
247 %any project history that comes after the revision you specified. This | |
248 %has an interaction with tags that can surprise the unwary. | |
249 | |
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 | |
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 | |
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 | |
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 | 255 %Recall that a tag is stored as a revision to the \sfilename{.hgtags} |
256 %file, so that when you create a tag, the changeset in which it's | |
257 %recorded necessarily refers to an older changeset. | |
258 %When you run \hgcmdargs{clone}{-r foo} to clone a repository as of tag | |
259 %\texttt{foo}, the new clone \emph{will not contain the history that | |
260 %created the tag} that you used to clone the repository. | |
261 %The resultis that you'll get exactly the right subset of the project's | |
262 %history in the new repository, but \emph{not} the tag you might have | |
263 %expected. | |
198
615f3c6b30e1
Start to describe branch management.
Bryan O'Sullivan <bos@serpentine.com>
parents:
197
diff
changeset
|
264 |
317 | 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 |
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 | |
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 | |
268 $B%]%8%H%j$r%/%m!<%s$9$k$?$a$K(B\hgcmdargs{clone}{-r foo}$B<B9T$9$k;~!$?7$7$$%/(B | |
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 | |
270 $B$K4^$^$l$kMzNr$O!$%W%m%8%'%/%HMzNr$N%5%V%;%C%H$K$J$j!$%?%0$O4^$^$l$J$$!%(B | |
316 | 271 |
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 | 275 |
317 | 276 %Since Mercurial's tags are revision controlled and carried around with |
277 %a project's history, everyone you work with will see the tags you | |
278 %create. But giving names to revisions has uses beyond simply noting | |
279 %that revision \texttt{4237e45506ee} is really \texttt{v2.0.2}. If | |
280 %you're trying to track down a subtle bug, you might want a tag to | |
281 %remind you of something like ``Anne saw the symptoms with this | |
282 %revision''. | |
283 | |
835
8a3041e6f3cb
reflect comments by Hiroshi Someya.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
803
diff
changeset
|
284 Mercurial$B$N%?%0$O%j%S%8%g%s%3%s%H%m!<%k$5$l!$%W%m%8%'%/%H$NMzNr$KIU?o$7$F(B |
8a3041e6f3cb
reflect comments by Hiroshi Someya.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
803
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$K(B |
8a3041e6f3cb
reflect comments by Hiroshi Someya.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
803
diff
changeset
|
286 $BL>A0$rIU$1$k$3$H$O!$C1$K%j%S%8%g%s(B\texttt{4237e45506ee}$B$,%P!<%8%g%s(B |
317 | 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 |
288 $B$i!$(B``Anne saw the symptoms with this revision''$B!J%"%s$O$3$N%j%S%8%g%s$G(B | |
289 $B>I>u$r8+$?!K$J$I$N%?%0$rIU$1$?$/$J$k$@$m$&!%(B | |
197 | 290 |
317 | 291 %For cases like this, what you might want to use are \emph{local} tags. |
292 %You can create a local tag with the \hgopt{tag}{-l} option to the | |
293 %\hgcmd{tag} command. This will store the tag in a file called | |
294 %\sfilename{.hg/localtags}. Unlike \sfilename{.hgtags}, | |
295 %\sfilename{.hg/localtags} is not revision controlled. Any tags you | |
296 %create using \hgopt{tag}{-l} remain strictly local to the repository | |
297 %you're currently working in. | |
298 | |
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 | |
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 | |
301 $B$3$N%*%W%7%g%s$r;H$&$H!$%?%0$O(B\sfilename{.hg/localtags}$B$H$$$&%U%!%$%k$KJ](B | |
302 $BB8$5$l$k!%(B\sfilename{.hgtags}$B$H0c$C$F!$(B\sfilename{.hg/localtags}$B$O%j%S%8%g(B | |
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 | |
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 | |
305 | |
197 | 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 | 310 %To return to the outline I sketched at the beginning of a chapter, |
311 %let's think about a project that has multiple concurrent pieces of | |
312 %work under development at once. | |
313 | |
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 | |
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 | 317 %There might be a push for a new ``main'' release; a new minor bugfix |
318 %release to the last main release; and an unexpected ``hot fix'' to an | |
319 %old release that is now in maintenance mode. | |
320 | |
835
8a3041e6f3cb
reflect comments by Hiroshi Someya.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
803
diff
changeset
|
321 $B?7$7$$(B``main''$B$r%j%j!<%9$9$k=`Hw$K$+$+$C$F$$$k>uBV$G!$:G?7$N%a%$%s%j%j!<(B |
8a3041e6f3cb
reflect comments by Hiroshi Someya.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
803
diff
changeset
|
322 $B%9$KBP$9$k?7$7$$>.5,LO$J%P%0%U%#%C%/%9%j%j!<%9$H!$4{$K%a%s%F%J%s%9%b!<%I(B |
8a3041e6f3cb
reflect comments by Hiroshi Someya.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
803
diff
changeset
|
323 $B$K$J$C$F$$$k8E$$%j%j!<%98~$1$N7W2h30$N(B``hot fix''$B$r%j%j!<%9$9$k>u67$r9M$((B |
8a3041e6f3cb
reflect comments by Hiroshi Someya.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
803
diff
changeset
|
324 $B$k!%(B |
317 | 325 |
198
615f3c6b30e1
Start to describe branch management.
Bryan O'Sullivan <bos@serpentine.com>
parents:
197
diff
changeset
|
326 |
317 | 327 %The usual way people refer to these different concurrent directions of |
328 %development is as ``branches''. However, we've already seen numerous | |
329 %times that Mercurial treats \emph{all of history} as a series of | |
330 %branches and merges. Really, what we have here is two ideas that are | |
331 %peripherally related, but which happen to share a name. | |
332 %\begin{itemize} | |
333 %\item ``Big picture'' branches represent the sweep of a project's | |
334 % evolution; people give them names, and talk about them in | |
335 % conversation. | |
336 %\item ``Little picture'' branches are artefacts of the day-to-day | |
337 % activity of developing and merging changes. They expose the | |
338 % narrative of how the code was developed. | |
339 %\end{itemize} | |
340 | |
341 $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 | |
342 $B$F8@5Z$9$k!%$7$+$7!$4{$K4vEY$H$J$/(BMercurial$B$,(B\emph{$BA4$F$NMzNr(B}$B$r0lO"$N%V(B | |
343 $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 | |
344 $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
|
345 \begin{itemize} |
317 | 346 \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 |
347 $B$KL>A0$rM?$(!$2qOC$GMQ$$$k!%(B | |
348 \item ``Little picture''$B%V%i%s%A$OF|!9$N3+H/$H%^!<%8$N=j;:$G!$%3!<%I$,$I(B | |
349 $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
|
350 \end{itemize} |
615f3c6b30e1
Start to describe branch management.
Bryan O'Sullivan <bos@serpentine.com>
parents:
197
diff
changeset
|
351 |
296
89db0aaf6a29
translated chapter & section name within branch.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
293
diff
changeset
|
352 %\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
|
353 \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
|
354 |
317 | 355 %The easiest way to isolate a ``big picture'' branch in Mercurial is in |
356 %a dedicated repository. If you have an existing shared | |
357 %repository---let's call it \texttt{myproject}---that reaches a ``1.0'' | |
358 %milestone, you can start to prepare for future maintenance releases on | |
359 %top of version~1.0 by tagging the revision from which you prepared | |
360 %the~1.0 release. | |
361 %\interaction{branch-repo.tag} | |
362 %You can then clone a new shared \texttt{myproject-1.0.1} repository as | |
363 %of that tag. | |
364 %\interaction{branch-repo.clone} | |
365 | |
835
8a3041e6f3cb
reflect comments by Hiroshi Someya.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
803
diff
changeset
|
366 Mercurial$B$G(B``big picture''$B$r3VN%$9$k:G$b4JC1$JJ}K!$O!$@lMQ$N%j%]%8%H%j$r(B |
317 | 367 $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 |
368 \texttt{myproject}$B$H8F$V$3$H$K$7$k!%$3$l$,(B``1.0''$B%^%$%k%9%H!<%s$KE~C#$7$?(B | |
369 $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 | |
370 $B$,$G$-$k!%(B | |
198
615f3c6b30e1
Start to describe branch management.
Bryan O'Sullivan <bos@serpentine.com>
parents:
197
diff
changeset
|
371 \interaction{branch-repo.tag} |
317 | 372 $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 |
373 $B$k!%(B | |
198
615f3c6b30e1
Start to describe branch management.
Bryan O'Sullivan <bos@serpentine.com>
parents:
197
diff
changeset
|
374 \interaction{branch-repo.clone} |
615f3c6b30e1
Start to describe branch management.
Bryan O'Sullivan <bos@serpentine.com>
parents:
197
diff
changeset
|
375 |
317 | 376 %Afterwards, if someone needs to work on a bug fix that ought to go |
377 %into an upcoming~1.0.1 minor release, they clone the | |
378 %\texttt{myproject-1.0.1} repository, make their changes, and push them | |
379 %back. | |
380 %\interaction{branch-repo.bugfix} | |
381 %Meanwhile, development for the next major release can continue, | |
382 %isolated and unabated, in the \texttt{myproject} repository. | |
383 %\interaction{branch-repo.new} | |
384 | |
385 $B0J8e!$%P%0%U%#%C%/%9$r$7$?$$?M$O(B1.0.1$B%^%$%J!<%j%j!<%9$X$$$/$Y$-$G$"$k!%(B | |
386 $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 | |
387 $B$9$k!%(B | |
198
615f3c6b30e1
Start to describe branch management.
Bryan O'Sullivan <bos@serpentine.com>
parents:
197
diff
changeset
|
388 \interaction{branch-repo.bugfix} |
317 | 389 $B0lJ}$G<!$N%a%8%c!<%j%j!<%9$K8~$1$F$N3+H/$O!$(B\texttt{myproject}$B%j%]%8%H%j(B |
390 $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
|
391 \interaction{branch-repo.new} |
615f3c6b30e1
Start to describe branch management.
Bryan O'Sullivan <bos@serpentine.com>
parents:
197
diff
changeset
|
392 |
296
89db0aaf6a29
translated chapter & section name within branch.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
293
diff
changeset
|
393 %\section{Don't repeat yourself: merging across branches} |
320 | 394 \section{$B<j$G7+$jJV$5$J$$$3$H!'%V%i%s%A4V$G$N%^!<%8(B} |
395 | |
396 %In many cases, if you have a bug to fix on a maintenance branch, the | |
397 %chances are good that the bug exists on your project's main branch | |
398 %(and possibly other maintenance branches, too). It's a rare developer | |
399 %who wants to fix the same bug multiple times, so let's look at a few | |
400 %ways that Mercurial can help you to manage these bugfixes without | |
401 %duplicating your work. | |
198
615f3c6b30e1
Start to describe branch management.
Bryan O'Sullivan <bos@serpentine.com>
parents:
197
diff
changeset
|
402 |
320 | 403 $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 |
404 $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 | |
405 $B$b!%!K%P%0$N=$@5$r2?EY$b7+$jJV$7$?$$$H;W$&3+H/<T$O$^$:$$$J$$!%$=$3$G%P%0(B | |
406 $B=$@5$r7+$jJV$9Be$o$j$N$G$O$J$/!$(BMercurial$B$G2r7h$G$-$k$$$/$D$+$NJ}K!$r8+(B | |
407 $B$F$_$k$3$H$K$7$h$&!%(B | |
199
58e3a6c76725
More branch/merge stuff.
Bryan O'Sullivan <bos@serpentine.com>
parents:
198
diff
changeset
|
408 |
320 | 409 %In the simplest instance, all you need to do is pull changes from your |
410 %maintenance branch into your local clone of the target branch. | |
411 %\interaction{branch-repo.pull} | |
412 %You'll then need to merge the heads of the two branches, and push back | |
413 %to the main branch. | |
414 %\interaction{branch-repo.merge} | |
415 | |
416 $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 | |
417 $B%k%/%m!<%s$K(Bpull$B$9$kJ}K!$G$"$k!%(B | |
199
58e3a6c76725
More branch/merge stuff.
Bryan O'Sullivan <bos@serpentine.com>
parents:
198
diff
changeset
|
418 \interaction{branch-repo.pull} |
320 | 419 $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 |
199
58e3a6c76725
More branch/merge stuff.
Bryan O'Sullivan <bos@serpentine.com>
parents:
198
diff
changeset
|
420 \interaction{branch-repo.merge} |
197 | 421 |
296
89db0aaf6a29
translated chapter & section name within branch.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
293
diff
changeset
|
422 %\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
|
423 \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
|
424 |
320 | 425 %In most instances, isolating branches in repositories is the right |
426 %approach. Its simplicity makes it easy to understand; and so it's | |
427 %hard to make mistakes. There's a one-to-one relationship between | |
428 %branches you're working in and directories on your system. This lets | |
429 %you use normal (non-Mercurial-aware) tools to work on files within a | |
430 %branch/repository. | |
431 | |
432 $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 | |
433 $B%A$G$"$k!%$3$l$OC1=c$J$?$aGD0.$,MF0W$G$"$j!$<:GT$rHH$92DG=@-$,Dc$$!%:n6H(B | |
434 $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 | |
835
8a3041e6f3cb
reflect comments by Hiroshi Someya.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
803
diff
changeset
|
435 $B$J$$DL>o$N%D!<%k$r%V%i%s%A!?%j%]%8%H%jFb$N%U%!%$%k$KBP$7$F;H$&$3$H$b2DG=(B |
320 | 436 $B$G$"$k!%(B |
202
6f167e644762
Start writing about named branches.
Bryan O'Sullivan <bos@serpentine.com>
parents:
199
diff
changeset
|
437 |
320 | 438 %If you're more in the ``power user'' category (\emph{and} your |
439 %collaborators are too), there is an alternative way of handling | |
440 %branches that you can consider. I've already mentioned the | |
441 %human-level distinction between ``small picture'' and ``big picture'' | |
442 %branches. While Mercurial works with multiple ``small picture'' | |
443 %branches in a repository all the time (for example after you pull | |
444 %changes in, but before you merge them), it can \emph{also} work with | |
445 %multiple ``big picture'' branches. | |
446 | |
447 $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 | |
448 $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'' | |
449 $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 | |
450 $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 | |
451 $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 | |
452 | |
453 %The key to working this way is that Mercurial lets you assign a | |
454 %persistent \emph{name} to a branch. There always exists a branch | |
455 %named \texttt{default}. Even before you start naming branches | |
456 %yourself, you can find traces of the \texttt{default} branch if you | |
457 %look for them. | |
202
6f167e644762
Start writing about named branches.
Bryan O'Sullivan <bos@serpentine.com>
parents:
199
diff
changeset
|
458 |
320 | 459 $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} |
460 $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 | |
461 $B%A$N%H%l!<%9$r8+$k$3$H$,$G$-$k!%(B | |
462 | |
463 %As an example, when you run the \hgcmd{commit} command, and it pops up | |
464 %your editor so that you can enter a commit message, look for a line | |
465 %that contains the text ``\texttt{HG: branch default}'' at the bottom. | |
466 %This is telling you that your commit will occur on the branch named | |
467 %\texttt{default}. | |
468 | |
469 $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 | |
470 $B%(%G%#%?$,5/F0$5$l$?;~!$:G2<It$N(B``\texttt{HG: branch default}''$B$H$$$&9T(B | |
471 $B$r8+$F$[$7$$!%$3$N9T$O%3%_%C%H$,(B\texttt{default}$B$H$$$&L>A0$N%V%i%s%A$KBP(B | |
472 $B$7$F9T$o$l$k$3$H$r<($7$F$$$k!%(B | |
202
6f167e644762
Start writing about named branches.
Bryan O'Sullivan <bos@serpentine.com>
parents:
199
diff
changeset
|
473 |
320 | 474 %To start working with named branches, use the \hgcmd{branches} |
475 %command. This command lists the named branches already present in | |
476 %your repository, telling you which changeset is the tip of each. | |
477 %\interaction{branch-named.branches} | |
478 %Since you haven't created any named branches yet, the only one that | |
479 %exists is \texttt{default}. | |
202
6f167e644762
Start writing about named branches.
Bryan O'Sullivan <bos@serpentine.com>
parents:
199
diff
changeset
|
480 |
320 | 481 $BL>A0IU$-%V%i%s%A$r;H$&$K$"$?$C$F!$$^$:(B\hgcmd{branches}$B$r;H$$!$%j%]%8%H%j(B |
482 $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 | |
483 $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 | |
202
6f167e644762
Start writing about named branches.
Bryan O'Sullivan <bos@serpentine.com>
parents:
199
diff
changeset
|
484 \interaction{branch-named.branches} |
320 | 485 $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 |
486 $B$@$1$,B8:_$9$k!%(B | |
203
d7615e15510f
More about named branches, and early use of them.
Bryan O'Sullivan <bos@serpentine.com>
parents:
202
diff
changeset
|
487 |
320 | 488 %To find out what the ``current'' branch is, run the \hgcmd{branch} |
489 %command, giving it no arguments. This tells you what branch the | |
490 %parent of the current changeset is on. | |
491 %\interaction{branch-named.branch} | |
492 | |
493 $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 | |
494 $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 | |
203
d7615e15510f
More about named branches, and early use of them.
Bryan O'Sullivan <bos@serpentine.com>
parents:
202
diff
changeset
|
495 \interaction{branch-named.branch} |
d7615e15510f
More about named branches, and early use of them.
Bryan O'Sullivan <bos@serpentine.com>
parents:
202
diff
changeset
|
496 |
320 | 497 %To create a new branch, run the \hgcmd{branch} command again. This |
498 %time, give it one argument: the name of the branch you want to create. | |
499 %\interaction{branch-named.create} | |
500 | |
501 $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 | |
502 $B$7$?$$%V%i%s%A$NL>A0$r0z?t$H$7$FEO$9!%(B | |
203
d7615e15510f
More about named branches, and early use of them.
Bryan O'Sullivan <bos@serpentine.com>
parents:
202
diff
changeset
|
503 \interaction{branch-named.create} |
d7615e15510f
More about named branches, and early use of them.
Bryan O'Sullivan <bos@serpentine.com>
parents:
202
diff
changeset
|
504 |
320 | 505 %After you've created a branch, you might wonder what effect the |
506 %\hgcmd{branch} command has had. What do the \hgcmd{status} and | |
507 %\hgcmd{tip} commands report? | |
508 %\interaction{branch-named.status} | |
509 %Nothing has changed in the working directory, and there's been no new | |
510 %history created. As this suggests, running the \hgcmd{branch} command | |
511 %has no permanent effect; it only tells Mercurial what branch name to | |
512 %use the \emph{next} time you commit a changeset. | |
513 | |
514 $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 | |
515 $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 | |
516 $B$=$l$>$l2?$rI=<($9$k$@$m$&$+!)(B | |
203
d7615e15510f
More about named branches, and early use of them.
Bryan O'Sullivan <bos@serpentine.com>
parents:
202
diff
changeset
|
517 \interaction{branch-named.status} |
835
8a3041e6f3cb
reflect comments by Hiroshi Someya.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
803
diff
changeset
|
518 $B%o!<%-%s%0%G%#%l%/%H%jFb$G$O2?$bJQ2=$O5/$-$:!$2?$NMzNr$b@8@.$5$l$F$$$J(B |
8a3041e6f3cb
reflect comments by Hiroshi Someya.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
803
diff
changeset
|
519 $B$$!%$3$l$+$iJ,$+$k$h$&$K!$(B\hgcmd{branch}$B%3%^%s%I$r<B9T$7$F$b!$1JB3E*$J8z(B |
8a3041e6f3cb
reflect comments by Hiroshi Someya.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
803
diff
changeset
|
520 $B2L$O2?$b5/$-$J$$!%$3$N%3%^%s%I$O(B\emph{$B<!$N(B}$B%A%'%s%8%;%C%H$N%3%_%C%H$,$I$N(B |
8a3041e6f3cb
reflect comments by Hiroshi Someya.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
803
diff
changeset
|
521 $B%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 |
203
d7615e15510f
More about named branches, and early use of them.
Bryan O'Sullivan <bos@serpentine.com>
parents:
202
diff
changeset
|
522 |
320 | 523 %When you commit a change, Mercurial records the name of the branch on |
524 %which you committed. Once you've switched from the \texttt{default} | |
525 %branch to another and committed, you'll see the name of the new branch | |
526 %show up in the output of \hgcmd{log}, \hgcmd{tip}, and other commands | |
527 %that display the same kind of output. | |
528 %\interaction{branch-named.commit} | |
529 %The \hgcmd{log}-like commands will print the branch name of every | |
530 %changeset that's not on the \texttt{default} branch. As a result, if | |
531 %you never use named branches, you'll never see this information. | |
532 | |
533 $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 | |
534 $B$r5-O?$9$k!%$R$H$?$S(B\texttt{default}$B$+$iB>$XJQ99$9$l$P!$?7$7$$%V%i%s%AL>(B | |
535 $B$,(B\hgcmd{log}$B$d(B\hgcmd{tip}$B$N=PNO$K4^$^$l$k$N$,8+$F<h$l$k$@$m$&!%(B | |
203
d7615e15510f
More about named branches, and early use of them.
Bryan O'Sullivan <bos@serpentine.com>
parents:
202
diff
changeset
|
536 \interaction{branch-named.commit} |
320 | 537 \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 |
538 $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 | |
539 $B$$>l9g$O$3$N=PNO$rL\$K$9$k$3$H$O$J$$!%(B | |
205 | 540 |
320 | 541 %Once you've named a branch and committed a change with that name, |
542 %every subsequent commit that descends from that change will inherit | |
543 %the same branch name. You can change the name of a branch at any | |
835
8a3041e6f3cb
reflect comments by Hiroshi Someya.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
803
diff
changeset
|
544 %time, using the \hgcmd{branch} command. |
320 | 545 %\interaction{branch-named.rebranch} |
546 %In practice, this is something you won't do very often, as branch | |
547 %names tend to have fairly long lifetimes. (This isn't a rule, just an | |
548 %observation.) | |
549 | |
550 $B%V%i%s%A$KL>A0$rIU$1!$$=$NL>A0$r;H$C$FJQ99$N%3%_%C%H$r9T$&$H!$0J8e$KB3$/(B | |
551 $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 | |
835
8a3041e6f3cb
reflect comments by Hiroshi Someya.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
803
diff
changeset
|
552 $B$H$G$$$D$G$b2DG=$@!%(B |
206
6519f3b983b4
More material about named branches.
Bryan O'Sullivan <bos@serpentine.com>
parents:
205
diff
changeset
|
553 \interaction{branch-named.rebranch} |
320 | 554 $B<BMQ$K$*$$$F$O!$%V%i%s%AL>$O$+$J$jD9$$4|4V;H$o$l$k798~$,$"$j!$JQ99$OIQHK(B |
555 $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 | |
556 $B$"$k!%!K(B | |
206
6519f3b983b4
More material about named branches.
Bryan O'Sullivan <bos@serpentine.com>
parents:
205
diff
changeset
|
557 |
296
89db0aaf6a29
translated chapter & section name within branch.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
293
diff
changeset
|
558 %\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
|
559 \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
|
560 |
321 | 561 %If you have more than one named branch in a repository, Mercurial will |
562 %remember the branch that your working directory on when you start a | |
563 %command like \hgcmd{update} or \hgcmdargs{pull}{-u}. It will update | |
564 %the working directory to the tip of this branch, no matter what the | |
565 %``repo-wide'' tip is. To update to a revision that's on a different | |
566 %named branch, you may need to use the \hgopt{update}{-C} option to | |
567 %\hgcmd{update}. | |
568 | |
569 1$B$D$N%j%]%8%H%jFb$K(B2$B$D0J>e$N%V%i%s%A$r;}$C$F$$$k>l9g!$(BMercurial$B$O!$(B | |
570 \hgcmd{update}$B$d(B\hgcmdargs{pull}{-u}$B$N$h$&$J%3%^%s%I$rN)$A>e$2$k$H$-$K!$(B | |
571 $B%o!<%-%s%0%G%#%l%/%H%j$,$I$N%V%i%s%A$G$"$k$+5-21$7$F$$$k!%(B | |
572 $B$3$l$i$N%3%^%s%I$O!$%j%]%8%H%jA4BN$G$N(Btip$B$,2?$G$"$k$+$K$O4X78$J$/!$%o!<%-(B | |
573 $B%s%0%G%#%l%/%H%j$r8=:_$N%V%i%s%A$N(Btip$B$K99?7$9$k!%(B | |
574 $BB>$NL>A0$D$-%V%i%s%A$KB0$9%j%S%8%g%s$X99?7$9$k$K$O!$(B\hgopt{update}{-C}$B%*(B | |
575 $B%W%7%g%sIU$-$G(B\hgcmd{update}$B%3%^%s%I$r<B9T$9$kI,MW$,$"$k$+$b$7$l$J$$!%(B | |
206
6519f3b983b4
More material about named branches.
Bryan O'Sullivan <bos@serpentine.com>
parents:
205
diff
changeset
|
576 |
321 | 577 %This behaviour is a little subtle, so let's see it in action. First, |
578 %let's remind ourselves what branch we're currently on, and what | |
579 %branches are in our repository. | |
580 %\interaction{branch-named.parents} | |
581 %We're on the \texttt{bar} branch, but there also exists an older | |
582 %\texttt{foo} branch. | |
583 | |
835
8a3041e6f3cb
reflect comments by Hiroshi Someya.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
803
diff
changeset
|
584 $B$3$N?6Iq$$$O$d$d4q0[$+$b$7$l$J$$!%<B:]$NF0:n$r8+$F$_$k$3$H$K$9$k!%$^$:2f!9(B |
8a3041e6f3cb
reflect comments by Hiroshi Someya.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
803
diff
changeset
|
585 $B$,$I$N%V%i%s%A$K$$$k$+$rD4$Y!$%j%]%8%H%j$K$I$s$J%V%i%s%A$,$"$k$+8+$F$_$h(B |
8a3041e6f3cb
reflect comments by Hiroshi Someya.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
803
diff
changeset
|
586 $B$&!%(B |
206
6519f3b983b4
More material about named branches.
Bryan O'Sullivan <bos@serpentine.com>
parents:
205
diff
changeset
|
587 \interaction{branch-named.parents} |
321 | 588 $B:#$$$k$N$O(B\texttt{bar}$B%V%i%s%A$G!$(B\texttt{foo}$B%V%i%s%A$bB8:_$9$k!%(B |
206
6519f3b983b4
More material about named branches.
Bryan O'Sullivan <bos@serpentine.com>
parents:
205
diff
changeset
|
589 |
321 | 590 %We can \hgcmd{update} back and forth between the tips of the |
591 %\texttt{foo} and \texttt{bar} branches without needing to use the | |
592 %\hgopt{update}{-C} option, because this only involves going backwards | |
593 %and forwards linearly through our change history. | |
594 %\interaction{branch-named.update-switchy} | |
595 | |
596 \texttt{foo}$B$H(B\texttt{bar}$B$N(Btip$B$N4V$r(B\hgcmd{update}$B%3%^%s%I$G9T$-Mh$9$k$3(B | |
597 $B$H$,$G$-$k!%$3$NA`:n$O99?7MzNr$NCf$r@~7A$K0\F0$9$k$@$1$J$N$G!$(B | |
598 \hgopt{update}{-C}$B%*%W%7%g%s$OI,MW$J$$!%(B | |
206
6519f3b983b4
More material about named branches.
Bryan O'Sullivan <bos@serpentine.com>
parents:
205
diff
changeset
|
599 \interaction{branch-named.update-switchy} |
6519f3b983b4
More material about named branches.
Bryan O'Sullivan <bos@serpentine.com>
parents:
205
diff
changeset
|
600 |
321 | 601 %If we go back to the \texttt{foo} branch and then run \hgcmd{update}, |
602 %it will keep us on \texttt{foo}, not move us to the tip of | |
603 %\texttt{bar}. | |
604 %\interaction{branch-named.update-nothing} | |
605 | |
606 \texttt{foo}$B%V%i%s%A$XLa$j!$(B\hgcmd{update}$B$r<B9T$7$F$b!$(B\texttt{bar}$B$N(B | |
607 tip$B$K$O0\F0$;$:!$(B\texttt{foo}$B$N$^$^$G$"$k!%(B | |
206
6519f3b983b4
More material about named branches.
Bryan O'Sullivan <bos@serpentine.com>
parents:
205
diff
changeset
|
608 \interaction{branch-named.update-nothing} |
6519f3b983b4
More material about named branches.
Bryan O'Sullivan <bos@serpentine.com>
parents:
205
diff
changeset
|
609 |
321 | 610 %Committing a new change on the \texttt{foo} branch introduces a new |
611 %head. | |
612 %\interaction{branch-named.foo-commit} | |
613 | |
614 $B?7$7$$JQ99$r(B\texttt{foo}$B$K%3%_%C%H$9$k$H!$?7$7$$(Bhead$B$,:n$i$l$k!%(B | |
206
6519f3b983b4
More material about named branches.
Bryan O'Sullivan <bos@serpentine.com>
parents:
205
diff
changeset
|
615 \interaction{branch-named.foo-commit} |
205 | 616 |
296
89db0aaf6a29
translated chapter & section name within branch.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
293
diff
changeset
|
617 %\section{Branch names and merging} |
89db0aaf6a29
translated chapter & section name within branch.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
293
diff
changeset
|
618 \section{$B%V%i%s%AL>$H%^!<%8(B} |
205 | 619 |
321 | 620 %As you've probably noticed, merges in Mercurial are not symmetrical. |
621 %Let's say our repository has two heads, 17 and 23. If I | |
622 %\hgcmd{update} to 17 and then \hgcmd{merge} with 23, Mercurial records | |
623 %17 as the first parent of the merge, and 23 as the second. Whereas if | |
624 %I \hgcmd{update} to 23 and then \hgcmd{merge} with 17, it records 23 | |
625 %as the first parent, and 17 as the second. | |
626 | |
627 $B$*$=$i$/5$$E$$$F$$$k$3$H$H;W$&$,!$(BMercurial$B$G$N%^!<%8$OBP>NE*$G$O$J$$!%(B | |
628 $B:#!$%j%]%8%H%j$,(B17$B$H(B23$B$H$$$&(B2$B$D$N(Bhead$B$r;}$D$H$7$h$&!%$3$3$G(B | |
629 \hgcmd{update}$B$G(B17$B$K99?7$7!$(B\hgcmd{merge}$B$K$h$C$F(B23$B$H%^!<%8$9$k$H!$(B | |
630 Mercurial$B$O(B17$B$r%^!<%8$N:G=i$N?F!$(B23$B$r(B2$BHVL\$N?F$H$7$F5-O?$9$k!%5U$K(B | |
631 \hgcmd{update}$B$G(B23$B$K99?7$7!$(B\hgcmd{merge}$B$G(B17$B$H%^!<%8$9$l$P!$(B23$B$r:G=i$N(B | |
632 $B?F!$(B17$B$r(B2$BHVL\$N?F$H5-O?$9$k!%(B | |
633 | |
634 %This affects Mercurial's choice of branch name when you merge. After | |
635 %a merge, Mercurial will retain the branch name of the first parent | |
636 %when you commit the result of the merge. If your first parent's | |
637 %branch name is \texttt{foo}, and you merge with \texttt{bar}, the | |
638 %branch name will still be \texttt{foo} after you merge. | |
205 | 639 |
321 | 640 $B$3$l$O%^!<%8$N:]$K(BMercurial$B$,%V%i%s%AL>$r$I$N$h$&$KA*$V$+$K1F6A$rM?$($k!%(B |
641 $B%^!<%88e!"%^!<%8$N7k2L$r%3%_%C%H$9$k:]$K(BMercurial$B$O(B1$BHVL\$N?F$N%V%i%s%AL>(B | |
642 $B$rMQ$$$k!%(B1$BHVL\$N?F$N%V%i%s%AL>$,(B\texttt{foo}$B$G!$(B\texttt{bar}$B$H%^!<%8$r(B | |
835
8a3041e6f3cb
reflect comments by Hiroshi Someya.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
803
diff
changeset
|
643 $B9T$C$?$H$9$k$H!$%^!<%88e$N%V%i%s%AL>$O(B\texttt{foo}$B$H$J$k!%(B |
321 | 644 |
645 %It's not unusual for a repository to contain multiple heads, each with | |
646 %the same branch name. Let's say I'm working on the \texttt{foo} | |
647 %branch, and so are you. We commit different changes; I pull your | |
648 %changes; I now have two heads, each claiming to be on the \texttt{foo} | |
649 %branch. The result of a merge will be a single head on the | |
650 %\texttt{foo} branch, as you might hope. | |
206
6519f3b983b4
More material about named branches.
Bryan O'Sullivan <bos@serpentine.com>
parents:
205
diff
changeset
|
651 |
321 | 652 1$B$D$N%j%]%8%H%j$,F1$8%V%i%s%AL>$r;}$D$$$/$D$b$N(Bhead$B$r;}$C$F$$$k$3$H$ODA$7(B |
653 $B$$$3$H$G$O$J$$!%:#!$;d$H$"$J$?$,F1$8(B\texttt{foo}$B%V%i%s%A$G:n6H$r$7$F$*$j!$(B | |
835
8a3041e6f3cb
reflect comments by Hiroshi Someya.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
803
diff
changeset
|
654 $B$=$l$>$l0[$J$C$?JQ99$r%3%_%C%H$9$k$H$7$h$&!%$"$J$?$N9T$C$?JQ99$r;d$,(B |
321 | 655 pull$B$9$k$H!$;d$O(B\texttt{foo}$B%V%i%s%A$K(B2$B$D$N(Bhead$B$r;}$D$3$H$K$J$k!%%^!<%8(B |
656 $B$N7k2L$O!$$"$J$?$,4|BT$9$k$h$&$K(B\texttt{foo}$B%V%i%s%A>e$G(B1$B$D$N(Bhead$B$K$J$k!%(B | |
206
6519f3b983b4
More material about named branches.
Bryan O'Sullivan <bos@serpentine.com>
parents:
205
diff
changeset
|
657 |
321 | 658 %But if I'm working on the \texttt{bar} branch, and I merge work from |
659 %the \texttt{foo} branch, the result will remain on the \texttt{bar} | |
660 %branch. | |
661 %\interaction{branch-named.merge} | |
662 | |
663 $B$7$+$7!$;d$,(B\texttt{bar}$B%V%i%s%A$G:n6H$r$7$F$$$F!$(B\texttt{foo}$B%V%i%s%A$+(B | |
835
8a3041e6f3cb
reflect comments by Hiroshi Someya.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
803
diff
changeset
|
664 $B$i%^!<%8$r9T$&$H!$@.2LJ*$O(B\texttt{bar}$B%V%i%s%A$K;D$k$3$H$K$J$k!%(B |
206
6519f3b983b4
More material about named branches.
Bryan O'Sullivan <bos@serpentine.com>
parents:
205
diff
changeset
|
665 \interaction{branch-named.merge} |
205 | 666 |
321 | 667 %To give a more concrete example, if I'm working on the |
668 %\texttt{bleeding-edge} branch, and I want to bring in the latest fixes | |
669 %from the \texttt{stable} branch, Mercurial will choose the ``right'' | |
670 %(\texttt{bleeding-edge}) branch name when I pull and merge from | |
671 %\texttt{stable}. | |
672 | |
673 $B$b$C$H6qBNE*$JNc$r5s$2$k$H!$$b$7;d$,(B\texttt{bleeding-edge}$B%V%i%s%A$G:n6H(B | |
674 $B$r$7$F$$$F!$(B\texttt{stable}$B%V%i%s%A$N?7$7$$=$@5$r<h$j9~$`$?$a$K(B | |
835
8a3041e6f3cb
reflect comments by Hiroshi Someya.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
803
diff
changeset
|
675 \texttt{stable}$B$+$i(Bpull$B$H(Bmerge$B$r9T$&$H!$(BMercurial$B$O(B``$B@5$7$$(B''$B%V%i%s%AL>(B |
321 | 676 (\texttt{bleeding-edge})$B$rA*$V!%(B |
206
6519f3b983b4
More material about named branches.
Bryan O'Sullivan <bos@serpentine.com>
parents:
205
diff
changeset
|
677 |
296
89db0aaf6a29
translated chapter & section name within branch.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
293
diff
changeset
|
678 %\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
|
679 \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
|
680 |
321 | 681 %You shouldn't think of named branches as applicable only to situations |
682 %where you have multiple long-lived branches cohabiting in a single | |
683 %repository. They're very useful even in the one-branch-per-repository | |
684 %case. | |
685 | |
686 $BL>A0IU$-%V%i%s%A$r(B1$B$D$N%j%]%8%H%j$NCf$KD9L?$J%V%i%s%A$rJ#?t;}$D>u67$K$N$_(B | |
687 $BMQ$$$k$Y$-$@$H9M$($k$Y$-$G$O$J$$!%L>A0IU$-%V%i%s%A$O%V%i%s%AKh$K%j%]%8%H(B | |
688 $B%j$r;}$D>l9g$G$b6K$a$FM-MQ$G$"$k!%(B | |
689 | |
690 %In the simplest case, giving a name to each branch gives you a | |
691 %permanent record of which branch a changeset originated on. This | |
692 %gives you more context when you're trying to follow the history of a | |
693 %long-lived branchy project. | |
206
6519f3b983b4
More material about named branches.
Bryan O'Sullivan <bos@serpentine.com>
parents:
205
diff
changeset
|
694 |
321 | 695 $B:G$bC1=c$JNc$O!$$=$l$>$l$N%V%i%s%A$KL>A0$rM?$($k$3$H$G!$%A%'%s%8%;%C%H$,(B |
696 $B$I$N%V%i%s%A$r5/8;$K;}$D$N$+1JB3E*$K5-O?$9$k$3$H$,$G$-$k!%$3$l$K$h$j!$D9(B | |
697 $BL?$J%V%i%s%A$r;}$D%W%m%8%'%/%H$NNr;K$rDI$$$+$1$k;~$K!$A08e4X78$,DO$_$d$9(B | |
698 $B$/$J$k!%(B | |
206
6519f3b983b4
More material about named branches.
Bryan O'Sullivan <bos@serpentine.com>
parents:
205
diff
changeset
|
699 |
321 | 700 %If you're working with shared repositories, you can set up a |
701 %\hook{pretxnchangegroup} hook on each that will block incoming changes | |
702 %that have the ``wrong'' branch name. This provides a simple, but | |
703 %effective, defence against people accidentally pushing changes from a | |
704 %``bleeding edge'' branch to a ``stable'' branch. Such a hook might | |
705 %look like this inside the shared repo's \hgrc. | |
706 %\begin{codesample2} | |
707 % [hooks] | |
708 % pretxnchangegroup.branch = hg heads --template '{branches} ' | grep mybranch | |
709 %\end{codesample2} | |
710 | |
711 $B6&M-%j%]%8%H%j$r;H$C$F:n6H$7$F$$$k>l9g!$(B\hook{pretxnchangegroup}$B%U%C%/$r(B | |
712 $B@_Dj$9$k$3$H$G4V0c$C$?%V%i%s%AL>$r;}$D99?7$r%V%m%C%/$9$k$3$H$,$G$-$k!%$3(B | |
713 $B$l$ONc$($P(B``$B:G@hC<(B''$B%V%i%s%A$+$i(B``$B0BDj(B''$B%V%i%s%A$XJQ99$r(Bpush$B$9$k$h$&$J4V(B | |
835
8a3041e6f3cb
reflect comments by Hiroshi Someya.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
803
diff
changeset
|
714 $B0c$$$rKI$0$N$K%7%s%W%k$+$D8z2LE*$JJ}K!$G$"$k!%%U%C%/$O!$6&M-%j%]%8%H%j$N(B |
8a3041e6f3cb
reflect comments by Hiroshi Someya.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
803
diff
changeset
|
715 \hgrc $B$K(B |
207
54ca4e00e569
Add an example hook to enforce branch naming.
Bryan O'Sullivan <bos@serpentine.com>
parents:
206
diff
changeset
|
716 \begin{codesample2} |
54ca4e00e569
Add an example hook to enforce branch naming.
Bryan O'Sullivan <bos@serpentine.com>
parents:
206
diff
changeset
|
717 [hooks] |
54ca4e00e569
Add an example hook to enforce branch naming.
Bryan O'Sullivan <bos@serpentine.com>
parents:
206
diff
changeset
|
718 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
|
719 \end{codesample2} |
321 | 720 $B$N$h$&$K5-=R$5$l$k!%(B |
721 | |
202
6f167e644762
Start writing about named branches.
Bryan O'Sullivan <bos@serpentine.com>
parents:
199
diff
changeset
|
722 |
835
8a3041e6f3cb
reflect comments by Hiroshi Someya.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
803
diff
changeset
|
723 %%% Local Variables: |
293
3b1291f24c0d
- replaved latex-mode to yatex-mode
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
290
diff
changeset
|
724 %%% mode: yatex |
187
b60e2de6dbc3
Add chapter on branch management.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
725 %%% TeX-master: "00book" |
835
8a3041e6f3cb
reflect comments by Hiroshi Someya.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
803
diff
changeset
|
726 %%% End: |