comparison ja/undo.tex @ 835:8a3041e6f3cb

reflect comments by Hiroshi Someya.
author Yoshiki Yazawa <yaz@honeyplanet.jp>
date Sat, 11 Jul 2009 19:25:35 +0900
parents 32d33b238b7e
children b775f963b18c
comparison
equal deleted inserted replaced
834:896ab6eaf1c6 835:8a3041e6f3cb
74 $B%3%_%C%H8e$N(B\hgcmd{status}$B$N=PNO$r8+$k$H!$D>$A$K%(%i!<$rI=<($7$F$$$k$3$H(B 74 $B%3%_%C%H8e$N(B\hgcmd{status}$B$N=PNO$r8+$k$H!$D>$A$K%(%i!<$rI=<($7$F$$$k$3$H(B
75 $B$,$o$+$k!%(B 75 $B$,$o$+$k!%(B
76 \interaction{rollback.status} 76 \interaction{rollback.status}
77 $B%3%_%C%H$O(B\filename{a}$B$X$NJQ99$r4^$s$G$$$k$,!$(B\filename{b}$B$X$NJQ99$O4^$s(B 77 $B%3%_%C%H$O(B\filename{a}$B$X$NJQ99$r4^$s$G$$$k$,!$(B\filename{b}$B$X$NJQ99$O4^$s(B
78 $B$G$$$J$$!%$3$3$G;d$,F1N=$H6&M-$7$F$$$k%j%]%8%H%j$X%A%'%s%8%;%C%H$N%W%C%7%e(B 78 $B$G$$$J$$!%$3$3$G;d$,F1N=$H6&M-$7$F$$$k%j%]%8%H%j$X%A%'%s%8%;%C%H$N%W%C%7%e(B
79 $B$r9T$J$C$?$H$7$?$i!$H`$i$,JQ99$r%W%k$7$?;~!$(B\filename{a}$B$NCf$N2?$+$,H`$i(B 79 $B$r9T$C$?$H$7$?$i!$H`$i$,JQ99$r%W%k$7$?;~!$(B\filename{a}$B$NCf$N2?$+$,H`$i(B
80 $B$N%j%]%8%H%j$K4^$^$l$J$$(B\filename{b}$B$X$N;2>H$r9T$J$&2DG=@-$O9b$$!%$=$&$J$C(B 80 $B$N%j%]%8%H%j$K4^$^$l$J$$(B\filename{b}$B$X$N;2>H$r9T$&2DG=@-$O9b$$!%$=$&$J$C(B
81 $B$?$iI.<T$OF1N=$NE\$j$rGc$&$3$H$K$J$k$@$m$&!%(B 81 $B$?$iI.<T$OF1N=$NE\$j$rGc$&$3$H$K$J$k$@$m$&!%(B
82 82
83 %However, luck is with me---I've caught my error before I pushed the 83 %However, luck is with me---I've caught my error before I pushed the
84 %changeset. I use the \hgcmd{rollback} command, and Mercurial makes 84 %changeset. I use the \hgcmd{rollback} command, and Mercurial makes
85 %that last changeset vanish. 85 %that last changeset vanish.
94 94
95 $B$7$+$79%1?$K$b%A%'%s%8%;%C%H$r%W%C%7%e$9$kA0$K%(%i!<$K5$$E$$$?>l9g!$(B 95 $B$7$+$79%1?$K$b%A%'%s%8%;%C%H$r%W%C%7%e$9$kA0$K%(%i!<$K5$$E$$$?>l9g!$(B
96 \hgcmd{rollback}$B%3%^%s%I$r;HMQ$9$k$3$H$G(BMercurial$B$+$i:G8e$N99?7$r<h$j=|(B 96 \hgcmd{rollback}$B%3%^%s%I$r;HMQ$9$k$3$H$G(BMercurial$B$+$i:G8e$N99?7$r<h$j=|(B
97 $B$/$3$H$,$G$-$k!%(B 97 $B$/$3$H$,$G$-$k!%(B
98 \interaction{rollback.rollback} 98 \interaction{rollback.rollback}
99 $B%A%'%s%8%;%C%H$O$j$]$8$H$j$NMzNr$K$b$O$dB8:_$;$:!$%o!<%-%s%0%G%#%l%/%H%j(B 99 $B%A%'%s%8%;%C%H$O%j%]%8%H%j$NMzNr$K$b$O$dB8:_$;$:!$%o!<%-%s%0%G%#%l%/%H%j(B
100 $B$N(B\filename{a}$B$OJQ99$5$l$?$HG'<1$5$l$k!%%3%_%C%H$7$F%m!<%k%P%C%/$9$k$H!$(B 100 $B$N(B\filename{a}$B$OJQ99$5$l$?$HG'<1$5$l$k!%%3%_%C%H$7$F%m!<%k%P%C%/$9$k$H!$(B
101 $B%o!<%-%s%0%G%#%l%/%H%j$O40A4$K%3%_%C%HA0$N>uBV$K$J$j!$%A%'%s%8%;%C%H$O40(B 101 $B%o!<%-%s%0%G%#%l%/%H%j$O40A4$K%3%_%C%HA0$N>uBV$K$J$j!$%A%'%s%8%;%C%H$O40(B
102 $BA4$K>C5n$5$l$k!%$3$N>uBV$G0BA4$K(B\hgcmd{add} \filename{b}$B$7!$$b$&0lEY(B 102 $BA4$K>C5n$5$l$k!%$3$N>uBV$G0BA4$K(B\hgcmd{add} \filename{b}$B$7!$$b$&0lEY(B
103 commit$B$9$k$3$H$,$G$-$k!%(B 103 commit$B$9$k$3$H$,$G$-$k!%(B
104 \interaction{rollback.rollback} 104 \interaction{rollback.rollback}
126 %you'll notice immediately, because Mercurial will display the URL it's 126 %you'll notice immediately, because Mercurial will display the URL it's
127 %pulling from, or you will see it pull a suspiciously large number of 127 %pulling from, or you will see it pull a suspiciously large number of
128 %changes into the repository. 128 %changes into the repository.
129 129
130 $B$3$3$G$"$J$?$O8m$C$F%m!<%+%k$N(B0.9$B%j%]%8%H%j$K6&M-(B1.0$B%j%]%8%H%j$+$i%W%k$7(B 130 $B$3$3$G$"$J$?$O8m$C$F%m!<%+%k$N(B0.9$B%j%]%8%H%j$K6&M-(B1.0$B%j%]%8%H%j$+$i%W%k$7(B
131 $B$?$H$9$k!%:G0-$N>l9g!$==J,Cm0U$;$:!$$3$l$r6&M-$N(B0.9$B%j%]%8%H%j$K=q$-La$7$F(B 131 $B$?$H$9$k!%:G0-$N>l9g!$Cm0U$rBU$C$F!$$3$l$r6&M-$N(B0.9$B%j%]%8%H%j$K=q$-La$7$F(B
132 $B$7$^$$!$3+H/%A!<%`A4BN$r:.Mp$5$;$F$7$^$&$3$H$,M-$jF@$k!%!J$3$N>l9g$I$&$9(B 132 $B$7$^$$!$3+H/%A!<%`A4BN$r:.Mp$5$;$F$7$^$&$3$H$,M-$jF@$k!%!J$3$N>l9g$I$&$9(B
133 $B$l$P$$$$$N$+$K$D$$$F$O8e=R$9$k!%!K$7$+$7(BMercurial$B$O%W%k85$N(BURL$B$H5?$$$r;}(B 133 $B$l$P$$$$$N$+$K$D$$$F$O8e=R$9$k!%!K<B:]$K$O!$(BMercurial$B$O(Bpull$B85$N(BURL$B$rI=<((B
134 $B$D$K==J,$J5pBg$JJQ99$rI=<($9$k$?$a!$B(:B$K5$$E$/2DG=@-$,9b$$!%(B 134 $B$9$k$7!$4V0c$C$?%j%]%8%H%j$+$i(Bpull$B$9$l$PBgNL$N%A%'%s%8%;%C%H$,I=<($5$l$k(B
135 $B$?$a!$B(:B$K2?$+$,$*$+$7$$$H5$$E$/$3$H$@$m$&!%(B
135 136
136 %The \hgcmd{rollback} command will work nicely to expunge all of the 137 %The \hgcmd{rollback} command will work nicely to expunge all of the
137 %changesets that you just pulled. Mercurial groups all changes from 138 %changesets that you just pulled. Mercurial groups all changes from
138 %one \hgcmd{pull} into a single transaction, so one \hgcmd{rollback} is 139 %one \hgcmd{pull} into a single transaction, so one \hgcmd{rollback} is
139 %all you need to undo this mistake. 140 %all you need to undo this mistake.
205 206
206 Mercurial$B$O%H%i%s%6%/%7%g%s%m%0$K$=$N%j%]%8%H%j$K5/$3$C$?:G$b?7$7$$%H%i%s(B 207 Mercurial$B$O%H%i%s%6%/%7%g%s%m%0$K$=$N%j%]%8%H%j$K5/$3$C$?:G$b?7$7$$%H%i%s(B
207 $B%6%/%7%g%s0l2sJ,$N$_$r5-O?$7$F$$$k!%%m!<%k%P%C%/0l2sKh$K0l$DA0$N%j%S%8%g(B 208 $B%6%/%7%g%s0l2sJ,$N$_$r5-O?$7$F$$$k!%%m!<%k%P%C%/0l2sKh$K0l$DA0$N%j%S%8%g(B
208 $B%s$KLa$k$o$1$G$O$J$$!%(B 209 $B%s$KLa$k$o$1$G$O$J$$!%(B
209 \interaction{rollback.twice} 210 \interaction{rollback.twice}
210 $B%j%]%8%H%j$J$$$G0lEY%m!<%k%P%C%/$7$?$i!$JL$N%3%_%C%H$r$9$k$+%W%k$r$9$k$^(B 211 $B%j%]%8%H%jFb$G0lEY%m!<%k%P%C%/$7$?$i!$JL$N%3%_%C%H$r$9$k$+%W%k$r$9$k$^(B
211 $B$G%m!<%k%P%C%/$O$G$-$J$$!%(B 212 $B$G%m!<%k%P%C%/$O$G$-$J$$!%(B
212 213
213 214
214 %\section{Reverting the mistaken change} 215 %\section{Reverting the mistaken change}
215 \section{$B4V0c$C$?JQ99$r85$KLa$9(B} 216 \section{$B4V0c$C$?JQ99$r85$KLa$9(B}
261 % undo the ``removed'' state of the file, and restore the file to its 262 % undo the ``removed'' state of the file, and restore the file to its
262 % unmodified contents. 263 % unmodified contents.
263 %\end{itemize} 264 %\end{itemize}
264 265
265 \hgcmd{revert}$B%3%^%s%I$,07$($k%1!<%9$K$D$$$F$^$H$a$k!%$h$j>\$7$$@bL@$O!$(B 266 \hgcmd{revert}$B%3%^%s%I$,07$($k%1!<%9$K$D$$$F$^$H$a$k!%$h$j>\$7$$@bL@$O!$(B
266 $B8e$N@a$G9T$J$&!%(B 267 $B8e$N@a$G9T$&!%(B
267 268
268 \begin{itemize} 269 \begin{itemize}
269 \item $B%U%!%$%k$rJQ99$7$?>l9g!$(B\hgcmd{revert}$B$O%U%!%$%k$rJQ99$5$l$kA0$N>u(B 270 \item $B%U%!%$%k$rJQ99$7$?>l9g!$(B\hgcmd{revert}$B$O%U%!%$%k$rJQ99$5$l$kA0$N>u(B
270 $BBV$KLa$9!%(B 271 $BBV$KLa$9!%(B
271
272 \item \hgcmd{add}$B$r<B9T$7$?>l9g!$(B\hgcmd{revert}$B$O(Badd$B$r<h$j>C$9$,!$%U%!%$(B 272 \item \hgcmd{add}$B$r<B9T$7$?>l9g!$(B\hgcmd{revert}$B$O(Badd$B$r<h$j>C$9$,!$%U%!%$(B
273 $B%k<+BN$O$=$N$^$^<j$r?($l$:$K;D$9!%(B 273 $B%k<+BN$O$=$N$^$^<j$r?($l$:$K;D$9!%(B
274 \item Mercurial$B$rA`:n$;$:$K%U%!%$%k$r>C5n$7$F$$$?>l9g!$(B\hgcmd{revert}$B$O(B 274 \item Mercurial$B$rA`:n$;$:$K%U%!%$%k$r>C5n$7$F$$$?>l9g!$(B\hgcmd{revert}$B$O(B
275 $B%U%!%$%k$rJQ99A0$N>uBV$GI|85$9$k(B 275 $B%U%!%$%k$rJQ99A0$N>uBV$GI|85$9$k(B
276 \item \hgcmd{remove}$B%3%^%s%I$G%U%!%$%k$r>C5n$7$F$$$?>l9g!$JQ99A0$N>uBV$G(B 276 \item \hgcmd{remove}$B%3%^%s%I$G%U%!%$%k$r>C5n$7$F$$$?>l9g!$JQ99A0$N>uBV$G(B
341 %As you can see from the output of \hgcmd{status}, the renamed-to file 341 %As you can see from the output of \hgcmd{status}, the renamed-to file
342 %is no longer identified as added, but the renamed-\emph{from} file is 342 %is no longer identified as added, but the renamed-\emph{from} file is
343 %still removed! This is counter-intuitive (at least to me), but at 343 %still removed! This is counter-intuitive (at least to me), but at
344 %least it's easy to deal with. 344 %least it's easy to deal with.
345 %So remember, to revert a \hgcmd{rename}, you must provide \emph{both} 345 %So remember, to revert a \hgcmd{rename}, you must provide \emph{both}
346 %the source and destination names. 346 %the source and destination names.
347 347
348 \hgcmd{rename}$B$7$?8e$G$O!$>/$7N10U$7$F$*$/$Y$-E@$,$"$k!%%j%M!<%`8e$K(B 348 \hgcmd{rename}$B$7$?8e$G$O!$>/$7N10U$7$F$*$/$Y$-E@$,$"$k!%%j%M!<%`8e$K(B
349 \hgcmd{revert}$B$7$?>l9g!$$3$3$G@bL@$9$k$h$&$K!$%j%M!<%`$7$?%U%!%$%k$NL>A0(B 349 \hgcmd{revert}$B$7$?>l9g!$$3$3$G@bL@$9$k$h$&$K!$%j%M!<%`$7$?%U%!%$%k$NL>A0(B
350 $B$r;XDj$9$k$@$1$G$OIT==J,$G$"$k!%(B 350 $B$r;XDj$9$k$@$1$G$OIT==J,$G$"$k!%(B
351 \interaction{daily.revert.rename} 351 \interaction{daily.revert.rename}
362 %file that was removed as part of the rename, it will be unmodified. 362 %file that was removed as part of the rename, it will be unmodified.
363 %If you need the modifications in the renamed-to file to show up in the 363 %If you need the modifications in the renamed-to file to show up in the
364 %renamed-from file, don't forget to copy them over.) 364 %renamed-from file, don't forget to copy them over.)
365 365
366 $B!J0lJ}!$%j%M!<%`$7$?8e$K%j%M!<%`@h$N%U%!%$%k$rJT=8$7!$%j%M!<%`$NA08e$N%U%!(B 366 $B!J0lJ}!$%j%M!<%`$7$?8e$K%j%M!<%`@h$N%U%!%$%k$rJT=8$7!$%j%M!<%`$NA08e$N%U%!(B
367 $B%$%kL>$r;XDj$7$F<h$j>C$7$r9T$J$$!$(BMercurial$B$,%j%M!<%`$N:]$K>C5n$5$l$?%U%!(B 367 $B%$%kL>$r;XDj$7$F<h$j>C$7$r9T$$!$(BMercurial$B$,%j%M!<%`$N:]$K>C5n$5$l$?%U%!(B
368 $B%$%k$r=$I|$9$k$H!$$3$N%U%!%$%k$OJT=8A0$N>uBV$K$J$C$F$$$k!%%j%M!<%`8e$N%U%!(B 368 $B%$%k$r=$I|$9$k$H!$$3$N%U%!%$%k$OJT=8A0$N>uBV$K$J$C$F$$$k!%%j%M!<%`8e$N%U%!(B
369 $B%$%k$X$NJQ99$,%j%M!<%`A0$N%U%!%$%k$K;D$k$h$&$K$9$k$K$O!$%3%T!<$r:n$C$F$*(B 369 $B%$%k$X$NJQ99$,%j%M!<%`A0$N%U%!%$%k$K;D$k$h$&$K$9$k$K$O!$%3%T!<$r:n$C$F$*(B
370 $B$/I,MW$,$"$k!%!K(B 370 $B$/I,MW$,$"$k!%!K(B
371 371
372 %These fiddly aspects of reverting a rename arguably constitute a small 372 %These fiddly aspects of reverting a rename arguably constitute a small
383 %change $b$ on top of it; you then realise that change $a$ was 383 %change $b$ on top of it; you then realise that change $a$ was
384 %incorrect. Mercurial lets you ``back out'' an entire changeset 384 %incorrect. Mercurial lets you ``back out'' an entire changeset
385 %automatically, and building blocks that let you reverse part of a 385 %automatically, and building blocks that let you reverse part of a
386 %changeset by hand. 386 %changeset by hand.
387 387
388 $a$$B$r%3%_%C%H$7$?8e$GJL$N(B$b$$B$r%3%_%C%H$7!$$3$3$G(B$a$$B$O8m$j$G$"$k$3$H$K5$$E(B 388 $a$$B$r%3%_%C%H$7$?8e$GJL$N(B$b$$B$r%3%_%C%H$7!$$3$3$G(B$a$$B$O8m$j$G$"$k$3$H$K5$$,(B
389 $B$/$$$?>l9g$r9M$($k!%(BMercurial$B$O%A%'%s%8%;%C%HA4BN$H%A%'%s%8%;%C%H$N0lItJ,(B 389 $B$D$$$?>l9g$r9M$($k!%(BMercurial$B$O%A%'%s%8%;%C%HA4BN$H%A%'%s%8%;%C%H$N0lItJ,(B
390 $B$r<j$G%P%C%/%"%&%H$9$k$h$&$KB%$9!%(B 390 $B$r<j$G%P%C%/%"%&%H$9$k$h$&$KB%$9!%(B
391 391
392 %Before you read this section, here's something to keep in mind: the 392 %Before you read this section, here's something to keep in mind: the
393 %\hgcmd{backout} command undoes changes by \emph{adding} history, not 393 %\hgcmd{backout} command undoes changes by \emph{adding} history, not
394 %by modifying or erasing it. It's the right tool to use if you're 394 %by modifying or erasing it. It's the right tool to use if you're
395 %fixing bugs, but not if you're trying to undo some change that has 395 %fixing bugs, but not if you're trying to undo some change that has
396 %catastrophic consequences. To deal with those, see 396 %catastrophic consequences. To deal with those, see
397 %section~\ref{sec:undo:aaaiiieee}. 397 %section~\ref{sec:undo:aaaiiieee}.
398 398
399 $B$3$N@a$rFI$`A0$K!$(B\hgcmd{backout}$B%3%^%s%I$OMzNr$K(B\emph{$BDI2C(B}$B$9$k$3$H$G<h(B 399 $B$3$N@a$rFI$`A0$K!$(B\hgcmd{backout}$B%3%^%s%I$OMzNr$K(B\emph{$BDI2C(B}$B$9$k$3$H$G<h(B
400 $B$j>C$7A`:n$r9T$J$&$3$H$r3P$($F$*$$$FM_$7$$!%JQ99$d>C5n$G$O$J$$!%%P%0$N=$(B 400 $B$j>C$7A`:n$r9T$&$3$H$r3P$($F$*$$$FM_$7$$!%JQ99$d>C5n$G$O$J$$!%%P%0$N=$(B
401 $B@5$N$?$a$KLrN)$D%D!<%k$@$,!$JQ99$N<h$j>C$7$N$?$a$KMQ$$$k$HGKLGE*$J7k2L$r(B 401 $B@5$N$?$a$KLrN)$D%D!<%k$@$,!$JQ99$N<h$j>C$7$N$?$a$KMQ$$$k$HGKLGE*$J7k2L$r(B
402 $B$b$?$i$9!%8e<T$NL\E*$N$?$a$K$O(B\ref{sec:undo:aaaiiieee}$B$r;2>H$N$3$H!%(B 402 $B$b$?$i$9!%8e<T$NL\E*$N$?$a$K$O(B\ref{sec:undo:aaaiiieee}$B$r;2>H$N$3$H!%(B
403 403
404 %\subsection{Backing out a changeset} 404 %\subsection{Backing out a changeset}
405 \subsection{$B%A%'%s%8%;%C%H$N%P%C%/%"%&%H(B} 405 \subsection{$B%A%'%s%8%;%C%H$N%P%C%/%"%&%H(B}
411 %\emph{reverses} the effect of the to-be-undone changeset. 411 %\emph{reverses} the effect of the to-be-undone changeset.
412 412
413 \hgcmd{backout}$B%3%^%s%I$O%A%'%s%8%;%C%HA4BN$N:nMQ$rBG$A>C$9!%(BMercurial$B$N(B 413 \hgcmd{backout}$B%3%^%s%I$O%A%'%s%8%;%C%HA4BN$N:nMQ$rBG$A>C$9!%(BMercurial$B$N(B
414 $BMzNr$OITJQ$J$N$G!$$3$N%3%^%s%I$O<h$j>C$7$?$$%A%'%s%8%;%C%H$r<h$j=|$/$b$N(B 414 $BMzNr$OITJQ$J$N$G!$$3$N%3%^%s%I$O<h$j>C$7$?$$%A%'%s%8%;%C%H$r<h$j=|$/$b$N(B
415 $B$G$O(B\emph{$B$J$$(B}$B!%$=$NBe$o$j!$<h$j=|$-$?$$%A%'%s%8%;%C%H$N(B\emph{$B5U(B}$B$NF/$-(B 415 $B$G$O(B\emph{$B$J$$(B}$B!%$=$NBe$o$j!$<h$j=|$-$?$$%A%'%s%8%;%C%H$N(B\emph{$B5U(B}$B$NF/$-(B
416 $B$N?7$?$J%A%'%s%8%;%C%H$r$r@8@.$9$k!%(B 416 $B$N?7$?$J%A%'%s%8%;%C%H$r@8@.$9$k!%(B
417 417
418 %The operation of the \hgcmd{backout} command is a little intricate, so 418 %The operation of the \hgcmd{backout} command is a little intricate, so
419 %let's illustrate it with some examples. First, we'll create a 419 %let's illustrate it with some examples. First, we'll create a
420 %repository with some simple changes. 420 %repository with some simple changes.
421 %\interaction{backout.init} 421 %\interaction{backout.init}
480 %\interaction{backout.non-tip.backout} 480 %\interaction{backout.non-tip.backout}
481 481
482 $B:G8e$N%3%_%C%H0J30$NJQ99$r%P%C%/%"%&%H$7$?$$;~$O!$(B 482 $B:G8e$N%3%_%C%H0J30$NJQ99$r%P%C%/%"%&%H$7$?$$;~$O!$(B
483 \hgcmd{backout}$B$K(B\hgopt{backout}{--merge}$B%*%W%7%g%s$rIU$1$k!%(B 483 \hgcmd{backout}$B$K(B\hgopt{backout}{--merge}$B%*%W%7%g%s$rIU$1$k!%(B
484 \interaction{backout.non-tip.clone} 484 \interaction{backout.non-tip.clone}
485 $B$3$N%*%W%7%g%s$O$I$s$J%A%'%s%8%;%C%H$G$b0l2s$NF0:n$G9T$J$&$3$H$,$G$-!$<j(B 485 $B$3$N%*%W%7%g%s$O$I$s$J%A%'%s%8%;%C%H$G$b0l2s$NF0:n$G9T$&$3$H$,$G$-!$<j(B
486 $BAa$/4JC1$G$"$k!%(B 486 $BAa$/4JC1$G$"$k!%(B
487 \interaction{backout.non-tip.backout} 487 \interaction{backout.non-tip.backout}
488 488
489 %If you take a look at the contents of \filename{myfile} after the 489 %If you take a look at the contents of \filename{myfile} after the
490 %backout finishes, you'll see that the first and third changes are 490 %backout finishes, you'll see that the first and third changes are
503 %is. It then backs out the target changeset, and commits that as a 503 %is. It then backs out the target changeset, and commits that as a
504 %changeset. Finally, it merges back to the previous parent of the 504 %changeset. Finally, it merges back to the previous parent of the
505 %working directory, and commits the result of the merge. 505 %working directory, and commits the result of the merge.
506 506
507 $B?^(B\ref{fig:undo:backout-non-tip}$B$G<($5$l$?MzNr$G!$(BMercurial$B$O(B2$B$D$N%3%_%C(B 507 $B?^(B\ref{fig:undo:backout-non-tip}$B$G<($5$l$?MzNr$G!$(BMercurial$B$O(B2$B$D$N%3%_%C(B
508 $B%H$r9T$J$C$F$$$k!%!J?^Cf$GH"$G<($5$l$?@aE@$O(BMercurial$B$,<+F0E*$K%3%_%C%H$7(B 508 $B%H$r9T$C$F$$$k!%!J?^Cf$GH"$G<($5$l$?@aE@$O(BMercurial$B$,<+F0E*$K%3%_%C%H$7(B
509 $B$?JQ99$G$"$k!%!K%P%C%/%"%&%H%W%m%;%9$NA0$K(BMercurial$B$O!$8=:_$N%o!<%-%s%0%G%#(B 509 $B$?JQ99$G$"$k!%!K%P%C%/%"%&%H%W%m%;%9$NA0$K(BMercurial$B$O!$8=:_$N%o!<%-%s%0%G%#(B
510 $B%l%/%H%j$N?F$,2?$G$"$k$+$r5-21$9$k!%$=$7$F%?!<%2%C%H$N%A%'%s%8%;%C%H$r<h(B 510 $B%l%/%H%j$N?F$,2?$G$"$k$+$r5-21$9$k!%$=$7$F%?!<%2%C%H$N%A%'%s%8%;%C%H$r<h(B
511 $B$j=|$-!$$3$l$r%A%'%s%8%;%C%H$H$7$F%3%_%C%H$9$k!%:G8e$K%o!<%-%s%0%G%#%l%/(B 511 $B$j=|$-!$$3$l$r%A%'%s%8%;%C%H$H$7$F%3%_%C%H$9$k!%:G8e$K%o!<%-%s%0%G%#%l%/(B
512 $B%H%j$NA0$N?F$X%^!<%8$r9T$J$$!$%^!<%8$N7k2L$r%3%_%C%H$9$k!%(B 512 $B%H%j$NA0$N?F$X%^!<%8$r9T$$!$%^!<%8$N7k2L$r%3%_%C%H$9$k!%(B
513 513
514 \begin{figure}[htb] 514 \begin{figure}[htb]
515 \centering 515 \centering
516 \grafix{undo-non-tip} 516 \grafix{undo-non-tip}
517 % \caption{Automated backout of a non-tip change using the 517 % \caption{Automated backout of a non-tip change using the
677 677
678 \hgcmd{backout}$B$,$I$N$h$&$KF0:n$9$k$+407k$K@bL@$9$k$H0J2<$N$h$&$K$J$k!%(B 678 \hgcmd{backout}$B$,$I$N$h$&$KF0:n$9$k$+407k$K@bL@$9$k$H0J2<$N$h$&$K$J$k!%(B
679 \begin{enumerate} 679 \begin{enumerate}
680 \item $B%o!<%-%s%0%G%#%l%/%H%j$,%/%j!<%s$G$"$k$3$H$r3NG'$9$k!%(Bi.e.\hgcmd{status} 680 \item $B%o!<%-%s%0%G%#%l%/%H%j$,%/%j!<%s$G$"$k$3$H$r3NG'$9$k!%(Bi.e.\hgcmd{status}
681 $B$,6u$G$"$k$3$H$r3NG'$9$k(B 681 $B$,6u$G$"$k$3$H$r3NG'$9$k(B
682 \item $B8=:_$N%o!<%-%s%0%G%#%l%/%H%j$N?F$r5-21$9$k$3$N%A%'%s%8%;%C%H$r(B 682 \item $B8=:_$N%o!<%-%s%0%G%#%l%/%H%j$N?F$r5-21$9$k!%$3$N%A%'%s%8%;%C%H$r(B
683 \texttt{orig}$B$H8F$V$3$H$K$9$k!%(B 683 \texttt{orig}$B$H8F$V$3$H$K$9$k!%(B
684 \item $B%o!<%-%s%0%G%#%l%/%H%j$r!$%P%C%/%"%&%H$7$?%A%'%s%8%;%C%H$NFbMF$K(B 684 \item $B%o!<%-%s%0%G%#%l%/%H%j$r!$%P%C%/%"%&%H$7$?%A%'%s%8%;%C%H$NFbMF$K(B
685 $B$9$k$?$a$K(B\hgcmd{update}$B$HEy2A$JF0:n$r9T$J$&!%$3$N%A%'%s%8%;%C%H(B 685 $B$9$k$?$a$K(B\hgcmd{update}$B$HEy2A$JF0:n$r9T$&!%$3$N%A%'%s%8%;%C%H(B
686 $B$r(B\texttt{backout}$B$H8F$V!%(B 686 $B$r(B\texttt{backout}$B$H8F$V!%(B
687 \item $B$=$N%A%'%s%8%;%C%H$N?F$r8+$D$1=P$9$3$N%A%'%s%8%;%C%H$r(B 687 \item $B$=$N%A%'%s%8%;%C%H$N?F$r8+$D$1=P$9!%$3$N%A%'%s%8%;%C%H$r(B
688 \texttt{parent}$B$H8F$V$3$H$K$9$k!%(B 688 \texttt{parent}$B$H8F$V$3$H$K$9$k!%(B
689 \item \texttt{backout}$B%A%'%s%8%;%C%H$,1F6A$9$k3F!9$N%U%!%$%k$KBP$7$F!$(B 689 \item \texttt{backout}$B%A%'%s%8%;%C%H$,1F6A$9$k3F!9$N%U%!%$%k$KBP$7$F!$(B
690 \hgcmdargs{revert}{-r parent}$B$HEy2A$JA`:n$r9T$$!$%A%'%s%8%;%C%H$,(B 690 \hgcmdargs{revert}{-r parent}$B$HEy2A$JA`:n$r9T$$!$%A%'%s%8%;%C%H$,(B
691 $B%3%_%C%H$5$l$kA0$N>uBV$KLa$9!%(B 691 $B%3%_%C%H$5$l$kA0$N>uBV$KLa$9!%(B
692 \item $B?7$7$$%A%'%s%8%;%C%H$N7k2L$r%3%_%C%H$9$k!%$3$N%A%'%s%8%;%C%H$O(B 692 \item $B?7$7$$%A%'%s%8%;%C%H$N7k2L$r%3%_%C%H$9$k!%$3$N%A%'%s%8%;%C%H$O(B
693 \texttt{backout}$B$r?F$K;}$D!%(B 693 \texttt{backout}$B$r?F$K;}$D!%(B
694 \item \hgopt{backout}{--merge}$B$r%3%^%s%I%i%$%s$+$iF~NO$7$?>l9g!$(B 694 \item \hgopt{backout}{--merge}$B$r%3%^%s%I%i%$%s$+$iF~NO$7$?>l9g!$(B
695 \texttt{orig}$B$H$N%^!<%8$r9T$J$$!$7k2L$r%3%_%C%H$9$k!%(B 695 \texttt{orig}$B$H$N%^!<%8$r9T$$!$7k2L$r%3%_%C%H$9$k!%(B
696 \end{enumerate} 696 \end{enumerate}
697 697
698 %An alternative way to implement the \hgcmd{backout} command would be 698 %An alternative way to implement the \hgcmd{backout} command would be
699 %to \hgcmd{export} the to-be-backed-out changeset as a diff, then use 699 %to \hgcmd{export} the to-be-backed-out changeset as a diff, then use
700 %the \cmdopt{patch}{--reverse} option to the \command{patch} command to 700 %the \cmdopt{patch}{--reverse} option to the \command{patch} command to
701 %reverse the effect of the change without fiddling with the working 701 %reverse the effect of the change without fiddling with the working
702 %directory. This sounds much simpler, but it would not work nearly as 702 %directory. This sounds much simpler, but it would not work nearly as
703 %well. 703 %well.
704 704
705 \hgcmd{backout}$B%3%^%s%I$r<BAu$9$kJL$NJ}K!$H$7$F!$(B\hgcmd{export}$B$G%P%C%/%"(B 705 \hgcmd{backout}$B%3%^%s%I$r<BAu$9$kJL$NJ}K!$H$7$F!$(B\hgcmd{export}$B$G%P%C%/%"(B
706 $B%&%H$5$l$k$Y$-%A%'%s%8%;%C%H$r(Bdiff$B$H$7$F=PNO$7!$(B 706 $B%&%H$5$l$k$Y$-%A%'%s%8%;%C%H$r:9J,$H$7$F=PNO$7!$(B
707 \command{patch}$B$r(B\cmdopt{patch}{--reverse}$B%*%W%7%g%sIU$-$G8F$S!$%o!<%-%s(B 707 \command{patch}$B$r(B\cmdopt{patch}{--reverse}$B%*%W%7%g%sIU$-$G8F$S!$%o!<%-%s(B
708 $B%0%G%#%l%/%H%j$NA`:n$r>JN,$7$F%j%P!<%9%Q%C%A$9$kJ}K!$,9M$($i$l$k!%(B 708 $B%0%G%#%l%/%H%j$NA`:n$r>JN,$7$F%j%P!<%9%Q%C%A$9$kJ}K!$,9M$($i$l$k!%(B
709 $B$3$NJ}K!$O$:$C$HC1=c$@$,!$$[$H$s$I$&$^$/F0$+$J$$!%(B 709 $B$3$NJ}K!$O$:$C$HC1=c$@$,!$$[$H$s$I$&$^$/F0$+$J$$!%(B
710 710
711 %The reason that \hgcmd{backout} does an update, a commit, a merge, and 711 %The reason that \hgcmd{backout} does an update, a commit, a merge, and
712 %another commit is to give the merge machinery the best chance to do a 712 %another commit is to give the merge machinery the best chance to do a
713 %good job when dealing with all the changes \emph{between} the change 713 %good job when dealing with all the changes \emph{between} the change
714 %you're backing out and the current tip. 714 %you're backing out and the current tip.
715 715
716 \hgcmd{backout}$B$,%"%C%W%G!<%H!$%3%_%C%H!$%^!<%8!$%3%_%C%H$r9T$J$&M}M3$O!$(B 716 \hgcmd{backout}$B$,%"%C%W%G!<%H!$%3%_%C%H!$%^!<%8!$%3%_%C%H$r9T$&M}M3$O!$(B
717 $B%P%C%/%"%&%H$9$Y$-JQ99$H8=:_$N%A%C%W$N4V$G!$%^!<%85!9=$,:G$bNI$$7k2L$rF@(B 717 $B%P%C%/%"%&%H$9$Y$-JQ99$H8=:_$N%A%C%W$N4V$G!$%^!<%85!9=$,:G$bNI$$7k2L$rF@(B
718 $B$i$l$k$h$&$K$9$k$?$a$G$"$k!%(B 718 $B$i$l$k$h$&$K$9$k$?$a$G$"$k!%(B
719 719
720 %If you're backing out a changeset that's~100 revisions back in your 720 %If you're backing out a changeset that's~100 revisions back in your
721 %project's history, the chances that the \command{patch} command will 721 %project's history, the chances that the \command{patch} command will
782 %repository. That's when you can safely use the \hgcmd{rollback} 782 %repository. That's when you can safely use the \hgcmd{rollback}
783 %command, as I detailed in section~\ref{sec:undo:rollback}. 783 %command, as I detailed in section~\ref{sec:undo:rollback}.
784 784
785 Mercurial$B$OMzNr$rN_@QE*$J$b$N$H$7$F07$&!%A4$F$NJQ99$O$=$l$K@hN)$DA4$F$NJQ(B 785 Mercurial$B$OMzNr$rN_@QE*$J$b$N$H$7$F07$&!%A4$F$NJQ99$O$=$l$K@hN)$DA4$F$NJQ(B
786 $B99$N>e$K$J$j$?$C$F$$$k!%0lHLE*$K8@$C$FGK2uE*$JJQ99$r2sHr$9$k$3$H$O$G$-$J(B 786 $B99$N>e$K$J$j$?$C$F$$$k!%0lHLE*$K8@$C$FGK2uE*$JJQ99$r2sHr$9$k$3$H$O$G$-$J(B
787 $B$$!%$?$C$?0l$D$NNc30$O%3%_%C%H$r9T$J$C$?D>8e$G!$B>$N%j%]%8%H%j$K%W%C%7%e(B 787 $B$$!%$?$C$?0l$D$NNc30$O%3%_%C%H$r9T$C$?D>8e$G!$B>$N%j%]%8%H%j$K%W%C%7%e(B
788 $B$b%W%k$b$5$l$F$$$J$$>l9g$G$"$k!%$=$N>l9g!$(B\ref{sec:undo:rollback}$B$N%;%/%7%g(B 788 $B$b%W%k$b$5$l$F$$$J$$>l9g$G$"$k!%$=$N>l9g!$(B\ref{sec:undo:rollback}$B$N%;%/%7%g(B
789 $B%s$G>\$7$/?($l$?$h$&$K!$0BA4$K(B\hgcmd{rollback}$B$r<B9T$9$k$3$H$,$G$-$k!%(B 789 $B%s$G>\$7$/?($l$?$h$&$K!$0BA4$K(B\hgcmd{rollback}$B$r<B9T$9$k$3$H$,$G$-$k!%(B
790 790
791 %After you've pushed a bad change to another repository, you \emph{could} 791 %After you've pushed a bad change to another repository, you \emph{could}
792 %still use \hgcmd{rollback} to make your local copy of the change 792 %still use \hgcmd{rollback} to make your local copy of the change
793 %disappear, but it won't have the consequences you want. The change will 793 %disappear, but it won't have the consequences you want. The change will
794 %still be present in the remote repository, so it will reappear in your 794 %still be present in the remote repository, so it will reappear in your
795 %local repository the next time you pull. 795 %local repository the next time you pull.
796 796
797 $B4V0c$C$?JQ99$rB>$N%j%]%8%H%j$K%W%C%7%e$7$?8e$G$b%m!<%+(B 797 $B4V0c$C$?JQ99$rB>$N%j%]%8%H%j$K%W%C%7%e$7$?8e$G$b%m!<%+%k%3%T!<$NJQ99$r<h(B
798 $B%k%3%T!<$NJQ99$r<h$j>C$9$?$a$K0MA3$H$7$F(B\hgcmd{rollback}$B$r;H$&$3$H$,(B 798 $B$j>C$9$?$a$K0MA3$H$7$F(B\hgcmd{rollback}$B$r;H$&$3$H$,(B\emph{$B$G$-$k(B}$B$,!$$3$l$O(B
799 \emph{$B$G$-$k(B}$B$,!$$3$l$O0U?^$7$?$h$&$J7k2L$K$O$J$i$J$$!%JQ99$O0MA3$H$7$F(B 799 $B0U?^$7$?$h$&$J7k2L$K$O$J$i$J$$!%JQ99$O0MA3$H$7$F%j%b!<%H$N%j%]%8%H%j$K$O(B
800 $B%j%b!<%H$N%j%]%8%H%j$K$O$=$s$6$$$7$F$*$j!$<!$K%W%k$7$?;~$K$O%m!<%+%k%j%](B 800 $BB8:_$7$F$*$j!$<!$K%W%k$7$?;~$K$O%m!<%+%k%j%]%8%H%j$K$b8=$l$k!%(B
801 $B%8%H%j$K$b8=$l$k!%(B
802 801
803 %If a situation like this arises, and you know which repositories your 802 %If a situation like this arises, and you know which repositories your
804 %bad change has propagated into, you can \emph{try} to get rid of the 803 %bad change has propagated into, you can \emph{try} to get rid of the
805 %changee from \emph{every} one of those repositories. This is, of 804 %changee from \emph{every} one of those repositories. This is, of
806 %course, not a satisfactory solution: if you miss even a single 805 %course, not a satisfactory solution: if you miss even a single
808 %wild'', and could propagate further. 807 %wild'', and could propagate further.
809 808
810 $B$3$N$h$&$J>u67$K$J$C$?;~!$$b$7$I$N%j%]%8%H%j$K$3$N4V0c$C$?JQ99$,GH5Z$7$F(B 809 $B$3$N$h$&$J>u67$K$J$C$?;~!$$b$7$I$N%j%]%8%H%j$K$3$N4V0c$C$?JQ99$,GH5Z$7$F(B
811 $B$$$k$N$+$,L@$i$+$G$"$l$P!$$=$l$i$N%j%]%8%H%j$N0l$D0l$D$+$i!$JQ99$r<h$j=|(B 810 $B$$$k$N$+$,L@$i$+$G$"$l$P!$$=$l$i$N%j%]%8%H%j$N0l$D0l$D$+$i!$JQ99$r<h$j=|(B
812 $B$/$3$H$r;n$_$k$3$H$,$G$-$k!%$3$l$O$b$A$m$sK~B-$N$$$/2r7hK!$G$O$J$$!%$b$7(B 811 $B$/$3$H$r;n$_$k$3$H$,$G$-$k!%$3$l$O$b$A$m$sK~B-$N$$$/2r7hK!$G$O$J$$!%$b$7(B
813 $B0l$D$G$b>C5n$rK:$l$l$P!$JQ99$OLnJ|$7$K$J$C$F$*$j!$$5$i$K3H$,$jF@$k!%(B 812 $B0l$D$G$b>C5n$rK:$l$l$P!$JQ99$OLnJ|$7$K$J$C$F$*$j!$$5$i$K9-$,$j$&$k!%(B
814 813
815 %If you've committed one or more changes \emph{after} the change that 814 %If you've committed one or more changes \emph{after} the change that
816 %you'd like to see disappear, your options are further reduced. 815 %you'd like to see disappear, your options are further reduced.
817 %Mercurial doesn't provide a way to ``punch a hole'' in history, 816 %Mercurial doesn't provide a way to ``punch a hole'' in history,
818 %leaving changesets intact. 817 %leaving changesets intact.
839 %of bad changeset. This is particularly easy if your team usually 838 %of bad changeset. This is particularly easy if your team usually
840 %pulls changes from a central repository. 839 %pulls changes from a central repository.
841 840
842 $B%m!<%+%k%j%]%8%H%j$K$$$/$D$+$NJQ99$r%3%_%C%H$7!$$=$l$i$,JL$N=j$K%W%C%7%e(B 841 $B%m!<%+%k%j%]%8%H%j$K$$$/$D$+$NJQ99$r%3%_%C%H$7!$$=$l$i$,JL$N=j$K%W%C%7%e(B
843 $B$^$?$O%W%k$5$l$F$$$F!$I,$:$7$bBg:R32$H$O8@$($J$$!%$"$J$?$O$$$/$D$+$N%/%i(B 842 $B$^$?$O%W%k$5$l$F$$$F!$I,$:$7$bBg:R32$H$O8@$($J$$!%$"$J$?$O$$$/$D$+$N%/%i(B
844 $B%9$N4V0c$C$?JQ99$+$i<+J,<+?H$G$_$r<i$k$3$H$,$G$-$k!%$3$l$O$"$J$?$N%A!<%`(B 843 $B%9$N4V0c$C$?JQ99$+$i<+J,<+?H$G?H$r<i$k$3$H$,$G$-$k!%$3$l$O$"$J$?$N%A!<%`(B
845 $B$,Cf1{$N%j%]%8%H%j$+$iJQ99$r%W%k$7$F$$$k>l9g$OFC$K4JC1$G$"$k!%(B 844 $B$,Cf1{$N%j%]%8%H%j$+$iJQ99$r%W%k$7$F$$$k>l9g$OFC$K4JC1$G$"$k!%(B
846 845
847 %By configuring some hooks on that repository to validate incoming 846 %By configuring some hooks on that repository to validate incoming
848 %changesets (see chapter~\ref{chap:hook}), you can automatically 847 %changesets (see chapter~\ref{chap:hook}), you can automatically
849 %prevent some kinds of bad changeset from being pushed to the central 848 %prevent some kinds of bad changeset from being pushed to the central
852 %propagate into the central repository. 851 %propagate into the central repository.
853 %Better yet, this happens without any need for explicit intervention. 852 %Better yet, this happens without any need for explicit intervention.
854 853
855 $BCf1{%j%]%8%H%j$N>e$G!$JQ99E~Ce$K%U%C%/$r@_Dj$9$k!J(B\ref{chap:hook}$B$r;2>H!K(B 854 $BCf1{%j%]%8%H%j$N>e$G!$JQ99E~Ce$K%U%C%/$r@_Dj$9$k!J(B\ref{chap:hook}$B$r;2>H!K(B
856 $B$3$H$G!$$"$k<o$N8m$C$?%A%'%s%8%;%C%H$,Cf1{%j%]%8%H%j$K%3%_%C%H$5$l$k$N$r(B 855 $B$3$H$G!$$"$k<o$N8m$C$?%A%'%s%8%;%C%H$,Cf1{%j%]%8%H%j$K%3%_%C%H$5$l$k$N$r(B
857 $B<+F0E*$KKI$0$3$H$,$G$-$k!%(B 856 $B<+F0E*$KKI$0$3$H$,$G$-$k!%$=$N$h$&$J@_Dj$r9T$&$3$H$G!$$"$k<o$N8m$C$?%A%'(B
858 $B$=$N$h$&$J@_Dj$r9T$&$3$H$G!$$"$k<o$N8m$C$?%A%'%s%8%;%C%H$O%;%s%H%i%k%j%](B 857 $B%s%8%;%C%H$OCf1{%j%]%8%H%j$KGH5Z$9$k$3$H$,$G$-$:!$;`LG$7$F$$$/798~$,$"(B
859 $B%8%H%j$KGH5Z$9$k$3$H$,$G$-$:!$;`LG$7$F$$$/798~$,$"$k!%$5$i$KNI$$$3$H$H$7(B 858 $B$k!%9%ET9g$J$3$H$K!$;`LG$OM[$K2pF~$9$kI,MW$J$/5/$-$k!#(B
860 $B$F$O!$$3$l$OL@<(E*$K2pF~$;$:$KH/@8$5$;$k$3$H$,$G$-$k$3$H$,$"$k!%(B
861 859
862 %For instance, an incoming change hook that verifies that a changeset 860 %For instance, an incoming change hook that verifies that a changeset
863 %will actually compile can prevent people from inadvertantly ``breaking 861 %will actually compile can prevent people from inadvertantly ``breaking
864 %the build''. 862 %the build''.
865 863
917 %%\end{itemize} 915 %%\end{itemize}
918 916
919 $B0J2<$O$3$N%3%^%s%I$r$I$N$h$&$KE,MQ$G$-$k$N$+M}2r$r=u$1$k%7%J%j%*$G$"$k!%(B 917 $B0J2<$O$3$N%3%^%s%I$r$I$N$h$&$KE,MQ$G$-$k$N$+M}2r$r=u$1$k%7%J%j%*$G$"$k!%(B
920 \begin{itemize} 918 \begin{itemize}
921 \item $B%P%0$,5/$-$F$$$J$+$C$?:G$b?7$7$$%P!<%8%g%s$r3P$($F$$$k$,!$$I$N%P!<(B 919 \item $B%P%0$,5/$-$F$$$J$+$C$?:G$b?7$7$$%P!<%8%g%s$r3P$($F$$$k$,!$$I$N%P!<(B
922 $B%8%g%s$G%P%0$,:.F~$7$?$+J,$+$i$J$$!%$3$3$G%P%$%J%j%F%9%H$r9T$J$$!$(B 920 $B%8%g%s$G%P%0$,:.F~$7$?$+J,$+$i$J$$!%$3$3$G%P%$%J%j%F%9%H$r9T$$!$(B
923 $B%P%0$NB8:_$rD4$Y$k!%(B 921 $B%P%0$NB8:_$rD4$Y$k!%(B
924 \item $B%P%0$rBg5^$.$G=$@5$7!$$"$J$?$N%A!<%`$N%P%0%G!<%?%Y!<%9$r%/%m!<%:(B 922 \item $B%P%0$rBg5^$.$G=$@5$7!$$"$J$?$N%A!<%`$N%P%0%G!<%?%Y!<%9$r%/%m!<%:(B
925 $B$9$k!%%P%0%G!<%?%Y!<%9$O$I$3$G%P%0$,=$@5$5$l$?$+$N%A%'%s%8%;%C%H(B 923 $B$9$k!%%P%0%G!<%?%Y!<%9$O$I$3$G%P%0$,=$@5$5$l$?$+$N%A%'%s%8%;%C%H(B
926 $B$N(BID$B$rI,MW$H$9$k$,!$$"$J$?$O$I$N%A%'%s%8%;%C%H$G=$@5$5$l$?$+5-21(B 924 $B$N(BID$B$rI,MW$H$9$k$,!$$"$J$?$O$I$N%A%'%s%8%;%C%H$G=$@5$5$l$?$+5-21(B
927 $B$7$F$$$J$$!%$3$3$G$^$?%P%0$NB8:_$r%P%$%J%j%F%9%H$9$k!%(B 925 $B$7$F$$$J$$!%$3$3$G$^$?%P%0$NB8:_$r%P%$%J%j%F%9%H$9$k!%(B
937 %command is not useful only for finding the sources of bugs. You can 935 %command is not useful only for finding the sources of bugs. You can
938 %use it to find any ``emergent property'' of a repository (anything 936 %use it to find any ``emergent property'' of a repository (anything
939 %that you can't find from a simple text search of the files in the 937 %that you can't find from a simple text search of the files in the
940 %tree) for which you can write a binary test. 938 %tree) for which you can write a binary test.
941 939
942 $B$3$NNc$+$i!$(B\hgcmd{bisect}$B%3%^%s%I$O%P%0$N$"$j$+$rC5$9$N$KLrN)$D$N$G$O$J(B 940 $B$3$NNc$+$i!$(B\hgcmd{bisect}$B%3%^%s%I$OC1$K%P%0$N=j:_$rC5$9$N$KLrN)$D$@$1$G(B
943 $B$$$3$H$,J,$+$k$@$m$&!%$3$N%3%^%s%I$O%P%$%J%j%F%9%H$r9T$J$$F@$k%j%]%8%H%j(B 941 $B$O$J$/!"%P%$%J%j%F%9%H$rMQ0U$G$-$k$N$G$"$l$P!"%j%]%8%H%j$G5/$-$?$"$i$f$k(B
944 $B$G5/$-$?!JC1=c$K%D%j!<$r%F%-%9%H%5!<%A$7$?$N$G$OH/8+$G$-$J$$!KJQ2=A4$F$r(B 942 $BJQ2=!JC1$K%D%j!<$r%F%-%9%H%5!<%A$7$?$N$G$OH/8+$G$-$J$$JQ2=!K$rCN$k$N$K;H(B
945 $BCN$k$N$K;H$&$3$H$,$G$-$k!%(B 943 $B$($k$3$H$,$o$+$k!#(B
946 944
947 %We'll introduce a little bit of terminology here, just to make it 945 %We'll introduce a little bit of terminology here, just to make it
948 %clear which parts of the search process are your responsibility, and 946 %clear which parts of the search process are your responsibility, and
949 %which are Mercurial's. A \emph{test} is something that \emph{you} run 947 %which are Mercurial's. A \emph{test} is something that \emph{you} run
950 %when \hgcmd{bisect} chooses a changeset.A \emph{probe} is what 948 %when \hgcmd{bisect} chooses a changeset. A \emph{probe} is what
951 %\hgcmd{bisect} runs to tell whether a revision is good. Finally, 949 %\hgcmd{bisect} runs to tell whether a revision is good. Finally,
952 %we'll use the word ``bisect'', as both a noun and a verb, to stand in 950 %we'll use the word ``bisect'', as both a noun and a verb, to stand in
953 %for the phrase ``search using the \hgcmd{bisect} command''. 951 %for the phrase ``search using the \hgcmd{bisect} command''.
954 952
955 $B$3$3$G%5!<%A$N$I$N%Q!<%H$,$"$J$?$N@UG$$KB0$7!$$I$N%Q!<%H$,(BMercurial$B$KB0$9(B 953 $B$3$3$G%5!<%A$N$I$N%Q!<%H$,$"$J$?$N@UG$$KB0$7!$$I$N%Q!<%H$,(BMercurial$B$KB0$9(B
966 %\emph{days} to find the changeset that introduced a bug. Even if you 964 %\emph{days} to find the changeset that introduced a bug. Even if you
967 %knew that the bug was introduced by one of the last 500 changesets, 965 %knew that the bug was introduced by one of the last 500 changesets,
968 %and limited your search to those, you'd still be looking at over 40 966 %and limited your search to those, you'd still be looking at over 40
969 %hours to find the changeset that introduced your bug. 967 %hours to find the changeset that introduced your bug.
970 968
971 $B%5!<%A%W%m%;%9$r<+F02=$9$k$?$s$s=_OBJ}K!$O!$A4$F$N%A%'%s%8%;%C%H$r(Bprobe 969 $B%5!<%A%W%m%;%9$r<+F02=$9$kC1=c$JJ}K!$O!$A4$F$N%A%'%s%8%;%C%H$r(Bprobe$B$9$k$3(B
972 $B$9$k$3$H$G$"$k!%$7$+$7$3$l$OKX$s$I%9%1!<%k$7$J$$!%0l$D$N%A%'%s%8%;%C%H$N(B 970 $B$H$G$"$k!%$7$+$7$3$l$OKX$s$I%9%1!<%k$7$J$$!%0l$D$N%A%'%s%8%;%C%H$N%A%'%C(B
973 $B%A%'%C%/$K(B10$BJ,$+$+$j!$%j%]%8%H%j$K%A%'%s%8%;%C%H$,(B10000$B$"$C$?$H$7$?$i!$iM(B 971 $B%/$K(B10$BJ,$+$+$j!$%j%]%8%H%j$K%A%'%s%8%;%C%H$,(B10000$B$"$C$?$H$7$?$i!$iMDY$7$N(B
974 $BDY$7$N%"%W%m!<%A$O%P%0$rH/@8$5$;$?%A%'%s%8%;%C%H$NFCDj$KJ?6Q$G(B35$BF|$+$+$k!%(B 972 $B%"%W%m!<%A$O%P%0$rH/@8$5$;$?%A%'%s%8%;%C%H$NFCDj$KJ?6Q$G(B35$BF|$+$+$k!%%P%0(B
975 $B%P%0$,:G8e$N(B500$B%A%'%s%8%;%C%H$GH/@8$7$?$3$H$,J,$+$C$F$$$F!$%5!<%A$r$=$l$i(B 973 $B$,:G8e$N(B500$B%A%'%s%8%;%C%H$GH/@8$7$?$3$H$,J,$+$C$F$$$F!$%5!<%A$r$=$l$i$N%A%'(B
976 $B$N%A%'%s%8%;%C%H$K8BDj$7$?$H$7$F$b!$%P%0$r0z$-5/$3$7$?%A%'%s%8%;%C%H$NFC(B 974 $B%s%8%;%C%H$K8BDj$7$?$H$7$F$b!$%P%0$r0z$-5/$3$7$?%A%'%s%8%;%C%H$NFCDj$K(B40
977 $BDj$K(B40$B;~4V0J>e$+$+$k!%(B 975 $B;~4V0J>e$+$+$k!%(B
978 976
979 %What the \hgcmd{bisect} command does is use its knowledge of the 977 %What the \hgcmd{bisect} command does is use its knowledge of the
980 %``shape'' of your project's revision history to perform a search in 978 %``shape'' of your project's revision history to perform a search in
981 %time proportional to the \emph{logarithm} of the number of changesets 979 %time proportional to the \emph{logarithm} of the number of changesets
982 %to check (the kind of search it performs is called a dichotomic 980 %to check (the kind of search it performs is called a dichotomic
987 %will require about 14 tests). Limit your search to the last hundred 985 %will require about 14 tests). Limit your search to the last hundred
988 %changesets, and it will take only about an hour (roughly seven tests). 986 %changesets, and it will take only about an hour (roughly seven tests).
989 987
990 \hgcmd{bisect}$B$O$"$J$?$N%W%m%8%'%/%H$N%j%S%8%g%sMzNr$N(B``$B%7%'%$%W(B''$B$NCN<1(B 988 \hgcmd{bisect}$B$O$"$J$?$N%W%m%8%'%/%H$N%j%S%8%g%sMzNr$N(B``$B%7%'%$%W(B''$B$NCN<1(B
991 $B$r!$%5!<%A$9$Y$-%A%'%s%8%;%C%H?t$N(B\emph{$BBP?t(B}$B$KHfNc$7$?;~4V$G%5!<%A$9$k$?(B 989 $B$r!$%5!<%A$9$Y$-%A%'%s%8%;%C%H?t$N(B\emph{$BBP?t(B}$B$KHfNc$7$?;~4V$G%5!<%A$9$k$?(B
992 $B$a$K;H$&!%!JFsJ,8!:w$r9T$J$&!%!K$3$N%"%W%m!<%A$K$h$C$F(B10000$B%A%'%s%8%;%C%H(B 990 $B$a$K;H$&!%!JFsJ,C5:w$r9T$&!%!K$3$N%"%W%m!<%A$K$h$C$F(B10000$B%A%'%s%8%;%C%H(B
993 $B$N%5!<%A$O!$3F!9$N%5!<%A$,(B10$BJ,$+$+$C$?$H$7$F$b!$%F%9%H?t$O(B14$B$G(B3$B;~4V0J2<$G(B 991 $B$N%5!<%A$O!$3F!9$N%5!<%A$,(B10$BJ,$+$+$C$?$H$7$F$b!$%F%9%H?t$O(B14$B$G(B3$B;~4V0J2<$G(B
994 $B=*N;$9$k!%:G8e$N(B100$B$N%A%'%s%8%;%C%H$K8B$C$F9T$J$C$?$H$9$k$H!$$*$h$=(B7$B2s$N(B 992 $B=*N;$9$k!%:G8e$N(B100$B$N%A%'%s%8%;%C%H$K8B$C$F9T$C$?$H$9$k$H!$$*$h$=(B7$B2s$N(B
995 $B%F%9%H$G(B1$B;~4VDxEY$G=*N;$9$k!%(B 993 $B%F%9%H$G(B1$B;~4VDxEY$G=*N;$9$k!%(B
996 994
997 %The \hgcmd{bisect} command is aware of the ``branchy'' nature of a 995 %The \hgcmd{bisect} command is aware of the ``branchy'' nature of a
998 %Mercurial project's revision history, so it has no problems dealing 996 %Mercurial project's revision history, so it has no problems dealing
999 %with branches, merges, or multiple heads in a repoository. It can 997 %with branches, merges, or multiple heads in a repoository. It can
1179 %approach increases with every changeset you add. 1177 %approach increases with every changeset you add.
1180 1178
1181 40$B8D$N%A%'%s%8%;%C%H$,$"$k$K$b$+$+$o$i$:!$(B\hgcmd{bisect}$B%3%^%s%I$O%P%0$r(B 1179 40$B8D$N%A%'%s%8%;%C%H$,$"$k$K$b$+$+$o$i$:!$(B\hgcmd{bisect}$B%3%^%s%I$O%P%0$r(B
1182 $B$b$?$i$7$?%A%'%s%8%;%C%H$r(B5$B2s$N%F%9%H$GH/8+$9$k$3$H$,$G$-$?!%(B 1180 $B$b$?$i$7$?%A%'%s%8%;%C%H$r(B5$B2s$N%F%9%H$GH/8+$9$k$3$H$,$G$-$?!%(B
1183 \hgcmd{bisect}$B$N%F%9%H2s?t$OC5:w$9$Y$-%A%'%s%8%;%C%H?t$,A}$($k$K=>$C$F!$(B 1181 \hgcmd{bisect}$B$N%F%9%H2s?t$OC5:w$9$Y$-%A%'%s%8%;%C%H?t$,A}$($k$K=>$C$F!$(B
1184 $BBP?tE($KA}$($k$,!$iMDY$7C5:w$KBP$9$kM%0L@-$O!$%A%'%s%8%;%C%H$,A}2C$9$k$K(B 1182 $BBP?tE*$KA}$($k$,!$iMDY$7C5:w$KBP$9$kM%0L@-$O!$%A%'%s%8%;%C%H$,A}2C$9$k$K(B
1185 $B=>$C$FA}2C$9$k!%(B 1183 $B=>$C$FA}2C$9$k!%(B
1186 1184
1187 1185
1188 %\subsection{Cleaning up after your search} 1186 %\subsection{Cleaning up after your search}
1189 \subsection{$B%5!<%A8e$N%/%j!<%s%"%C%W(B} 1187 \subsection{$B%5!<%A8e$N%/%j!<%s%"%C%W(B}
1206 1204
1207 %\section{Tips for finding bugs effectively} 1205 %\section{Tips for finding bugs effectively}
1208 \section{$B8zN(E*$J%P%0$NH/8+K!(B} 1206 \section{$B8zN(E*$J%P%0$NH/8+K!(B}
1209 1207
1210 %\subsection{Give consistent input} 1208 %\subsection{Give consistent input}
1211 \subsection{$B0l4S$7$?F~NO$r9T$&(B} 1209 \subsection{$B@5$7$$F~NO$r9T$&(B}
1212 1210
1213 %The \hgcmd{bisect} command requires that you correctly report the 1211 %The \hgcmd{bisect} command requires that you correctly report the
1214 %result of every test you perform. If you tell it that a test failed 1212 %result of every test you perform. If you tell it that a test failed
1215 %when it really succeeded, it \emph{might} be able to detect the 1213 %when it really succeeded, it \emph{might} be able to detect the
1216 %inconsistency. If it can identify an inconsistency in your reports, 1214 %inconsistency. If it can identify an inconsistency in your reports,
1217 %it will tell you that a particular changeset is both good and bad. 1215 %it will tell you that a particular changeset is both good and bad.
1218 %However, it can't do this perfectly; it's about as likely to report 1216 %However, it can't do this perfectly; it's about as likely to report
1219 %the wrong changeset as the source of the bug. 1217 %the wrong changeset as the source of the bug.
1220 1218
1221 \hgcmd{bisect}$B%3%^%s%I$O3F%F%9%H$G@5$7$/7k2L$rF~NO$9$k$3$H$,I,MW$G$"$k!%(B 1219 \hgcmd{bisect}$B%3%^%s%I$O3F%F%9%H$G@5$7$/7k2L$rF~NO$9$k$3$H$,I,MW$G$"$k!%(B
1222 $B$b$7%F%9%H$K@.8y$7$?$N$K<:GT$HF~NO$9$k$P!$ITDj$J>uBV$r8!CN$9$k$+$b$7$l$J(B 1220 $B$b$7%F%9%H$K@.8y$7$?$N$K<:GT$HF~NO$9$l$P!$L7=b$,@8$8$&$k!%F~NO$NCf$KL7=b(B
1223 $B$$!%F~NO$NCf$GITDj$rFCDj$G$-$l$P!$%3%^%s%I$OFCDj$N%A%'%s%8%;%C%H$,(Bgood$B$+(B 1221 $B$,$"$k$3$H$,J,$+$l$P!$%3%^%s%I$OFCDj$N%A%'%s%8%;%C%H$r(Bgood$B$+$D(Bbad$B$HI=<($9(B
1224 $B$D(Bbad$B$G$"$k$HI=<($9$k!%$7$+$740`z$K$3$l$r9T$&$3$H$OIT2DG=$G!$4V0c$C$?%A%'(B 1222 $B$k!%$7$+$7L7=b$r40`z$K8+$D$1=P$9$3$H$O:$Fq$G!$8m$C$?%A%'%s%8%;%C%H$r%P%0(B
1225 $B%s%8%;%C%H$r%P%0$N860x$@$HJs9p$9$k2DG=@-$,9b$$!%(B 1223 $B$N5/8;$HJs9p$9$k2DG=@-$,9b$$!%(B
1226 1224
1227 %\subsection{Automate as much as possible} 1225 %\subsection{Automate as much as possible}
1228 \subsection{$B$G$-$k8B$j<+F02=$9$k(B} 1226 \subsection{$B$G$-$k8B$j<+F02=$9$k(B}
1229 1227
1230 %When I started using the \hgcmd{bisect} command, I tried a few times 1228 %When I started using the \hgcmd{bisect} command, I tried a few times
1348 %Another useful situation in which to use \hgcmdargs{bisect}{--skip} is 1346 %Another useful situation in which to use \hgcmdargs{bisect}{--skip} is
1349 %if you can't test a revision because your project was in a broken and 1347 %if you can't test a revision because your project was in a broken and
1350 %hence untestable state at that revision, perhaps because someone 1348 %hence untestable state at that revision, perhaps because someone
1351 %checked in a change that prevented the project from building. 1349 %checked in a change that prevented the project from building.
1352 1350
1353 \hgcmdargs{bisect}{--skip}$B$N;HMQ$,M-MQ$J$b$&0l$DJL$N>u67$O!$C/$+$,%S%k%I(B 1351 \hgcmdargs{bisect}{--skip}$B$,M-8z$JJL$NNc$H$7$F!$%S%k%IITG=$K$J$kJQ99$,(B
1354 $B$G$-$J$/$J$k$h$&$JJQ99$r%A%'%C%/%$%s$7$?$?$a$K!$;n$=$&$H$7$F$$$k%j%S%8%g(B 1352 $B%A%'%C%/%$%s$5$l$?%j%S%8%g%s$,$"$j!$$3$l$rHt$P$5$J$1$l$P%F%9%H$,$G$-$J$$(B
1355 $B%s$,%S%k%I$G$-$:!$$=$N%j%S%8%g%s$r%F%9%H$G$-$J$$$h$&$J>l9g$G$"$k!%(B 1353 $B$h$&$J>u67$,$"$k!%(B
1356
1357 1354
1358 %\subsection{Bracket your search lazily} 1355 %\subsection{Bracket your search lazily}
1359 \subsection{$BC5:w$rBUBF$K%V%i%1%C%H$9$k(B} 1356 \subsection{$BC5:w$rBUBF$K%V%i%1%C%H$9$k(B}
1360 1357
1361 %Choosing the first ``good'' and ``bad'' changesets that will mark the 1358 %Choosing the first ``good'' and ``bad'' changesets that will mark the