Mercurial > hgbook
annotate ja/undo.tex @ 385:b7cdede6065f
updated to core bisect command
author | Yoshiki Yazawa <yaz@honeyplanet.jp> |
---|---|
date | Sat, 21 Feb 2009 22:07:30 +0900 |
parents | 32d33b238b7e |
children | 8a3041e6f3cb |
rev | line source |
---|---|
291
504f23b4f625
started japanese translation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
290
diff
changeset
|
1 %\chapter{Finding and fixing your mistakes} |
504f23b4f625
started japanese translation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
290
diff
changeset
|
2 \chapter{$B%_%9$NH/8+$H=$@5(B} |
121
9094c9fda8ec
Start chapter on error recovery.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
3 \label{chap:undo} |
9094c9fda8ec
Start chapter on error recovery.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
4 |
291
504f23b4f625
started japanese translation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
290
diff
changeset
|
5 %To err might be human, but to really handle the consequences well |
504f23b4f625
started japanese translation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
290
diff
changeset
|
6 %takes a top-notch revision control system. In this chapter, we'll |
504f23b4f625
started japanese translation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
290
diff
changeset
|
7 %discuss some of the techniques you can use when you find that a |
504f23b4f625
started japanese translation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
290
diff
changeset
|
8 %problem has crept into your project. Mercurial has some highly |
504f23b4f625
started japanese translation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
290
diff
changeset
|
9 %capable features that will help you to isolate the sources of |
504f23b4f625
started japanese translation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
290
diff
changeset
|
10 %problems, and to handle them appropriately. |
121
9094c9fda8ec
Start chapter on error recovery.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
11 |
291
504f23b4f625
started japanese translation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
290
diff
changeset
|
12 $B%j%S%8%g%s%3%s%H%m!<%k%7%9%F%`$K$O?M$NHH$7$?4V0c$$$r$&$^$/=hM}$9$k5!G=$,(B |
504f23b4f625
started japanese translation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
290
diff
changeset
|
13 $B5a$a$i$l$F$$$k!%$3$N>O$G$O!$%W%m%8%'%/%H$K5/$3$jF@$kLdBj$N2r7h$KMxMQ2DG=(B |
504f23b4f625
started japanese translation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
290
diff
changeset
|
14 $B$J%F%/%K%C%/$K$D$$$F=R$Y$k!%(BMercurial$B$K$OLdBj$N$"$k%=!<%9$r@Z$jJ,$1!$=hM}(B |
504f23b4f625
started japanese translation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
290
diff
changeset
|
15 $B$9$k6/NO$J5!G=$,$"$k!%(B |
504f23b4f625
started japanese translation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
290
diff
changeset
|
16 |
504f23b4f625
started japanese translation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
290
diff
changeset
|
17 |
504f23b4f625
started japanese translation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
290
diff
changeset
|
18 %\section{Erasing local history} |
504f23b4f625
started japanese translation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
290
diff
changeset
|
19 \section{$B%m!<%+%k%R%9%H%j!<$r>C5n$9$k(B} |
121
9094c9fda8ec
Start chapter on error recovery.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
20 |
291
504f23b4f625
started japanese translation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
290
diff
changeset
|
21 %\subsection{The accidental commit} |
504f23b4f625
started japanese translation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
290
diff
changeset
|
22 \subsection{$B%"%/%7%G%s%H$K$h$k%3%_%C%H(B} |
504f23b4f625
started japanese translation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
290
diff
changeset
|
23 |
504f23b4f625
started japanese translation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
290
diff
changeset
|
24 %I have the occasional but persistent problem of typing rather more |
504f23b4f625
started japanese translation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
290
diff
changeset
|
25 %quickly than I can think, which sometimes results in me committing a |
504f23b4f625
started japanese translation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
290
diff
changeset
|
26 %changeset that is either incomplete or plain wrong. In my case, the |
504f23b4f625
started japanese translation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
290
diff
changeset
|
27 %usual kind of incomplete changeset is one in which I've created a new |
504f23b4f625
started japanese translation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
290
diff
changeset
|
28 %source file, but forgotten to \hgcmd{add} it. A ``plain wrong'' |
504f23b4f625
started japanese translation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
290
diff
changeset
|
29 %changeset is not as common, but no less annoying. |
121
9094c9fda8ec
Start chapter on error recovery.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
30 |
291
504f23b4f625
started japanese translation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
290
diff
changeset
|
31 $BI.<T$K$O%?%$%T%s%0Cf$K9M$($k$h$j$b@h$K;X$,F0$$$F$7$^$&JJ$,0JA0$+$i$"$j!$(B |
504f23b4f625
started japanese translation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
290
diff
changeset
|
32 $B$?$^$K$3$l$,5/$-$k$H!$IT40A4$@$C$?$j4V0c$C$?FbMF$N%A%'%s%8%;%C%H$r%3%_%C(B |
504f23b4f625
started japanese translation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
290
diff
changeset
|
33 $B%H$7$F$7$^$&!%I.<T$N>l9g!$IT40A4$J%A%'%s%8%;%C%H$NE57?$O?7$7$$%=!<%9%U%!(B |
504f23b4f625
started japanese translation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
290
diff
changeset
|
34 $B%$%k$r:n@.$7$?$N$K(B\hgcmd{add}$B$rK:$l$k$3$H$G!$(B``$B4V0c$C$?FbMF(B''$B$N%3%_%C%H(B |
504f23b4f625
started japanese translation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
290
diff
changeset
|
35 $B$O$"$^$j5/$-$J$$$,!$$d$O$jF1$8$h$&$KLq2p$G$"$k!%(B |
121
9094c9fda8ec
Start chapter on error recovery.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
36 |
291
504f23b4f625
started japanese translation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
290
diff
changeset
|
37 |
504f23b4f625
started japanese translation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
290
diff
changeset
|
38 %\subsection{Rolling back a transaction} |
504f23b4f625
started japanese translation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
290
diff
changeset
|
39 \subsection{$B%H%i%s%6%/%7%g%s$N%m!<%k%P%C%/(B} |
126
fa3c43dd3a1e
More undo-related verbiage.
Bryan O'Sullivan <bos@serpentine.com>
parents:
125
diff
changeset
|
40 \label{sec:undo:rollback} |
121
9094c9fda8ec
Start chapter on error recovery.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
41 |
291
504f23b4f625
started japanese translation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
290
diff
changeset
|
42 %In section~\ref{sec:concepts:txn}, I mentioned that Mercurial treats |
504f23b4f625
started japanese translation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
290
diff
changeset
|
43 %each modification of a repository as a \emph{transaction}. Every time |
504f23b4f625
started japanese translation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
290
diff
changeset
|
44 %you commit a changeset or pull changes from another repository, |
504f23b4f625
started japanese translation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
290
diff
changeset
|
45 %Mercurial remembers what you did. You can undo, or \emph{roll back}, |
504f23b4f625
started japanese translation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
290
diff
changeset
|
46 %exactly one of these actions using the \hgcmd{rollback} command. (See |
504f23b4f625
started japanese translation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
290
diff
changeset
|
47 %section~\ref{sec:undo:rollback-after-push} for an important caveat |
504f23b4f625
started japanese translation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
290
diff
changeset
|
48 %about the use of this command.) |
504f23b4f625
started japanese translation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
290
diff
changeset
|
49 |
504f23b4f625
started japanese translation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
290
diff
changeset
|
50 \ref{sec:concepts:txn}$B@a$G!$(BMercurial$B$O%j%]%8%H%j$X$N8D!9$NJQ99$r(B\emph{$B%H(B |
504f23b4f625
started japanese translation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
290
diff
changeset
|
51 $B%i%s%6%/%7%g%s(B}$B$H$7$F07$&$H$$$&$3$H$r=R$Y$?!%(BMercurial$B$O!$JL$N%j%]%8%H%j(B |
504f23b4f625
started japanese translation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
290
diff
changeset
|
52 $B$X$N%A%'%s%8%;%C%H$N%3%_%C%H$dJQ99$N(Bpull$B$r5-21$7$F$$$k!%%f!<%6$O(Bundo$B$7$?(B |
504f23b4f625
started japanese translation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
290
diff
changeset
|
53 $B$j!$0l2s$K8B$j%"%/%7%g%s$r(B\hgcmd{rollback}$B%3%^%s%I$G(B\emph{$B%m!<%k%P%C%/(B}$B$9(B |
504f23b4f625
started japanese translation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
290
diff
changeset
|
54 $B$k$3$H$,$G$-$k!%(B($B$3$N%3%^%s%I$N=EMW$J@)Ls$K$D$$$F$O(B |
504f23b4f625
started japanese translation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
290
diff
changeset
|
55 \ref{sec:undo:rollback-after-push}$B$r;2>H$N$3$H!%(B) |
504f23b4f625
started japanese translation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
290
diff
changeset
|
56 |
121
9094c9fda8ec
Start chapter on error recovery.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
57 |
291
504f23b4f625
started japanese translation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
290
diff
changeset
|
58 %Here's a mistake that I often find myself making: committing a change |
504f23b4f625
started japanese translation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
290
diff
changeset
|
59 %in which I've created a new file, but forgotten to \hgcmd{add} it. |
504f23b4f625
started japanese translation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
290
diff
changeset
|
60 %\interaction{rollback.commit} |
504f23b4f625
started japanese translation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
290
diff
changeset
|
61 %Looking at the output of \hgcmd{status} after the commit immediately |
504f23b4f625
started japanese translation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
290
diff
changeset
|
62 %confirms the error. |
504f23b4f625
started japanese translation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
290
diff
changeset
|
63 %\interaction{rollback.status} |
504f23b4f625
started japanese translation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
290
diff
changeset
|
64 %The commit captured the changes to the file \filename{a}, but not the |
504f23b4f625
started japanese translation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
290
diff
changeset
|
65 %new file \filename{b}. If I were to push this changeset to a |
504f23b4f625
started japanese translation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
290
diff
changeset
|
66 %repository that I shared with a colleague, the chances are high that |
504f23b4f625
started japanese translation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
290
diff
changeset
|
67 %something in \filename{a} would refer to \filename{b}, which would not |
504f23b4f625
started japanese translation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
290
diff
changeset
|
68 %be present in their repository when they pulled my changes. I would |
504f23b4f625
started japanese translation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
290
diff
changeset
|
69 %thus become the object of some indignation. |
504f23b4f625
started japanese translation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
290
diff
changeset
|
70 |
504f23b4f625
started japanese translation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
290
diff
changeset
|
71 $BI.<T$,NI$/5/$3$9%_%9$O!$?7$7$$%U%!%$%k$r:n@.$7$?%A%'%s%8%;%C%H$r%3%_%C%H(B |
504f23b4f625
started japanese translation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
290
diff
changeset
|
72 $B$9$k;~$K(B\hgcmd{add}$B$N<B9T$rK:$l$k$b$N$G$"$k!%(B |
121
9094c9fda8ec
Start chapter on error recovery.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
73 \interaction{rollback.commit} |
291
504f23b4f625
started japanese translation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
290
diff
changeset
|
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 |
504f23b4f625
started japanese translation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
290
diff
changeset
|
75 $B$,$o$+$k!%(B |
121
9094c9fda8ec
Start chapter on error recovery.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
76 \interaction{rollback.status} |
291
504f23b4f625
started japanese translation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
290
diff
changeset
|
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 |
504f23b4f625
started japanese translation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
290
diff
changeset
|
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 |
504f23b4f625
started japanese translation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
290
diff
changeset
|
79 $B$r9T$J$C$?$H$7$?$i!$H`$i$,JQ99$r%W%k$7$?;~!$(B\filename{a}$B$NCf$N2?$+$,H`$i(B |
504f23b4f625
started japanese translation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
290
diff
changeset
|
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 |
504f23b4f625
started japanese translation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
290
diff
changeset
|
81 $B$?$iI.<T$OF1N=$NE\$j$rGc$&$3$H$K$J$k$@$m$&!%(B |
121
9094c9fda8ec
Start chapter on error recovery.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
82 |
291
504f23b4f625
started japanese translation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
290
diff
changeset
|
83 %However, luck is with me---I've caught my error before I pushed the |
504f23b4f625
started japanese translation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
290
diff
changeset
|
84 %changeset. I use the \hgcmd{rollback} command, and Mercurial makes |
504f23b4f625
started japanese translation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
290
diff
changeset
|
85 %that last changeset vanish. |
504f23b4f625
started japanese translation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
290
diff
changeset
|
86 %\interaction{rollback.rollback} |
504f23b4f625
started japanese translation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
290
diff
changeset
|
87 %Notice that the changeset is no longer present in the repository's |
504f23b4f625
started japanese translation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
290
diff
changeset
|
88 %history, and the working directory once again thinks that the file |
504f23b4f625
started japanese translation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
290
diff
changeset
|
89 %\filename{a} is modified.The commit and rollback have left the |
504f23b4f625
started japanese translation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
290
diff
changeset
|
90 %working directory exactly as it was prior to the commit; the changeset |
504f23b4f625
started japanese translation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
290
diff
changeset
|
91 %has been completely erased. I can now safely \hgcmd{add} the file |
504f23b4f625
started japanese translation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
290
diff
changeset
|
92 %\filename{b}, and rerun my commit. |
504f23b4f625
started japanese translation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
290
diff
changeset
|
93 %\interaction{rollback.add} |
504f23b4f625
started japanese translation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
290
diff
changeset
|
94 |
504f23b4f625
started japanese translation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
290
diff
changeset
|
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 |
504f23b4f625
started japanese translation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
290
diff
changeset
|
96 \hgcmd{rollback}$B%3%^%s%I$r;HMQ$9$k$3$H$G(BMercurial$B$+$i:G8e$N99?7$r<h$j=|(B |
504f23b4f625
started japanese translation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
290
diff
changeset
|
97 $B$/$3$H$,$G$-$k!%(B |
121
9094c9fda8ec
Start chapter on error recovery.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
98 \interaction{rollback.rollback} |
291
504f23b4f625
started japanese translation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
290
diff
changeset
|
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 |
504f23b4f625
started japanese translation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
290
diff
changeset
|
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 |
504f23b4f625
started japanese translation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
290
diff
changeset
|
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 |
348
32d33b238b7e
made changes to the source files to be compiled at any rate.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
314
diff
changeset
|
102 $BA4$K>C5n$5$l$k!%$3$N>uBV$G0BA4$K(B\hgcmd{add} \filename{b}$B$7!$$b$&0lEY(B |
291
504f23b4f625
started japanese translation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
290
diff
changeset
|
103 commit$B$9$k$3$H$,$G$-$k!%(B |
504f23b4f625
started japanese translation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
290
diff
changeset
|
104 \interaction{rollback.rollback} |
504f23b4f625
started japanese translation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
290
diff
changeset
|
105 |
504f23b4f625
started japanese translation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
290
diff
changeset
|
106 %\subsection{The erroneous pull} |
305 | 107 \subsection{$B8m$C$?%W%k(B} |
121
9094c9fda8ec
Start chapter on error recovery.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
108 |
291
504f23b4f625
started japanese translation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
290
diff
changeset
|
109 %It's common practice with Mercurial to maintain separate development |
504f23b4f625
started japanese translation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
290
diff
changeset
|
110 %branches of a project in different repositories. Your development |
504f23b4f625
started japanese translation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
290
diff
changeset
|
111 %team might have one shared repository for your project's ``0.9'' |
504f23b4f625
started japanese translation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
290
diff
changeset
|
112 %release, and another, containing different changes, for the ``1.0'' |
504f23b4f625
started japanese translation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
290
diff
changeset
|
113 %release. |
121
9094c9fda8ec
Start chapter on error recovery.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
114 |
291
504f23b4f625
started japanese translation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
290
diff
changeset
|
115 Mercurial$B$r;H$C$FJL!9$N3+H/%V%i%s%A$rJL!9$N%j%]%8%H%j$G4IM}$9$k$3$H$,$h$/(B |
504f23b4f625
started japanese translation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
290
diff
changeset
|
116 $B$"$k!%$"$J$?$N3+H/%A!<%`$O%W%m%8%'%/%H$N%j%j!<%9(B0.9$B$N$?$a$K(B1$B$D$N6&M-%j%](B |
504f23b4f625
started japanese translation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
290
diff
changeset
|
117 $B%8%H%j$r;}$A!$%j%j!<%9(B1.0$B$N$?$a$K0[$J$kJQ99$r;}$C$?$b$&0l$DJL$N%j%]%8%H(B |
504f23b4f625
started japanese translation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
290
diff
changeset
|
118 $B%j$r$b$C$F$$$k!%(B |
121
9094c9fda8ec
Start chapter on error recovery.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
119 |
291
504f23b4f625
started japanese translation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
290
diff
changeset
|
120 %Given this, you can imagine that the consequences could be messy if |
504f23b4f625
started japanese translation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
290
diff
changeset
|
121 %you had a local ``0.9'' repository, and accidentally pulled changes |
504f23b4f625
started japanese translation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
290
diff
changeset
|
122 %from the shared ``1.0'' repository into it. At worst, you could be |
504f23b4f625
started japanese translation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
290
diff
changeset
|
123 %paying insufficient attention, and push those changes into the shared |
504f23b4f625
started japanese translation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
290
diff
changeset
|
124 %``0.9'' tree, confusing your entire team (but don't worry, we'll |
504f23b4f625
started japanese translation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
290
diff
changeset
|
125 %return to this horror scenario later). However, it's more likely that |
504f23b4f625
started japanese translation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
290
diff
changeset
|
126 %you'll notice immediately, because Mercurial will display the URL it's |
504f23b4f625
started japanese translation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
290
diff
changeset
|
127 %pulling from, or you will see it pull a suspiciously large number of |
504f23b4f625
started japanese translation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
290
diff
changeset
|
128 %changes into the repository. |
121
9094c9fda8ec
Start chapter on error recovery.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
129 |
291
504f23b4f625
started japanese translation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
290
diff
changeset
|
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 |
504f23b4f625
started japanese translation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
290
diff
changeset
|
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 |
504f23b4f625
started japanese translation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
290
diff
changeset
|
132 $B$7$^$$!$3+H/%A!<%`A4BN$r:.Mp$5$;$F$7$^$&$3$H$,M-$jF@$k!%!J$3$N>l9g$I$&$9(B |
504f23b4f625
started japanese translation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
290
diff
changeset
|
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 |
504f23b4f625
started japanese translation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
290
diff
changeset
|
134 $B$D$K==J,$J5pBg$JJQ99$rI=<($9$k$?$a!$B(:B$K5$$E$/2DG=@-$,9b$$!%(B |
121
9094c9fda8ec
Start chapter on error recovery.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
135 |
291
504f23b4f625
started japanese translation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
290
diff
changeset
|
136 %The \hgcmd{rollback} command will work nicely to expunge all of the |
504f23b4f625
started japanese translation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
290
diff
changeset
|
137 %changesets that you just pulled. Mercurial groups all changes from |
504f23b4f625
started japanese translation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
290
diff
changeset
|
138 %one \hgcmd{pull} into a single transaction, so one \hgcmd{rollback} is |
504f23b4f625
started japanese translation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
290
diff
changeset
|
139 %all you need to undo this mistake. |
504f23b4f625
started japanese translation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
290
diff
changeset
|
140 |
504f23b4f625
started japanese translation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
290
diff
changeset
|
141 \hgcmd{rollback}$B%3%^%s%I$r<B9T$9$l$P!$:#%W%k$7$?$P$+$j$N%A%'%s%8%;%C%H$r(B |
504f23b4f625
started japanese translation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
290
diff
changeset
|
142 $BA4$F>C5n$9$k$3$H$,$G$-$k!%(BMercurial$B$O0l2s(B\hgcmd{pull}$B$K$h$k%H%i%s%6%/%7%g(B |
504f23b4f625
started japanese translation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
290
diff
changeset
|
143 $B%s$G$b$?$i$5$l$?A4$F$N%A%'%s%8%;%C%H$r%0%k!<%W2=$7$F$$$k$N$G!$(B |
504f23b4f625
started japanese translation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
290
diff
changeset
|
144 \hgcmd{rollback}$B$r0lEY<B9T$9$k$@$1$G!$%_%9$rA4$F$d$jD>$9$3$H$,$G$-$k!%(B |
504f23b4f625
started japanese translation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
290
diff
changeset
|
145 |
504f23b4f625
started japanese translation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
290
diff
changeset
|
146 |
504f23b4f625
started japanese translation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
290
diff
changeset
|
147 %\subsection{Rolling back is useless once you've pushed} |
504f23b4f625
started japanese translation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
290
diff
changeset
|
148 \subsection{$B0lEY%W%C%7%e$7$?8e$G$O%m!<%k%P%C%/$G$-$J$$(B} |
200
9bba958be4c6
Mention automatic example generation.
Bryan O'Sullivan <bos@serpentine.com>
parents:
131
diff
changeset
|
149 \label{sec:undo:rollback-after-push} |
121
9094c9fda8ec
Start chapter on error recovery.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
150 |
291
504f23b4f625
started japanese translation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
290
diff
changeset
|
151 %The value of the \hgcmd{rollback} command drops to zero once you've |
504f23b4f625
started japanese translation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
290
diff
changeset
|
152 %pushed your changes to another repository. Rolling back a change |
504f23b4f625
started japanese translation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
290
diff
changeset
|
153 %makes it disappear entirely, but \emph{only} in the repository in |
504f23b4f625
started japanese translation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
290
diff
changeset
|
154 %which you perform the \hgcmd{rollback}. Because a rollback eliminates |
504f23b4f625
started japanese translation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
290
diff
changeset
|
155 %history, there's no way for the disappearance of a change to propagate |
504f23b4f625
started japanese translation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
290
diff
changeset
|
156 %between repositories. |
504f23b4f625
started japanese translation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
290
diff
changeset
|
157 |
504f23b4f625
started japanese translation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
290
diff
changeset
|
158 $BB>$N%j%]%8%H%j$KJQ99$r%W%C%7%e$7$?8e$G$O(B\hgcmd{rollback}$B$N2ACM$O%<%m$G$"(B |
504f23b4f625
started japanese translation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
290
diff
changeset
|
159 $B$k!%JQ99$r%m!<%k%P%C%/$9$k$3$H$K$h$C$FJQ99$O40A4$K>CLG$9$k$,!$$=$l$O$"$J(B |
504f23b4f625
started japanese translation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
290
diff
changeset
|
160 $B$?$,(B\hgcmd{rollback}$B$r<B9T$7$?%j%]%8%H%j$K8B$C$F$N$3$H$G$"$k!%%m!<%k%P%C(B |
504f23b4f625
started japanese translation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
290
diff
changeset
|
161 $B%/$K$h$C$F!JJQ99$N!KMzNr<+BN$,$J$+$C$?$3$H$K$J$k$N$G!$JQ99$N>CLG$rB>$N%j(B |
504f23b4f625
started japanese translation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
290
diff
changeset
|
162 $B%]%8%H%j$KGH5Z$5$;$k<jCJ$O$J$$!%(B |
121
9094c9fda8ec
Start chapter on error recovery.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
163 |
291
504f23b4f625
started japanese translation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
290
diff
changeset
|
164 %If you've pushed a change to another repository---particularly if it's a |
504f23b4f625
started japanese translation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
290
diff
changeset
|
165 %shared repository---it has essentially ``escaped into the wild,'' and |
504f23b4f625
started japanese translation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
290
diff
changeset
|
166 %you'll have to recover from your mistake in a different way. What will |
504f23b4f625
started japanese translation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
290
diff
changeset
|
167 %happen if you push a changeset somewhere, then roll it back, then pull |
504f23b4f625
started japanese translation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
290
diff
changeset
|
168 %from the repository you pushed to, is that the changeset will reappear |
504f23b4f625
started japanese translation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
290
diff
changeset
|
169 %in your repository. |
504f23b4f625
started japanese translation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
290
diff
changeset
|
170 |
504f23b4f625
started japanese translation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
290
diff
changeset
|
171 $B$b$7$"$J$?$,B>$N%j%]%8%H%j!JFC$K6&M-%j%]%8%H%j!K$KJQ99$r%W%C%7%e$7$F$$$k(B |
504f23b4f625
started japanese translation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
290
diff
changeset
|
172 $B$N$J$i!$:$$C$?;vBV$,5/$3$C$F$*$j!$JL$NJ}K!$G%_%9$+$iI|5l$9$kI,MW$,$"$k!%(B |
504f23b4f625
started japanese translation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
290
diff
changeset
|
173 $B%A%'%s%8%;%C%H$r$I$3$+$X%W%C%7%e$7$?8e$G%m!<%k%P%C%/$7!$%W%C%7%e@h$N%j%](B |
504f23b4f625
started japanese translation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
290
diff
changeset
|
174 $B%8%H%j$+$i:F$S%W%k$7$?>l9g!$%A%'%s%8%;%C%H$,%m!<%+%k%j%]%8%H%j$K:F$S8=$l(B |
504f23b4f625
started japanese translation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
290
diff
changeset
|
175 $B$k!%(B |
121
9094c9fda8ec
Start chapter on error recovery.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
176 |
305 | 177 %(If you absolutely know for sure that the change you want to roll back |
178 %is the most recent change in the repository that you pushed to, | |
179 %\emph{and} you know that nobody else could have pulled it from that | |
180 %repository, you can roll back the changeset there, too, but you really | |
181 %should really not rely on this working reliably. If you do this, | |
182 %sooner or later a change really will make it into a repository that | |
183 %you don't directly control (or have forgotten about), and come back to | |
184 %bite you.) | |
121
9094c9fda8ec
Start chapter on error recovery.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
185 |
291
504f23b4f625
started japanese translation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
290
diff
changeset
|
186 $B!J$b$7%m!<%k%P%C%/$7$?$$%A%'%s%8%;%C%H$,%W%C%7%e@h$N%j%]%8%H%j$G:G?7$G$"(B |
504f23b4f625
started japanese translation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
290
diff
changeset
|
187 $B$j!$$+$D!$C/$b$=$l$r%W%k$7$F$$$J$$$3$H$,3N<B$G$"$k>l9g$O!$%W%C%7%e@h$N%j(B |
504f23b4f625
started japanese translation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
290
diff
changeset
|
188 $B%]%8%H%j$G%m!<%k%P%C%/$9$k$3$H$,2DG=$@$,!$$3$NJ}K!$O3N<B$G$O$J$$$H$$$&$3(B |
504f23b4f625
started japanese translation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
290
diff
changeset
|
189 $B$H$r4N$KL?$8$F$*$/$Y$-$G$"$k!%$3$NJ}K!$OD>@\%3%s%H%m!<%k$G$-$J$+$C$?$j!$(B |
504f23b4f625
started japanese translation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
290
diff
changeset
|
190 $B$=$NJ}K!$rK:$l$F$7$^$C$?%j%]%8%H%j$X$NJQ99$N=$@5$K$O;H$($J$$!%!K(B |
504f23b4f625
started japanese translation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
290
diff
changeset
|
191 |
504f23b4f625
started japanese translation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
290
diff
changeset
|
192 |
504f23b4f625
started japanese translation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
290
diff
changeset
|
193 %\subsection{You can only roll back once} |
504f23b4f625
started japanese translation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
290
diff
changeset
|
194 \subsection{$B%m!<%k%P%C%/$O0l2s$N$_(B} |
121
9094c9fda8ec
Start chapter on error recovery.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
195 |
291
504f23b4f625
started japanese translation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
290
diff
changeset
|
196 %Mercurial stores exactly one transaction in its transaction log; that |
504f23b4f625
started japanese translation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
290
diff
changeset
|
197 %transaction is the most recent one that occurred in the repository. |
504f23b4f625
started japanese translation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
290
diff
changeset
|
198 %This means that you can only roll back one transaction. If you expect |
504f23b4f625
started japanese translation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
290
diff
changeset
|
199 %to be able to roll back one transaction, then its predecessor, this is |
504f23b4f625
started japanese translation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
290
diff
changeset
|
200 %not the behaviour you will get. |
504f23b4f625
started japanese translation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
290
diff
changeset
|
201 %\interaction{rollback.twice} |
504f23b4f625
started japanese translation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
290
diff
changeset
|
202 %Once you've rolled back one transaction in a repository, you can't |
504f23b4f625
started japanese translation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
290
diff
changeset
|
203 %roll back again in that repository until you perform another commit or |
504f23b4f625
started japanese translation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
290
diff
changeset
|
204 %pull. |
504f23b4f625
started japanese translation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
290
diff
changeset
|
205 |
504f23b4f625
started japanese translation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
290
diff
changeset
|
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 |
504f23b4f625
started japanese translation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
290
diff
changeset
|
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 |
504f23b4f625
started japanese translation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
290
diff
changeset
|
208 $B%s$KLa$k$o$1$G$O$J$$!%(B |
121
9094c9fda8ec
Start chapter on error recovery.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
209 \interaction{rollback.twice} |
291
504f23b4f625
started japanese translation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
290
diff
changeset
|
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 |
504f23b4f625
started japanese translation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
290
diff
changeset
|
211 $B$G%m!<%k%P%C%/$O$G$-$J$$!%(B |
121
9094c9fda8ec
Start chapter on error recovery.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
212 |
291
504f23b4f625
started japanese translation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
290
diff
changeset
|
213 |
504f23b4f625
started japanese translation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
290
diff
changeset
|
214 %\section{Reverting the mistaken change} |
504f23b4f625
started japanese translation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
290
diff
changeset
|
215 \section{$B4V0c$C$?JQ99$r85$KLa$9(B} |
122
3af28630fe8c
How to goodbye depression by reverting one thousand times daily.
Bryan O'Sullivan <bos@serpentine.com>
parents:
121
diff
changeset
|
216 |
297 | 217 %If you make a modification to a file, and decide that you really |
218 %didn't want to change the file at all, and you haven't yet committed | |
219 %your changes, the \hgcmd{revert} command is the one you'll need. It | |
220 %looks at the changeset that's the parent of the working directory, and | |
221 %restores the contents of the file to their state as of that changeset. | |
222 %(That's a long-winded way of saying that, in the normal case, it | |
223 %undoes your modifications.) | |
224 | |
225 $B%U%!%$%k$KJQ99$r2C$($?8e$G!$JQ99$,I,MW$G$J$$$HJ,$+$j!$$^$@%3%_%C%H$5$l$F(B | |
226 $B$$$J$$;~$O(B\hgcmd{revert}$B%3%^%s%I$r;H$&$3$H$,$G$-$k!%$3$N%3%^%s%I$O%o!<%-(B | |
227 $B%s%0%G%#%l%/%H%j$N?F%A%'%s%8%;%C%H$r;2>H$7!$%U%!%$%k$NFbMF$r%A%'%s%8%;%C(B | |
228 $B%H$N>uBV$KLa$9!%!J$3$l$O$"$J$?$,2C$($?JQ99$r$/$I$/$I$7$/=R$Y$?$b$N$G$"(B | |
229 $B$k!%!K(B | |
122
3af28630fe8c
How to goodbye depression by reverting one thousand times daily.
Bryan O'Sullivan <bos@serpentine.com>
parents:
121
diff
changeset
|
230 |
297 | 231 %Let's illustrate how the \hgcmd{revert} command works with yet another |
232 %small example. We'll begin by modifying a file that Mercurial is | |
233 %already tracking. | |
234 %\interaction{daily.revert.modify} | |
235 %If we don't want that change, we can simply \hgcmd{revert} the file. | |
236 %\interaction{daily.revert.unmodify} | |
237 %The \hgcmd{revert} command provides us with an extra degree of safety | |
238 %by saving our modified file with a \filename{.orig} extension. | |
239 %\interaction{daily.revert.status} | |
240 | |
241 \hgcmd{revert}$B%3%^%s%I$,$I$N$h$&$KF0:n$9$k$+!$JL$N>.$5$JNc$G@bL@$9$k!%(B | |
242 $B$9$G$K(BMercurial$B$,4IM}$7$F$$$k%U%!%$%k$rJQ99$7$?$H$3$m$+$i;O$a$k!%(B | |
122
3af28630fe8c
How to goodbye depression by reverting one thousand times daily.
Bryan O'Sullivan <bos@serpentine.com>
parents:
121
diff
changeset
|
243 \interaction{daily.revert.modify} |
297 | 244 $B$3$NJQ99$,I,MW$G$J$$>l9g!$C1$K%U%!%$%k$K(B\hgcmd{revert}$B$r<B9T$9$l$P$h$$!%(B |
122
3af28630fe8c
How to goodbye depression by reverting one thousand times daily.
Bryan O'Sullivan <bos@serpentine.com>
parents:
121
diff
changeset
|
245 \interaction{daily.revert.unmodify} |
297 | 246 \hgcmd{revert}$B%3%^%s%I$O0BA4$N$?$a(B\filename{.orig}$B$H$$$&%U%!%$%kL>$GJQ99(B |
247 $B$r%;!<%V$9$k!%(B | |
122
3af28630fe8c
How to goodbye depression by reverting one thousand times daily.
Bryan O'Sullivan <bos@serpentine.com>
parents:
121
diff
changeset
|
248 \interaction{daily.revert.status} |
3af28630fe8c
How to goodbye depression by reverting one thousand times daily.
Bryan O'Sullivan <bos@serpentine.com>
parents:
121
diff
changeset
|
249 |
297 | 250 %Here is a summary of the cases that the \hgcmd{revert} command can |
251 %deal with. We will describe each of these in more detail in the | |
252 %section that follows. | |
253 %\begin{itemize} | |
254 %\item If you modify a file, it will restore the file to its unmodified | |
255 % state. | |
256 %\item If you \hgcmd{add} a file, it will undo the ``added'' state of | |
257 % the file, but leave the file itself untouched. | |
258 %\item If you delete a file without telling Mercurial, it will restore | |
259 % the file to its unmodified contents. | |
260 %\item If you use the \hgcmd{remove} command to remove a file, it will | |
261 % undo the ``removed'' state of the file, and restore the file to its | |
262 % unmodified contents. | |
263 %\end{itemize} | |
264 | |
265 \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 | |
124
c9aad709bd3a
Document the backout command.
Bryan O'Sullivan <bos@serpentine.com>
parents:
123
diff
changeset
|
268 \begin{itemize} |
297 | 269 \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 | |
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 | |
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 | |
276 \item \hgcmd{remove}$B%3%^%s%I$G%U%!%$%k$r>C5n$7$F$$$?>l9g!$JQ99A0$N>uBV$G(B | |
277 $B%U%!%$%k$rI|85$9$k!%(B | |
124
c9aad709bd3a
Document the backout command.
Bryan O'Sullivan <bos@serpentine.com>
parents:
123
diff
changeset
|
278 \end{itemize} |
c9aad709bd3a
Document the backout command.
Bryan O'Sullivan <bos@serpentine.com>
parents:
123
diff
changeset
|
279 |
297 | 280 |
281 %\subsection{File management errors} | |
282 \subsection{$B%U%!%$%k4IM}$N%_%9(B} | |
122
3af28630fe8c
How to goodbye depression by reverting one thousand times daily.
Bryan O'Sullivan <bos@serpentine.com>
parents:
121
diff
changeset
|
283 \label{sec:undo:mgmt} |
3af28630fe8c
How to goodbye depression by reverting one thousand times daily.
Bryan O'Sullivan <bos@serpentine.com>
parents:
121
diff
changeset
|
284 |
298 | 285 %The \hgcmd{revert} command is useful for more than just modified |
286 %files. It lets you reverse the results of all of Mercurial's file | |
287 %management commands---\hgcmd{add}, \hgcmd{remove}, and so on. | |
288 | |
289 \hgcmd{revert}$B%3%^%s%I$OC1$KJQ99$7$?%U%!%$%k$rLa$9$@$1$G$J$/!$(B | |
290 \hgcmd{add}$B!$(B\hgcmd{remove}$B$H$$$C$?(BMercurial$B$N%U%!%$%kA`:n%3%^%s%I$N7k2L(B | |
291 $B$r<h$j>C$9$3$H$,$G$-$k!%(B | |
122
3af28630fe8c
How to goodbye depression by reverting one thousand times daily.
Bryan O'Sullivan <bos@serpentine.com>
parents:
121
diff
changeset
|
292 |
298 | 293 %If you \hgcmd{add} a file, then decide that in fact you don't want |
294 %Mercurial to track it, use \hgcmd{revert} to undo the add. Don't | |
295 %worry; Mercurial will not modify the file in any way. It will just | |
296 %``unmark'' the file. | |
297 %\interaction{daily.revert.add} | |
298 | |
299 \hgcmd{add}$B$G%U%!%$%k$rDI2C$7$?8e$G!$(BMercurial$B$KDI@W$5$;$kI,MW$,$J$$$HJ,(B | |
300 $B$+$C$?;~!$(B\hgcmd{revert}$B$G(Badd$B$r<h$j>C$9$3$H$,$G$-$k!%(B\hgcmd{revert}$B$O%U%!(B | |
301 $B%$%k$N%^!<%/$r>C$9$@$1$G!$%U%!%$%k$NCf?H$O0l@ZJQ99$7$J$$$N$G?4G[$9$kI,MW(B | |
302 $B$O$J$$!%(B | |
122
3af28630fe8c
How to goodbye depression by reverting one thousand times daily.
Bryan O'Sullivan <bos@serpentine.com>
parents:
121
diff
changeset
|
303 \interaction{daily.revert.add} |
3af28630fe8c
How to goodbye depression by reverting one thousand times daily.
Bryan O'Sullivan <bos@serpentine.com>
parents:
121
diff
changeset
|
304 |
298 | 305 %Similarly, if you ask Mercurial to \hgcmd{remove} a file, you can use |
306 %\hgcmd{revert} to restore it to the contents it had as of the parent | |
307 %of the working directory. | |
308 %\interaction{daily.revert.remove} | |
309 %This works just as well for a file that you deleted by hand, without | |
310 %telling Mercurial (recall that in Mercurial terminology, this kind of | |
311 %file is called ``missing''). | |
312 %\interaction{daily.revert.missing} | |
313 | |
299 | 314 $BF1MM$K!$(B\hgcmd{remove}$B%3%^%s%I$G%U%!%$%k$r>C5n$7$?;~!$(B\hgcmd{revert}$B%3%^(B |
315 $B%s%I$G%o!<%-%s%0%G%#%l%/%H%j$N?F$NFbMF$K%U%!%$%k$rI|85$9$k$3$H$,$G$-$k!%(B | |
316 \interaction{daily.revert.remove} | |
317 $B$^$?(BMercurial$B$r;H$o$:$K<j$G>C$7$?%U%!%$%k$K$D$$$FF1$8A`:n$GI|85$9$k$3$H(B | |
318 $B$,$G$-$k!%!J(BMercurial$B$NMQ8l$G$3$l$r(Bmissing$B$H8F$s$G$$$?$3$H$r;W$$=P$7$FM_(B | |
319 $B$7$$!%!K(B | |
320 \interaction{daily.revert.missing} | |
298 | 321 |
299 | 322 %If you revert a \hgcmd{copy}, the copied-to file remains in your |
323 %working directory afterwards, untracked. Since a copy doesn't affect | |
324 %the copied-from file in any way, Mercurial doesn't do anything with | |
325 %the copied-from file. | |
326 %\interaction{daily.revert.copy} | |
327 | |
328 \hgcmd{copy}$B%3%^%s%I$r<h$j>C$7$?>l9g!$%3%T!<@h$N%U%!%$%k$O%o!<%-%s%0%G%#(B | |
329 $B%l%/%H%j$K;D$k$,(BMercurial$B$+$i$O4IM}$5$l$J$$!%%3%T!<A`:n<+BN%3%T!<85%U%!%$(B | |
330 $B%k$K1F6A$rM?$($J$$$?$a!$<h$j>C$7$K$h$C$F%3%T!<85%U%!%$%k$,1F6A$r<u$1$k$3(B | |
331 $B$H$b$J$$!%(B | |
298 | 332 |
122
3af28630fe8c
How to goodbye depression by reverting one thousand times daily.
Bryan O'Sullivan <bos@serpentine.com>
parents:
121
diff
changeset
|
333 |
299 | 334 %\subsubsection{A slightly special case: reverting a rename} |
335 \subsubsection{$B$d$dFC<l$J%1!<%9!'%j%M!<%`$N<h$j>C$7(B} | |
122
3af28630fe8c
How to goodbye depression by reverting one thousand times daily.
Bryan O'Sullivan <bos@serpentine.com>
parents:
121
diff
changeset
|
336 |
299 | 337 %If you \hgcmd{rename} a file, there is one small detail that |
338 %you should remember. When you \hgcmd{revert} a rename, it's not | |
339 %enough to provide the name of the renamed-to file, as you can see | |
340 %here. | |
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 | |
343 %still removed! This is counter-intuitive (at least to me), but at | |
344 %least it's easy to deal with. | |
345 %So remember, to revert a \hgcmd{rename}, you must provide \emph{both} | |
346 %the source and destination names. | |
122
3af28630fe8c
How to goodbye depression by reverting one thousand times daily.
Bryan O'Sullivan <bos@serpentine.com>
parents:
121
diff
changeset
|
347 |
299 | 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 | |
350 $B$r;XDj$9$k$@$1$G$OIT==J,$G$"$k!%(B | |
122
3af28630fe8c
How to goodbye depression by reverting one thousand times daily.
Bryan O'Sullivan <bos@serpentine.com>
parents:
121
diff
changeset
|
351 \interaction{daily.revert.rename} |
299 | 352 \hgcmd{status}$B$N=PNO$+$iJ,$+$k$h$&$K!$%j%M!<%`@h$N%U%!%$%k$O$b$O$d(Badd$B$5(B |
353 $B$l$?07$$$K$J$C$F$$$J$$!%$7$+$7%j%M!<%`(B\emph{$B85(B}$B$N%U%!%$%k$O$^$@>C5n$5$l(B | |
354 $B$?$^$^$K$J$C$F$$$k!%$3$l$O!J>/$J$/$H$bI.<T$K$H$C$F!KHsD>46E*$@$,!$<h$j07(B | |
355 $B$$$O4JC1$G$"$k!%(B | |
122
3af28630fe8c
How to goodbye depression by reverting one thousand times daily.
Bryan O'Sullivan <bos@serpentine.com>
parents:
121
diff
changeset
|
356 \interaction{daily.revert.rename-orig} |
299 | 357 \hgcmd{rename}$B$r<h$j>C$9:]$K$O!$85$N%U%!%$%k$H%j%M!<%`8e$N%U%!%$%k(B |
358 \emph{$BN>J}(B}$B$r;XDj$9$kI,MW$,$"$k!%(B | |
359 | |
360 %(By the way, if you rename a file, then modify the renamed-to file, | |
361 %then revert both components of the rename, when Mercurial restores the | |
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 | |
364 %renamed-from file, don't forget to copy them over.) | |
122
3af28630fe8c
How to goodbye depression by reverting one thousand times daily.
Bryan O'Sullivan <bos@serpentine.com>
parents:
121
diff
changeset
|
365 |
299 | 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 | |
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 | |
370 $B$/I,MW$,$"$k!%!K(B | |
122
3af28630fe8c
How to goodbye depression by reverting one thousand times daily.
Bryan O'Sullivan <bos@serpentine.com>
parents:
121
diff
changeset
|
371 |
299 | 372 %These fiddly aspects of reverting a rename arguably constitute a small |
373 %bug in Mercurial. | |
122
3af28630fe8c
How to goodbye depression by reverting one thousand times daily.
Bryan O'Sullivan <bos@serpentine.com>
parents:
121
diff
changeset
|
374 |
299 | 375 $B%j%M!<%`$rI|85$9$k;~$K5/$3$kLq2p$4$H$O$*$=$i$/(BMercurial$B$N%P%0$H8@$($k$+(B |
376 $B$b$7$l$J$$!%(B | |
377 | |
378 | |
379 %\section{Dealing with committed changes} | |
380 \section{$B%3%_%C%H$5$l$?JQ99$N07$$(B} | |
124
c9aad709bd3a
Document the backout command.
Bryan O'Sullivan <bos@serpentine.com>
parents:
123
diff
changeset
|
381 |
299 | 382 %Consider a case where you have committed a change $a$, and another |
383 %change $b$ on top of it; you then realise that change $a$ was | |
384 %incorrect. Mercurial lets you ``back out'' an entire changeset | |
385 %automatically, and building blocks that let you reverse part of a | |
386 %changeset by hand. | |
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 | |
389 $B$/$$$?>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 | |
124
c9aad709bd3a
Document the backout command.
Bryan O'Sullivan <bos@serpentine.com>
parents:
123
diff
changeset
|
391 |
299 | 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 | |
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 | |
396 %catastrophic consequences. To deal with those, see | |
397 %section~\ref{sec:undo:aaaiiieee}. | |
126
fa3c43dd3a1e
More undo-related verbiage.
Bryan O'Sullivan <bos@serpentine.com>
parents:
125
diff
changeset
|
398 |
299 | 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 | |
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 | |
403 | |
404 %\subsection{Backing out a changeset} | |
405 \subsection{$B%A%'%s%8%;%C%H$N%P%C%/%"%&%H(B} | |
124
c9aad709bd3a
Document the backout command.
Bryan O'Sullivan <bos@serpentine.com>
parents:
123
diff
changeset
|
406 |
300 | 407 %The \hgcmd{backout} command lets you ``undo'' the effects of an entire |
408 %changeset in an automated fashion. Because Mercurial's history is | |
409 %immutable, this command \emph{does not} get rid of the changeset you | |
410 %want to undo. Instead, it creates a new changeset that | |
411 %\emph{reverses} the effect of the to-be-undone changeset. | |
124
c9aad709bd3a
Document the backout command.
Bryan O'Sullivan <bos@serpentine.com>
parents:
123
diff
changeset
|
412 |
300 | 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 | |
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 | |
417 | |
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 | |
420 %repository with some simple changes. | |
421 %\interaction{backout.init} | |
422 | |
423 \hgcmd{backout}$B%3%^%s%I$NF0:n$O$d$dJ#;($J$N$G!$Nc$r5s$2$F@bL@$9$k$3$H$K(B | |
424 $B$9$k!%$^$:$$$/$D$+$NC1=c$JJQ99$N$"$k%j%]%8%H%j$r9M$($k!%(B | |
124
c9aad709bd3a
Document the backout command.
Bryan O'Sullivan <bos@serpentine.com>
parents:
123
diff
changeset
|
425 \interaction{backout.init} |
c9aad709bd3a
Document the backout command.
Bryan O'Sullivan <bos@serpentine.com>
parents:
123
diff
changeset
|
426 |
300 | 427 %The \hgcmd{backout} command takes a single changeset ID as its |
428 %argument; this is the changeset to back out. Normally, | |
429 %\hgcmd{backout} will drop you into a text editor to write a commit | |
430 %message, so you can record why you're backing the change out. In this | |
431 %example, we provide a commit message on the command line using the | |
432 %\hgopt{backout}{-m} option. | |
124
c9aad709bd3a
Document the backout command.
Bryan O'Sullivan <bos@serpentine.com>
parents:
123
diff
changeset
|
433 |
300 | 434 \hgcmd{backout}$B%3%^%s%I$O%P%C%/%"%&%H$9$Y$-%A%'%s%8%;%C%H$N(BID$B$r0l$D0z?t$K(B |
435 $B<h$k!%(B\hgcmd{backout}$B$O%G%U%)%k%H$G%3%_%C%H%a%C%;!<%8F~NO$N$?$a$K%F%-%9%H(B | |
436 $B%(%G%#%?$r5/F0$9$k$N$G!%%P%C%/%"%&%H$NM}M3$r5-O?$7$F$*$/!%$3$NNc$G$O(B | |
437 \hgopt{backout}{-m}$B%*%W%7%g%s$r;H$C$F%3%_%C%H%a%C%;!<%8$r5-O?$7$F$$$k!%(B | |
438 | |
439 | |
440 %\subsection{Backing out the tip changeset} | |
441 \subsection{tip$B%A%'%s%8%;%C%H$r%P%C%/%"%&%H$9$k(B} | |
124
c9aad709bd3a
Document the backout command.
Bryan O'Sullivan <bos@serpentine.com>
parents:
123
diff
changeset
|
442 |
300 | 443 %We're going to start by backing out the last changeset we committed. |
444 %\interaction{backout.simple} | |
445 %You can see that the second line from \filename{myfile} is no longer | |
446 %present. Taking a look at the output of \hgcmd{log} gives us an idea | |
447 %of what the \hgcmd{backout} command has done. | |
448 %\interaction{backout.simple.log} | |
449 %Notice that the new changeset that \hgcmd{backout} has created is a | |
450 %child of the changeset we backed out. It's easier to see this in | |
451 %figure~\ref{fig:undo:backout}, which presents a graphical view of the | |
452 %change history. As you can see, the history is nice and linear. | |
453 | |
454 $B:G8e$K%3%_%C%H$7$?%A%'%s%8%;%C%H$r%P%C%/%"%&%H$9$k$3$H$+$i;O$a$k!%(B | |
124
c9aad709bd3a
Document the backout command.
Bryan O'Sullivan <bos@serpentine.com>
parents:
123
diff
changeset
|
455 \interaction{backout.simple} |
300 | 456 \filename{myfile}$B$N(B2$B9TL\$,$J$/$J$C$F$$$k$N$,J,$+$k$H;W$&!%(B\hgcmd{log}$B$r(B |
457 $B8+$F$_$k$H!$(B\hgcmd{backout}$B$,2?$r$7$?$N$+$,J,$+$k!%(B | |
124
c9aad709bd3a
Document the backout command.
Bryan O'Sullivan <bos@serpentine.com>
parents:
123
diff
changeset
|
458 \interaction{backout.simple.log} |
300 | 459 \hgcmd{backout}$B$,@8@.$7$??7$7$$%A%'%s%8%;%C%H$O!$%P%C%/%"%&%H$7$?%A%'%s(B |
460 $B%8%;%C%H$N;R$K$J$C$F$$$k!%(B\ref{fig:undo:backout}$B$O99?7MzNr$r?^<($7$?$b$N(B | |
461 $B$G!$M}2r$N=u$1$K$J$k$O$:$@!%?^$+$iJ,$+$k$h$&$KMzNr$O@~7A$G@09g$,<h$l$F$$$k!%(B | |
124
c9aad709bd3a
Document the backout command.
Bryan O'Sullivan <bos@serpentine.com>
parents:
123
diff
changeset
|
462 |
c9aad709bd3a
Document the backout command.
Bryan O'Sullivan <bos@serpentine.com>
parents:
123
diff
changeset
|
463 \begin{figure}[htb] |
c9aad709bd3a
Document the backout command.
Bryan O'Sullivan <bos@serpentine.com>
parents:
123
diff
changeset
|
464 \centering |
c9aad709bd3a
Document the backout command.
Bryan O'Sullivan <bos@serpentine.com>
parents:
123
diff
changeset
|
465 \grafix{undo-simple} |
300 | 466 % \caption{Backing out a change using the \hgcmd{backout} command} |
467 \caption{\hgcmd{backout}$B%3%^%s%I$r;H$C$F99?7$r%P%C%/%"%&%H(B} | |
124
c9aad709bd3a
Document the backout command.
Bryan O'Sullivan <bos@serpentine.com>
parents:
123
diff
changeset
|
468 \label{fig:undo:backout} |
c9aad709bd3a
Document the backout command.
Bryan O'Sullivan <bos@serpentine.com>
parents:
123
diff
changeset
|
469 \end{figure} |
c9aad709bd3a
Document the backout command.
Bryan O'Sullivan <bos@serpentine.com>
parents:
123
diff
changeset
|
470 |
300 | 471 %\subsection{Backing out a non-tip change} |
472 \subsection{tip$B$G$J$$JQ99$r%P%C%/%"%&%H$9$k(B} | |
124
c9aad709bd3a
Document the backout command.
Bryan O'Sullivan <bos@serpentine.com>
parents:
123
diff
changeset
|
473 |
300 | 474 %If you want to back out a change other than the last one you |
475 %committed, pass the \hgopt{backout}{--merge} option to the | |
476 %\hgcmd{backout} command. | |
477 %\interaction{backout.non-tip.clone} | |
478 %This makes backing out any changeset a ``one-shot'' operation that's | |
479 %usually simple and fast. | |
480 %\interaction{backout.non-tip.backout} | |
481 | |
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 | |
124
c9aad709bd3a
Document the backout command.
Bryan O'Sullivan <bos@serpentine.com>
parents:
123
diff
changeset
|
484 \interaction{backout.non-tip.clone} |
300 | 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 |
486 $BAa$/4JC1$G$"$k!%(B | |
124
c9aad709bd3a
Document the backout command.
Bryan O'Sullivan <bos@serpentine.com>
parents:
123
diff
changeset
|
487 \interaction{backout.non-tip.backout} |
c9aad709bd3a
Document the backout command.
Bryan O'Sullivan <bos@serpentine.com>
parents:
123
diff
changeset
|
488 |
300 | 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 | |
491 %present, but not the second. | |
492 %\interaction{backout.non-tip.cat} | |
493 | |
494 $B%P%C%/%"%&%H$,=*$C$?$"$H$G(B\filename{myfile}$B$NCf?H$r8+$k$H!$(B1$BHVL\$H(B3$BHVL\(B | |
495 $B$NJQ99$@$1$,;D$C$F$*$j!$(B2$BHVL\$NJQ99$,>C$($F$$$k$3$H$,$o$+$k!%(B | |
124
c9aad709bd3a
Document the backout command.
Bryan O'Sullivan <bos@serpentine.com>
parents:
123
diff
changeset
|
496 \interaction{backout.non-tip.cat} |
c9aad709bd3a
Document the backout command.
Bryan O'Sullivan <bos@serpentine.com>
parents:
123
diff
changeset
|
497 |
300 | 498 %As the graphical history in figure~\ref{fig:undo:backout-non-tip} |
499 %illustrates, Mercurial actually commits \emph{two} changes in this | |
500 %kind of situation (the box-shaped nodes are the ones that Mercurial | |
501 %commits automatically). Before Mercurial begins the backout process, | |
502 %it first remembers what the current parent of the working directory | |
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 | |
505 %working directory, and commits the result of the merge. | |
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 | |
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 | |
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 | |
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 | |
124
c9aad709bd3a
Document the backout command.
Bryan O'Sullivan <bos@serpentine.com>
parents:
123
diff
changeset
|
513 |
c9aad709bd3a
Document the backout command.
Bryan O'Sullivan <bos@serpentine.com>
parents:
123
diff
changeset
|
514 \begin{figure}[htb] |
c9aad709bd3a
Document the backout command.
Bryan O'Sullivan <bos@serpentine.com>
parents:
123
diff
changeset
|
515 \centering |
c9aad709bd3a
Document the backout command.
Bryan O'Sullivan <bos@serpentine.com>
parents:
123
diff
changeset
|
516 \grafix{undo-non-tip} |
300 | 517 % \caption{Automated backout of a non-tip change using the |
518 % \hgcmd{backout} command} | |
519 \caption{tip$B$G$J$$JQ99$r(B\hgcmd{backout}$B%3%^%s%I$G<+F0E*$K%P%C%/%"%&%H$9$k(B} | |
124
c9aad709bd3a
Document the backout command.
Bryan O'Sullivan <bos@serpentine.com>
parents:
123
diff
changeset
|
520 \label{fig:undo:backout-non-tip} |
c9aad709bd3a
Document the backout command.
Bryan O'Sullivan <bos@serpentine.com>
parents:
123
diff
changeset
|
521 \end{figure} |
c9aad709bd3a
Document the backout command.
Bryan O'Sullivan <bos@serpentine.com>
parents:
123
diff
changeset
|
522 |
300 | 523 %The result is that you end up ``back where you were'', only with some |
524 %extra history that undoes the effect of the changeset you wanted to | |
525 %back out. | |
124
c9aad709bd3a
Document the backout command.
Bryan O'Sullivan <bos@serpentine.com>
parents:
123
diff
changeset
|
526 |
300 | 527 $B:G=*E*$K!$$$$/$i$+$NM>7W$JMzNr$r;D$7$D$D!$<h$j=|$-$?$+$C$?%A%'%s%8%;%C%H(B |
528 $B$N1F6A$r=|5n$7$F!$K>$`>uBV$KLa$9$3$H$,$G$-$F$$$k!%(B | |
529 | |
530 | |
531 %\subsubsection{Always use the \hgopt{backout}{--merge} option} | |
532 \subsubsection{$B>o$K(B\hgopt{backout}{--merge}$B%*%W%7%g%s$r;H$&(B} | |
124
c9aad709bd3a
Document the backout command.
Bryan O'Sullivan <bos@serpentine.com>
parents:
123
diff
changeset
|
533 |
300 | 534 %In fact, since the \hgopt{backout}{--merge} option will do the ``right |
535 %thing'' whether or not the changeset you're backing out is the tip | |
536 %(i.e.~it won't try to merge if it's backing out the tip, since there's | |
537 %no need), you should \emph{always} use this option when you run the | |
538 %\hgcmd{backout} command. | |
124
c9aad709bd3a
Document the backout command.
Bryan O'Sullivan <bos@serpentine.com>
parents:
123
diff
changeset
|
539 |
300 | 540 $B%P%C%/%"%&%H$7$h$&$H$9$k%A%'%s%8%;%C%H$,%A%C%W$+%A%C%W$G$J$$$+$K$+JQ$o$i(B |
541 $B$:!$(B\hgcmd{backout}$B%3%^%s%I$r;H$*$&$H$9$k;~$O(B\emph{$B>o$K(B} | |
542 \hgopt{backout}{--merge}$B%*%W%7%g%s$r;H$&$Y$-$G$"$k!%BP>]$,%A%C%W$G$"$k>l(B | |
543 $B9g$OITMW$J%^!<%8$r;n$_$k$3$H$O$J$$$?$a!$>o$K$3$N%*%W%7%g%s$r;XDj$7$FLdBj(B | |
544 $B$J$$!%(B | |
545 | |
546 | |
547 %\subsection{Gaining more control of the backout process} | |
548 \subsection{$B%P%C%/%"%&%H%W%m%;%9$r$h$j:Y$+$/@)8f$9$k(B} | |
124
c9aad709bd3a
Document the backout command.
Bryan O'Sullivan <bos@serpentine.com>
parents:
123
diff
changeset
|
549 |
303 | 550 %While I've recommended that you always use the |
551 %\hgopt{backout}{--merge} option when backing out a change, the | |
552 %\hgcmd{backout} command lets you decide how to merge a backout | |
553 %changeset. Taking control of the backout process by hand is something | |
554 %you will rarely need to do, but it can be useful to understand what | |
555 %the \hgcmd{backout} command is doing for you automatically. To | |
556 %illustrate this, let's clone our first repository, but omit the | |
557 %backout change that it contains. | |
558 | |
559 $BJQ99$r%P%C%/%"%&%H$9$k:]!$>o$K(B\hgopt{backout}{--merge}$B%*%W%7%g%s$r;H$&$3(B | |
560 $B$H$r4+$a$?$,!$(B\hgcmd{backout}$B%3%^%s%I$G$O!$%P%C%/%"%&%H$9$k%A%'%s%8%;%C%H(B | |
561 $B$r$I$N$h$&$K%^!<%8$9$k$+;XDj$9$k$3$H$,$G$-$k!%%P%C%/%"%&%H%W%m%;%9$r<j$G(B | |
562 $B%3%s%H%m!<%k$9$kI,MW$O$[$H$s$I$J$$$O$:$@$,!$(B\hgcmd{backout}$B%3%^%s%I$,<+F0(B | |
563 $B$G$I$N$h$&$KF0:n$7$F$$$k$N$+M}2r$9$k$N$K$OLrN)$D$+$bCN$l$J$$!%F0:n$r@bL@(B | |
564 $B$9$k$?$a$K:G=i$N%j%]%8%H%j$N%/%m!<%s$r!$%P%C%/%"%&%H$r=|$$$F:n$C$F;O$a$k(B | |
565 $B$3$H$K$7$h$&!%(B | |
566 | |
567 %\interaction{backout.manual.clone} | |
568 %As with our earlier example, We'll commit a third changeset, then back | |
569 %out its parent, and see what happens. | |
570 %\interaction{backout.manual.backout} | |
571 %Our new changeset is again a descendant of the changeset we backout | |
572 %out; it's thus a new head, \emph{not} a descendant of the changeset | |
573 %that was the tip. The \hgcmd{backout} command was quite explicit in | |
574 %telling us this. | |
575 %\interaction{backout.manual.log} | |
576 % | |
577 %\interaction{backout.manual.clone} | |
578 | |
579 $BA0$K;H$C$?Nc$N$h$&$K!$(B3$BHVL\$N%A%'%s%8%;%C%H$r%3%_%C%H$7$?8e$G!$$=$N?F$r(B | |
580 $B%P%C%/%"%&%H$7$F2?$,5/$-$k$+8+$F$_$h$&!%(B | |
581 \interaction{backout.manual.backout} | |
582 | |
583 $BA0$NNc$HF1MM$K!$?7$7$$%A%'%s%8%;%C%H$O%P%C%/%"%&%H$7$?%A%'%s%8%;%C%H$N;R(B | |
584 $B$K$"$?$k!%$7$?$,$C$F?7$7$$%X%C%I$O%A%C%W$N;R$G$O(B\emph{$B$J$$(B}$B!%(B | |
585 \hgcmd{backout}$B%3%^%s%I$O$3$N?F;R4X78$K$D$$$F$+$J$j$O$C$-$j$HI=<($9$k!%(B | |
586 \interaction{backout.manual.log} | |
124
c9aad709bd3a
Document the backout command.
Bryan O'Sullivan <bos@serpentine.com>
parents:
123
diff
changeset
|
587 |
c9aad709bd3a
Document the backout command.
Bryan O'Sullivan <bos@serpentine.com>
parents:
123
diff
changeset
|
588 \interaction{backout.manual.clone} |
c9aad709bd3a
Document the backout command.
Bryan O'Sullivan <bos@serpentine.com>
parents:
123
diff
changeset
|
589 |
303 | 590 %Again, it's easier to see what has happened by looking at a graph of |
591 %the revision history, in figure~\ref{fig:undo:backout-manual}.This | |
592 %makes it clear that when we use \hgcmd{backout} to back out a change | |
593 %other than the tip, Mercurial adds a new head to the repository (the | |
594 %change it committed is box-shaped). | |
595 | |
596 $B$3$3$G$b%j%S%8%g%sMzNr$N%0%i%U(B\ref{fig:undo:backout-manual}$B$r8+$l$P!$2?$,(B | |
597 $B5/$-$F$$$k$N$+M}2r$7$d$9$$!%%A%C%W0J30$NJQ99$r%P%C%/%"%&%H$9$k$?$a$K(B | |
598 \hgcmd{backout}$B$r;H$C$?;~!$(BMercurial$B$,?7$7$$%X%C%I$r%j%]%8%H%j$KDI2C$9$k(B | |
599 $B$N$,$o$+$k!%!J;M3Q$G<($5$l$?%3%_%C%H!%!K(B | |
124
c9aad709bd3a
Document the backout command.
Bryan O'Sullivan <bos@serpentine.com>
parents:
123
diff
changeset
|
600 |
c9aad709bd3a
Document the backout command.
Bryan O'Sullivan <bos@serpentine.com>
parents:
123
diff
changeset
|
601 \begin{figure}[htb] |
c9aad709bd3a
Document the backout command.
Bryan O'Sullivan <bos@serpentine.com>
parents:
123
diff
changeset
|
602 \centering |
c9aad709bd3a
Document the backout command.
Bryan O'Sullivan <bos@serpentine.com>
parents:
123
diff
changeset
|
603 \grafix{undo-manual} |
303 | 604 % \caption{Backing out a change using the \hgcmd{backout} command} |
605 \caption{\hgcmd{backout}$B%3%^%s%I$K$h$kJQ99$N%P%C%/%"%&%H(B} | |
124
c9aad709bd3a
Document the backout command.
Bryan O'Sullivan <bos@serpentine.com>
parents:
123
diff
changeset
|
606 \label{fig:undo:backout-manual} |
c9aad709bd3a
Document the backout command.
Bryan O'Sullivan <bos@serpentine.com>
parents:
123
diff
changeset
|
607 \end{figure} |
c9aad709bd3a
Document the backout command.
Bryan O'Sullivan <bos@serpentine.com>
parents:
123
diff
changeset
|
608 |
306 | 609 %After the \hgcmd{backout} command has completed, it leaves the new |
610 %``backout'' changeset as the parent of the working directory. | |
611 %\interaction{backout.manual.parents} | |
612 %Now we have two isolated sets of changes. | |
613 %\interaction{backout.manual.heads} | |
614 | |
615 \hgcmd{backout}$B%3%^%s%I$O!$40N;$7$?8e!$%P%C%/%"%&%H%A%'%s%8%;%C%H$r%o!<%-(B | |
616 $B%s%0%G%#%l%/%H%j$N?F$H$7$F;D$9!%(B | |
124
c9aad709bd3a
Document the backout command.
Bryan O'Sullivan <bos@serpentine.com>
parents:
123
diff
changeset
|
617 \interaction{backout.manual.parents} |
306 | 618 $B$3$3$G(B2$B$D$N3VN%$5$l$?JQ99$N%;%C%H$,B8:_$9$k$3$H$K$J$k!%(B |
124
c9aad709bd3a
Document the backout command.
Bryan O'Sullivan <bos@serpentine.com>
parents:
123
diff
changeset
|
619 \interaction{backout.manual.heads} |
c9aad709bd3a
Document the backout command.
Bryan O'Sullivan <bos@serpentine.com>
parents:
123
diff
changeset
|
620 |
306 | 621 |
622 %Let's think about what we expect to see as the contents of | |
623 %\filename{myfile} now. The first change should be present, because | |
624 %we've never backed it out. The second change should be missing, as | |
625 %that's the change we backed out. Since the history graph shows the | |
626 %third change as a separate head, we \emph{don't} expect to see the | |
627 %third change present in \filename{myfile}. | |
628 %\interaction{backout.manual.cat} | |
629 %To get the third change back into the file, we just do a normal merge | |
630 %of our two heads. | |
631 %\interaction{backout.manual.merge} | |
632 %Afterwards, the graphical history of our repository looks like | |
633 %figure~\ref{fig:undo:backout-manual-merge}. | |
634 | |
635 $B:#$3$3$G(B\filename{myfile}$B$NFbMF$r8+$?$$$H$9$k!%:G=i$NJQ99$O%P%C%/%"%&%H$7(B | |
636 $B$F$$$J$$$N$GB8:_$7$F$$$k$O$:$G$"$k!%(B2$BHVL\$NJQ99$O%P%C%/%"%&%H$7$?$N$G>C(B | |
637 $B$($FL5$/$J$C$F$$$k$O$:$@!%(B3$BHVL\$NJQ99$OMzNr%0%i%U$GJ,N%$7$?%X%C%I$H$7$F(B | |
638 $BI=<($5$l$k$?$a!$(B3$BHVL\$NJQ99$,(B\filename{myfile}$B$K$"$k$H$O4|BT$7$F$$$J$$!%(B | |
124
c9aad709bd3a
Document the backout command.
Bryan O'Sullivan <bos@serpentine.com>
parents:
123
diff
changeset
|
639 \interaction{backout.manual.cat} |
306 | 640 3$BHVL\$NJQ99$r%U%!%$%k$KH?1G$5$;$k$?$a$K$O!$(B2$B$D$N%X%C%I$r%^!<%8$7$F$d$l$P(B |
641 $B$h$$!%(B | |
124
c9aad709bd3a
Document the backout command.
Bryan O'Sullivan <bos@serpentine.com>
parents:
123
diff
changeset
|
642 \interaction{backout.manual.merge} |
306 | 643 $B$=$N8e$G$O%j%]%8%H%j$NMzNr$N%0%i%U$O?^(B |
644 \ref{fig:undo:backout-manual-merge}$B$N$h$&$K$J$k(B | |
124
c9aad709bd3a
Document the backout command.
Bryan O'Sullivan <bos@serpentine.com>
parents:
123
diff
changeset
|
645 |
c9aad709bd3a
Document the backout command.
Bryan O'Sullivan <bos@serpentine.com>
parents:
123
diff
changeset
|
646 \begin{figure}[htb] |
c9aad709bd3a
Document the backout command.
Bryan O'Sullivan <bos@serpentine.com>
parents:
123
diff
changeset
|
647 \centering |
c9aad709bd3a
Document the backout command.
Bryan O'Sullivan <bos@serpentine.com>
parents:
123
diff
changeset
|
648 \grafix{undo-manual-merge} |
306 | 649 % \caption{Manually merging a backout change} |
650 \caption{$B%P%C%/%"%&%H%A%'%s%8$N<jF0$K$h$k%^!<%8(B} | |
124
c9aad709bd3a
Document the backout command.
Bryan O'Sullivan <bos@serpentine.com>
parents:
123
diff
changeset
|
651 \label{fig:undo:backout-manual-merge} |
c9aad709bd3a
Document the backout command.
Bryan O'Sullivan <bos@serpentine.com>
parents:
123
diff
changeset
|
652 \end{figure} |
c9aad709bd3a
Document the backout command.
Bryan O'Sullivan <bos@serpentine.com>
parents:
123
diff
changeset
|
653 |
306 | 654 %\subsection{Why \hgcmd{backout} works as it does} |
655 \subsection{$B$J$<(B\hgcmd{backout}$B$O$3$N$h$&$KF0:n$9$k$N$+(B} | |
124
c9aad709bd3a
Document the backout command.
Bryan O'Sullivan <bos@serpentine.com>
parents:
123
diff
changeset
|
656 |
306 | 657 %Here's a brief description of how the \hgcmd{backout} command works. |
658 %\begin{enumerate} | |
659 %\item It ensures that the working directory is ``clean'', i.e.~that | |
660 % the output of \hgcmd{status} would be empty. | |
661 %\item It remembers the current parent of the working directory. Let's | |
662 % call this changeset \texttt{orig} | |
663 %\item It does the equivalent of a \hgcmd{update} to sync the working | |
664 % directory to the changeset you want to back out. Let's call this | |
665 % changeset \texttt{backout} | |
666 %\item It finds the parent of that changeset. Let's call that | |
667 % changeset \texttt{parent}. | |
668 %\item For each file that the \texttt{backout} changeset affected, it | |
669 % does the equivalent of a \hgcmdargs{revert}{-r parent} on that file, | |
670 % to restore it to the contents it had before that changeset was | |
671 % committed. | |
672 %\item It commits the result as a new changeset. This changeset has | |
673 % \texttt{backout} as its parent. | |
674 %\item If you specify \hgopt{backout}{--merge} on the command line, it | |
675 % merges with \texttt{orig}, and commits the result of the merge. | |
676 %\end{enumerate} | |
677 | |
678 \hgcmd{backout}$B$,$I$N$h$&$KF0:n$9$k$+407k$K@bL@$9$k$H0J2<$N$h$&$K$J$k!%(B | |
124
c9aad709bd3a
Document the backout command.
Bryan O'Sullivan <bos@serpentine.com>
parents:
123
diff
changeset
|
679 \begin{enumerate} |
306 | 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 | |
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 | |
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 | |
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 | |
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 | |
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 | |
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 | |
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 | |
124
c9aad709bd3a
Document the backout command.
Bryan O'Sullivan <bos@serpentine.com>
parents:
123
diff
changeset
|
696 \end{enumerate} |
c9aad709bd3a
Document the backout command.
Bryan O'Sullivan <bos@serpentine.com>
parents:
123
diff
changeset
|
697 |
306 | 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 | |
700 %the \cmdopt{patch}{--reverse} option to the \command{patch} command to | |
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 | |
703 %well. | |
124
c9aad709bd3a
Document the backout command.
Bryan O'Sullivan <bos@serpentine.com>
parents:
123
diff
changeset
|
704 |
306 | 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 | |
348
32d33b238b7e
made changes to the source files to be compiled at any rate.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
314
diff
changeset
|
707 \command{patch}$B$r(B\cmdopt{patch}{--reverse}$B%*%W%7%g%sIU$-$G8F$S!$%o!<%-%s(B |
306 | 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 | |
710 | |
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 | |
713 %good job when dealing with all the changes \emph{between} the change | |
714 %you're backing out and the current tip. | |
715 | |
716 \hgcmd{backout}$B$,%"%C%W%G!<%H!$%3%_%C%H!$%^!<%8!$%3%_%C%H$r9T$J$&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 | |
718 $B$i$l$k$h$&$K$9$k$?$a$G$"$k!%(B | |
124
c9aad709bd3a
Document the backout command.
Bryan O'Sullivan <bos@serpentine.com>
parents:
123
diff
changeset
|
719 |
306 | 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 | |
722 %be able to apply a reverse diff cleanly are not good,because | |
723 %intervening changes are likely to have ``broken the context'' that | |
724 %\command{patch} uses to determine whether it can apply a patch (if | |
725 %this sounds like gibberish, see \ref{sec:mq:patch} for a | |
726 %discussion of the \command{patch} command). | |
727 %Also, Mercurial's merge machinery will handle files and directories | |
728 %being renamed, permission changes, and modifications to binary files, | |
729 %none of which \command{patch} can deal with. | |
124
c9aad709bd3a
Document the backout command.
Bryan O'Sullivan <bos@serpentine.com>
parents:
123
diff
changeset
|
730 |
306 | 731 $B$b$7%W%m%8%'%/%H$NMzNr$NCf$G(B100$B%j%S%8%g%s$bAL$k$h$&$J%A%'%s%8%;%C%H$r%P%C(B |
732 $B%/%"%&%H$9$k$H$9$l$P!$(B\command{patch}$B$,(Bdiff$B$rE,MQ$G$-$k2DG=@-$OL@$i$+$KDc(B | |
733 $B$$!%4V$K$"$kJQ99$,!$(B\command{patch}$B%3%^%s%I$,%Q%C%AE,MQ$N2DH]$rH=CG$9$k$?(B | |
734 $B$a$NJ8L.$r2u$7$F$$$k2DG=@-$,9b$$$+$i$G$"$k!%!J$3$NOC$,J,$+$i$J$$>l9g$O(B | |
735 \ref{sec:mq:patch}$B$N(B\command{patch}$B%3%^%s%I$K4X$9$k5DO@$r;2>H$7$FM_$7$$!%!K(B | |
736 $B$^$?!$(BMercurial$B$N%^!<%85!9=$O!$(B\command{patch}$B%3%^%s%I$,07$($J$$%U%!%$%k(B | |
737 $B$H%G%#%l%/%H%j$N%j%M!<%`!$%Q!<%_%C%7%g%sJQ99!$%P%$%J%j%U%!%$%k$X$NJQ99$J(B | |
738 $B$I$r07$&$3$H$,$G$-$k!%(B | |
739 | |
740 | |
741 %\section{Changes that should never have been} | |
307 | 742 \section{$BB8:_$9$Y$-$G$J$$JQ99(B} |
126
fa3c43dd3a1e
More undo-related verbiage.
Bryan O'Sullivan <bos@serpentine.com>
parents:
125
diff
changeset
|
743 \label{sec:undo:aaaiiieee} |
fa3c43dd3a1e
More undo-related verbiage.
Bryan O'Sullivan <bos@serpentine.com>
parents:
125
diff
changeset
|
744 |
307 | 745 %Most of the time, the \hgcmd{backout} command is exactly what you need |
746 %if you want to undo the effects of a change. It leaves a permanent | |
747 %record of exactly what you did, both when committing the original | |
748 %changeset and when you cleaned up after it. | |
749 | |
750 $BBgDq$N>l9g!$(B\hgcmd{backout}$B$O$"$kJQ99$r<h$j>C$=$&$H$9$k:]$K;W$C$?$h$&$K5!(B | |
751 $BG=$9$k$O$:$G$"$k!%85!9$N%3%_%C%H$d$=$l$r<h$j=|$$$?;~$K2?$r$7$?$N$+1JB3E*(B | |
752 $B$J5-21$,;D$5$l$k!%(B | |
126
fa3c43dd3a1e
More undo-related verbiage.
Bryan O'Sullivan <bos@serpentine.com>
parents:
125
diff
changeset
|
753 |
307 | 754 %On rare occasions, though, you may find that you've committed a change |
755 %that really should not be present in the repository at all. For | |
756 %example, it would be very unusual, and usually considered a mistake, | |
757 %to commit a software project's object files as well as its source | |
758 %files.Object files have almost no intrinsic value, and they're | |
759 %\emph{big}, so they increase the size of the repository and the amount | |
760 %of time it takes to clone or pull changes. | |
761 | |
762 $B$=$l$G$b$?$^$K%j%]%8%H%j$KA4$/;D$7$?$/$J$$JQ99$r%3%_%C%H$7$F$7$^$&$3$H$,(B | |
763 $B$"$k!%$?$H$($P!$Hs>o$KJQ$J%3%_%C%H$d!$DL>o%_%9$H9M$($i$l$k$h$&$J%3%_%C%H!$(B | |
764 $B%=!<%9$@$1$G$O$J$/%W%m%8%'%/%H$N%*%V%8%'%/%H%U%!%$%k$b%3%_%C%H$7$F$7$^$&(B | |
765 $B$J$I$,M-$jF@$k!%%*%V%8%'%/%H%U%!%$%k$O8GM-$NCM$r;}$AF@$:!$$+$D(B\emph{$BBg$-(B | |
766 $B$$(B}$B!%$=$N$?$a!$%j%]%8%H%j$N%5%$%:$rA}$d$7!$%/%m!<%s$d%W%k$KM>7W$J;~4V$,3](B | |
767 $B$+$k$h$&$K$J$k!%(B | |
768 | |
769 %Before I discuss the options that you have if you commit a ``brown | |
770 %paper bag'' change (the kind that's so bad that you want to pull a | |
771 %brown paper bag over your head), let me first discuss some approaches | |
772 %that probably won't work. | |
126
fa3c43dd3a1e
More undo-related verbiage.
Bryan O'Sullivan <bos@serpentine.com>
parents:
125
diff
changeset
|
773 |
307 | 774 $BCc?'$N;fB^%3%_%C%H!JCc?'$N;fB^$rF,$KHo$j$?$$$0$i$$%P%D$N0-$$%3%_%C%H!K$K(B |
775 $B;H$($k%*%W%7%g%s$K$D$$$F5DO@$9$kA0$K!$$$$/$D$+$N$&$^$/9T$+$J$$%"%W%m!<%A(B | |
776 $B$r=R$Y$?$$!%(B | |
777 | |
778 %Since Mercurial treats history as accumulative---every change builds | |
779 %on top of all changes that preceded it---you generally can't just make | |
780 %disastrous changes disappear. The one exception is when you've just | |
781 %committed a change, and it hasn't been pushed or pulled into another | |
782 %repository. That's when you can safely use the \hgcmd{rollback} | |
783 %command, as I detailed in section~\ref{sec:undo:rollback}. | |
126
fa3c43dd3a1e
More undo-related verbiage.
Bryan O'Sullivan <bos@serpentine.com>
parents:
125
diff
changeset
|
784 |
307 | 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 | |
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 | |
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 | |
126
fa3c43dd3a1e
More undo-related verbiage.
Bryan O'Sullivan <bos@serpentine.com>
parents:
125
diff
changeset
|
790 |
307 | 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 | |
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 | |
795 %local repository the next time you pull. | |
796 | |
797 $B4V0c$C$?JQ99$rB>$N%j%]%8%H%j$K%W%C%7%e$7$?8e$G$b%m!<%+(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 | |
799 \emph{$B$G$-$k(B}$B$,!$$3$l$O0U?^$7$?$h$&$J7k2L$K$O$J$i$J$$!%JQ99$O0MA3$H$7$F(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 | |
801 $B%8%H%j$K$b8=$l$k!%(B | |
126
fa3c43dd3a1e
More undo-related verbiage.
Bryan O'Sullivan <bos@serpentine.com>
parents:
125
diff
changeset
|
802 |
307 | 803 %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 | |
805 %changee from \emph{every} one of those repositories. This is, of | |
806 %course, not a satisfactory solution: if you miss even a single | |
807 %repository while you're expunging, the change is still ``in the | |
808 %wild'', and could propagate further. | |
809 | |
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 | |
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 | |
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 | |
813 $B0l$D$G$b>C5n$rK:$l$l$P!$JQ99$OLnJ|$7$K$J$C$F$*$j!$$5$i$K3H$,$jF@$k!%(B | |
126
fa3c43dd3a1e
More undo-related verbiage.
Bryan O'Sullivan <bos@serpentine.com>
parents:
125
diff
changeset
|
814 |
307 | 815 %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. | |
817 %Mercurial doesn't provide a way to ``punch a hole'' in history, | |
818 %leaving changesets intact. | |
819 | |
820 $B$b$7(B1$B$D0J>e$N?7$?$JJQ99$r!$>C$7$?$$$H;W$C$F$$$kJQ99$N8e$K%3%_%C%H$7$F$$(B | |
821 $B$?$H$9$l$P!$;H$($k%*%W%7%g%s$O$5$i$K>/$J$/$J$k!%(BMercurial$B$O%A%'%s%8%;%C(B | |
822 $B%H$r$=$N$^$^$KMzNr$K7j$r3+$1$k$h$&$JJ}K!$rDs6!$7$F$$$J$$!%(B | |
126
fa3c43dd3a1e
More undo-related verbiage.
Bryan O'Sullivan <bos@serpentine.com>
parents:
125
diff
changeset
|
823 |
307 | 824 %XXX This needs filling out. The \texttt{hg-replay} script in the |
825 %\texttt{examples} directory works, but doesn't handle merge | |
826 %changesets. Kind of an important omission. | |
129 | 827 |
307 | 828 XXX $BDI5-$NI,MW@-$"$j!%(B\texttt{examples}$B%G%#%l%/%H%jFb$N(B |
829 \texttt{hg-replay}$B%9%/%j%W%H$O5!G=$9$k$,!$%A%'%s%8%;%C%H$N%^!<%8$r07$o$J(B | |
830 $B$$!%=EMW$J@)8B$G$"$k!%(B | |
831 | |
832 | |
833 %\subsection{Protect yourself from ``escaped'' changes} | |
834 \subsection{$B0oC&$7$?JQ99$+$i<+J,<+?H$r<i$k(B} | |
201
80fc720338a5
Mention use of hooks to defend against propagation of bad changes.
Bryan O'Sullivan <bos@serpentine.com>
parents:
200
diff
changeset
|
835 |
307 | 836 %If you've committed some changes to your local repository and they've |
837 %been pushed or pulled somewhere else, this isn't necessarily a | |
838 %disaster. You can protect yourself ahead of time against some classes | |
839 %of bad changeset. This is particularly easy if your team usually | |
840 %pulls changes from a central repository. | |
841 | |
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 | |
843 $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 | |
845 $B$,Cf1{$N%j%]%8%H%j$+$iJQ99$r%W%k$7$F$$$k>l9g$OFC$K4JC1$G$"$k!%(B | |
201
80fc720338a5
Mention use of hooks to defend against propagation of bad changes.
Bryan O'Sullivan <bos@serpentine.com>
parents:
200
diff
changeset
|
846 |
307 | 847 %By configuring some hooks on that repository to validate incoming |
848 %changesets (see chapter~\ref{chap:hook}), you can automatically | |
849 %prevent some kinds of bad changeset from being pushed to the central | |
850 %repository at all. With such a configuration in place, some kinds of | |
851 %bad changeset will naturally tend to ``die out'' because they can't | |
852 %propagate into the central repository. | |
853 %Better yet, this happens without any need for explicit intervention. | |
201
80fc720338a5
Mention use of hooks to defend against propagation of bad changes.
Bryan O'Sullivan <bos@serpentine.com>
parents:
200
diff
changeset
|
854 |
307 | 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 |
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 | |
857 $B<+F0E*$KKI$0$3$H$,$G$-$k!%(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 | |
859 $B%8%H%j$KGH5Z$9$k$3$H$,$G$-$:!$;`LG$7$F$$$/798~$,$"$k!%$5$i$KNI$$$3$H$H$7(B | |
860 $B$F$O!$$3$l$OL@<(E*$K2pF~$;$:$KH/@8$5$;$k$3$H$,$G$-$k$3$H$,$"$k!%(B | |
861 | |
862 %For instance, an incoming change hook that verifies that a changeset | |
863 %will actually compile can prevent people from inadvertantly ``breaking | |
864 %the build''. | |
865 | |
866 $BNc$($P!$%A%'%s%8%;%C%H$r<B:]$K%3%s%Q%$%k$9$kJQ99E~Ce%U%C%/$O!$ITCm0U$K$h(B | |
867 $B$k%S%k%IITG=$rKI$0$3$H$,$G$-$k!%(B | |
201
80fc720338a5
Mention use of hooks to defend against propagation of bad changes.
Bryan O'Sullivan <bos@serpentine.com>
parents:
200
diff
changeset
|
868 |
308 | 869 %\section{Finding the source of a bug} |
870 \section{$B%P%0$N860x$r8+$D$1$k(B} | |
200
9bba958be4c6
Mention automatic example generation.
Bryan O'Sullivan <bos@serpentine.com>
parents:
131
diff
changeset
|
871 \label{sec:undo:bisect} |
130
26b7a4e943aa
Describe the bisect extension.
Bryan O'Sullivan <bos@serpentine.com>
parents:
129
diff
changeset
|
872 |
308 | 873 %While it's all very well to be able to back out a changeset that |
874 %introduced a bug, this requires that you know which changeset to back | |
875 %out. Mercurial provides an invaluable command, called | |
876 %\hgcmd{bisect}, that helps you to automate this process and accomplish | |
877 %it very efficiently. | |
878 | |
879 $B%P%0$rH/@8$5$;$?%A%'%s%8%;%C%H$r%P%C%/%"%&%H$9$k$?$a$K$O!$$I$N%A%'%s%8%;%C(B | |
880 $B%H$G%P%0$N:.F~$,5/$-$?$N$+$rCN$i$M$P$J$i$J$$!%(BMercurial$B$O(B\hgcmd{bisect} | |
881 $B$H$$$&M-MQ$J%3%^%s%I$rDs6!$7$F$*$j!$$3$l$K$h$C$F%A%'%s%8%;%C%H$NFCDj$r<+(B | |
882 $BF02=$7!$%P%C%/%"%&%H$r6K$a$F8z2LE*$K9T$&$3$H$,$G$-$k!%(B | |
130
26b7a4e943aa
Describe the bisect extension.
Bryan O'Sullivan <bos@serpentine.com>
parents:
129
diff
changeset
|
883 |
308 | 884 %The idea behind the \hgcmd{bisect} command is that a changeset has |
885 %introduced some change of behaviour that you can identify with a | |
886 %simple binary test. You don't know which piece of code introduced the | |
887 %change, but you know how to test for the presence of the bug. The | |
888 %\hgcmd{bisect} command uses your test to direct its search for the | |
889 %changeset that introduced the code that caused the bug. | |
890 | |
891 \hgcmd{bisect}$B%3%^%s%I$NGX8e$K$O!$%A%'%s%8%;%C%H$K$h$C$FC1=c$J%P%$%J%j%F(B | |
892 $B%9%H$G==J,<1JL2DG=$J5sF0$NJQ2=$,@8$l$k$H$$$&9M$(J}$,$"$k!%$"$J$?$O$I$N%3!<(B | |
893 $B%I$,JQ2=$r0z$-5/$3$7$?$N$+$O$o$+$i$J$$$,!$%P%0$,5/$-$F$$$k$+$r%F%9%H$9$k(B | |
894 $BJ}K!$OCN$C$F$$$k!%(B\hgcmd{bisect}$B%3%^%s%I$O!$%F%9%H$K$h$C$F%P%0$r0z$-5/$3(B | |
895 $B$7$?%A%'%s%8%;%C%H$rFCDj$9$k!%(B | |
130
26b7a4e943aa
Describe the bisect extension.
Bryan O'Sullivan <bos@serpentine.com>
parents:
129
diff
changeset
|
896 |
309 | 897 %Here are a few scenarios to help you understand how you might apply |
898 %this command. | |
899 %\begin{itemize} | |
900 %\item The most recent version of your software has a bug that you | |
901 % remember wasn't present a few weeks ago, but you don't know when it | |
902 % was introduced. Here, your binary test checks for the presence of | |
903 % that bug. | |
904 %\item You fixed a bug in a rush, and now it's time to close the entry | |
905 % in your team's bug database. The bug database requires a changeset | |
906 % ID when you close an entry, but you don't remember which changeset | |
907 % you fixed the bug in. Once again, your binary test checks for the | |
908 % presence of the bug. | |
909 %\item Your software works correctly, but runs~15\% slower than the | |
910 % last time you measured it. You want to know which changeset | |
911 % introduced the performance regression. In this case, your binary | |
912 % test measures the performance of your software, to see whether it's | |
913 % ``fast'' or ``slow''. | |
914 %\item The sizes of the components of your project that you ship | |
915 % exploded recently, and you suspect that something changed in the way | |
916 % you build your project. | |
917 %%\end{itemize} | |
918 | |
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 | |
130
26b7a4e943aa
Describe the bisect extension.
Bryan O'Sullivan <bos@serpentine.com>
parents:
129
diff
changeset
|
920 \begin{itemize} |
309 | 921 \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 | |
923 $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 | |
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 | |
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 | |
927 $B$7$F$$$J$$!%$3$3$G$^$?%P%0$NB8:_$r%P%$%J%j%F%9%H$9$k!%(B | |
928 \item $B$"$J$?$N%=%U%H%&%'%"$O@5$7$/F0$$$?$,!$0JA0B,Dj$7$?;~$h$j$b(B15\%$BCY(B | |
929 $B$/$J$C$F$$$?!%$"$J$?$O$I$N%A%'%s%8%;%C%H$,$3$N@-G=Nt2=$r$b$?$i$7(B | |
930 $B$?$N$+CN$j$?$$!%$3$N>l9g!$%P%$%J%j%F%9%H$GB.EY$rB,Dj$9$k!%(B | |
931 \item $B=P2Y$9$k%W%m%8%'%/%H$N%3%s%]!<%M%s%H%5%$%:$,:G6aGzH/E*$KA}$($?!%(B | |
932 $B$"$J$?$O%W%m%8%'%/%H$N%S%k%I$NJ}K!$K$J$s$i$+$NJQ2=$,5/$-$?$N$G$O(B | |
933 $B$J$$$+$H5?$C$F$$$k!%(B | |
130
26b7a4e943aa
Describe the bisect extension.
Bryan O'Sullivan <bos@serpentine.com>
parents:
129
diff
changeset
|
934 \end{itemize} |
26b7a4e943aa
Describe the bisect extension.
Bryan O'Sullivan <bos@serpentine.com>
parents:
129
diff
changeset
|
935 |
309 | 936 %From these examples, it should be clear that the \hgcmd{bisect} |
937 %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 | |
939 %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. | |
308 | 941 |
309 | 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 |
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 | |
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 | |
945 $BCN$k$N$K;H$&$3$H$,$G$-$k!%(B | |
130
26b7a4e943aa
Describe the bisect extension.
Bryan O'Sullivan <bos@serpentine.com>
parents:
129
diff
changeset
|
946 |
309 | 947 %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 | |
949 %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 | |
951 %\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 | |
953 %for the phrase ``search using the \hgcmd{bisect} command''. | |
954 | |
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 | |
956 $B$k$N$+L@3N$K$9$k$?$a$K>/$7$P$+$jMQ8l$rF3F~$9$k!%(B\emph{test}$B$O(B\emph{$B$"$J(B | |
957 $B$?(B}$B$,(B\hgcmd{bisect}$B$r<B9T$9$k;~$KA*$s$@%A%'%s%8%;%C%H$G$"$k!%(B | |
958 \emph{probe}$B$O(B\hgcmd{bisect}$B$,%j%S%8%g%s$,NI$$$+H=Dj$9$k%j%S%8%g%s$G$"$k!%(B | |
959 ``bisect''$B$H$$$&C18l$r(B``\hgcmd{bisect}$B%3%^%s%I$r;H$C$F%5!<%A$9$k(B''$B$H$$$&(B | |
960 $B$3$H$NF15A8l$H$7$FL>;l$HF0;lN>J}$GMQ$$$k!%(B | |
961 | |
962 %One simple way to automate the searching process would be simply to | |
963 %probe every changeset. However, this scales poorly.If it took ten | |
964 %minutes to test a single changeset, and you had 10,000 changesets in | |
965 %your repository, the exhaustive approach would take on average~35 | |
966 %\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, | |
968 %and limited your search to those, you'd still be looking at over 40 | |
969 %hours to find the changeset that introduced your bug. | |
130
26b7a4e943aa
Describe the bisect extension.
Bryan O'Sullivan <bos@serpentine.com>
parents:
129
diff
changeset
|
970 |
309 | 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 |
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 | |
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 | |
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 | |
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 | |
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 | |
977 $BDj$K(B40$B;~4V0J>e$+$+$k!%(B | |
978 | |
979 %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 | |
981 %time proportional to the \emph{logarithm} of the number of changesets | |
982 %to check (the kind of search it performs is called a dichotomic | |
983 %search). | |
130
26b7a4e943aa
Describe the bisect extension.
Bryan O'Sullivan <bos@serpentine.com>
parents:
129
diff
changeset
|
984 |
309 | 985 %With this approach, searching through 10,000 changesets will |
986 %take less than three hours, even at ten minutes per test (the search | |
987 %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). | |
130
26b7a4e943aa
Describe the bisect extension.
Bryan O'Sullivan <bos@serpentine.com>
parents:
129
diff
changeset
|
989 |
309 | 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 |
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 | |
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 | |
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 | |
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 | |
995 $B%F%9%H$G(B1$B;~4VDxEY$G=*N;$9$k!%(B | |
996 | |
997 %The \hgcmd{bisect} command is aware of the ``branchy'' nature of a | |
998 %Mercurial project's revision history, so it has no problems dealing | |
999 %with branches, merges, or multiple heads in a repoository. It can | |
1000 %prune entire branches of history with a single probe, which is how it | |
1001 %operates so efficiently. | |
1002 | |
1003 \hgcmd{bisect}$B%3%^%s%I$O!$(BMercurial$B%W%m%8%'%/%H$N%j%S%8%g%sMzNr$,;^J,$+$l(B | |
1004 $B$7$,$A$J@-<A$r;}$D$3$H$rG0F,$K$*$$$F@_7W$5$l$F$*$j!$%j%]%8%H%j$K%V%i%s%A!$(B | |
1005 $B%^!<%8!$J#?t$N%X%C%I$,$"$C$F$bLdBj$J$/<h$j07$($k!%0l2s$N(Bprobe$B$GMzNr$NCf(B | |
1006 $B$N$"$kJ,;^A4$F$r4"$k$3$H$,$G$-$k$?$a!$6K$a$F8zN(E*$KF0:n$9$k!%(B | |
130
26b7a4e943aa
Describe the bisect extension.
Bryan O'Sullivan <bos@serpentine.com>
parents:
129
diff
changeset
|
1007 |
313 | 1008 %\subsection{Using the \hgcmd{bisect} command} |
1009 \subsection{\hgcmd{bisect}$B%3%^%s%I$r;H$&(B} | |
1010 | |
1011 %Here's an example of \hgcmd{bisect} in action. | |
1012 \hgcmd{bisect}$B$NF0:n$rNc$G<($9!%(B | |
282 | 1013 |
313 | 1014 %\begin{note} |
1015 % In versions 0.9.5 and earlier of Mercurial, \hgcmd{bisect} was not a | |
1016 % core command: it was distributed with Mercurial as an extension. | |
1017 % This section describes the built-in command, not the old extension. | |
1018 %\end{note} | |
130
26b7a4e943aa
Describe the bisect extension.
Bryan O'Sullivan <bos@serpentine.com>
parents:
129
diff
changeset
|
1019 |
26b7a4e943aa
Describe the bisect extension.
Bryan O'Sullivan <bos@serpentine.com>
parents:
129
diff
changeset
|
1020 \begin{note} |
313 | 1021 $B%P!<%8%g%s(B0.9.5$B0JA0$N(BMercurial$B$G$O!$(B\hgcmd{bisect}$B$O%3%"%3%^%s%I$G$O$J(B |
1022 $B$/!$(Bextension$B$H$7$F(BMercurial$B$KF1:-$5$l$F$$$?!%$3$N@a$O8E$$(Bextension$B$K$D(B | |
1023 $B$$$F$G$O$J$/!$%S%k%H%$%s%3%^%s%I$H$7$F$N(B\hgcmd{bisect}$B$K$D$$$F=R$Y$F$$$k!%(B | |
130
26b7a4e943aa
Describe the bisect extension.
Bryan O'Sullivan <bos@serpentine.com>
parents:
129
diff
changeset
|
1024 \end{note} |
26b7a4e943aa
Describe the bisect extension.
Bryan O'Sullivan <bos@serpentine.com>
parents:
129
diff
changeset
|
1025 |
314
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1026 %Now let's create a repository, so that we can try out the |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1027 %\hgcmd{bisect} command in isolation. |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1028 %\interaction{bisect.init} |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1029 %We'll simulate a project that has a bug in it in a simple-minded way: |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1030 %create trivial changes in a loop, and nominate one specific change |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1031 %that will have the ``bug''. This loop creates 35 changesets, each |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1032 %adding a single file to the repository. We'll represent our ``bug'' |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1033 %with a file that contains the text ``i have a gub''. |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1034 %\interaction{bisect.commits} |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1035 |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1036 $BFHN)$7$F(B\hgcmd{bisect}$B$r;n$;$k$h$&$K%j%]%8%H%j$r:n@.$9$k!%(B |
130
26b7a4e943aa
Describe the bisect extension.
Bryan O'Sullivan <bos@serpentine.com>
parents:
129
diff
changeset
|
1037 \interaction{bisect.init} |
314
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1038 $BC1=c$J%P%0$N$"$k%W%m%8%'%/%H$r%7%_%e%l!<%H$9$k!%%P%0$O7+JV$7A`:n$N4V$K<+(B |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1039 $BL@$JJQ99$r9T$$!$FCDj$N(B1$B$D$NJQ99$r%P%0$r;}$D$H;XL>$9$k!%$3$N%k!<%W$O(B35 |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1040 $B$N%A%'%s%8%;%C%H$r:n$j!$3F!9!$(B1$B$D$N%U%!%$%k$r%j%]%8%H%j$KDI2C$9$k!%%P%0(B |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1041 $B$O(B``i have a gub''$B$H$$$&J8;zNs$r;}$D%U%!%$%k$GI=8=$9$k!%(B |
130
26b7a4e943aa
Describe the bisect extension.
Bryan O'Sullivan <bos@serpentine.com>
parents:
129
diff
changeset
|
1042 \interaction{bisect.commits} |
26b7a4e943aa
Describe the bisect extension.
Bryan O'Sullivan <bos@serpentine.com>
parents:
129
diff
changeset
|
1043 |
314
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1044 %The next thing that we'd like to do is figure out how to use the |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1045 %\hgcmd{bisect} command. We can use Mercurial's normal built-in help |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1046 %mechanism for this. |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1047 %\interaction{bisect.help} |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1048 |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1049 $B<!$K(B\hgcmd{bisect}$B$N;H$$J}$r@bL@$7$?$$!%(BMercurial$B$N%S%k%H%$%s$N%X%k%W$,(B |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1050 $B;H$($k!%(B |
130
26b7a4e943aa
Describe the bisect extension.
Bryan O'Sullivan <bos@serpentine.com>
parents:
129
diff
changeset
|
1051 \interaction{bisect.help} |
26b7a4e943aa
Describe the bisect extension.
Bryan O'Sullivan <bos@serpentine.com>
parents:
129
diff
changeset
|
1052 |
314
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1053 %The \hgcmd{bisect} command works in steps. Each step proceeds as follows. |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1054 %\begin{enumerate} |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1055 %\item You run your binary test. |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1056 % \begin{itemize} |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1057 % \item If the test succeeded, you tell \hgcmd{bisect} by running the |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1058 % \hgcmdargs{bisect}{good} command. |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1059 % \item If it failed, run the \hgcmdargs{bisect}{--bad} command. |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1060 % \end{itemize} |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1061 %\item The command uses your information to decide which changeset to |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1062 % test next. |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1063 %\item It updates the working directory to that changeset, and the |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1064 % process begins again. |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1065 %\end{enumerate} |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1066 %The process ends when \hgcmd{bisect} identifies a unique changeset |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1067 %that marks the point where your test transitioned from ``succeeding'' |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1068 %to ``failing''. |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1069 |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1070 \hgcmd{bisect}$B%3%^%s%I$OCJ3,$rF'$s$GF0:n$9$k!%3FCJ3,$O0J2<$N$h$&$K?J$`!%(B |
130
26b7a4e943aa
Describe the bisect extension.
Bryan O'Sullivan <bos@serpentine.com>
parents:
129
diff
changeset
|
1071 \begin{enumerate} |
314
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1072 \item $B%P%$%J%j%F%9%H$r<B9T$9$k(B |
130
26b7a4e943aa
Describe the bisect extension.
Bryan O'Sullivan <bos@serpentine.com>
parents:
129
diff
changeset
|
1073 \begin{itemize} |
314
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1074 \item $B%F%9%H$,@.8y$7$?>l9g!$(B\hgcmd{bisect}$B$r0z?t(B\hgcmdargs{bisect}{good} |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1075 $B$rIU$1$F<B9T$9$k!%(B |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1076 \item $B%F%9%H$,<:GT$7$?>l9g$O(B\hgcmdargs{bisect}{--bad}$B%3%^%s%I$r<B9T$9(B |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1077 $B$k!%(B |
130
26b7a4e943aa
Describe the bisect extension.
Bryan O'Sullivan <bos@serpentine.com>
parents:
129
diff
changeset
|
1078 \end{itemize} |
314
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1079 \item $B%3%^%s%I$O0z?t$GEO$5$l$?>pJs$r;H$C$F<!$K$I$N%A%'%s%8%;%C%H$r%F%9(B |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1080 $B%H$9$Y$-$+7hDj$9$k!%(B |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1081 \item $B%3%^%s%I$O%o!<%-%s%0%G%#%l%/%H%j$r$=$N%A%'%s%8%;%C%H$K99?7$9$k!%(B |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1082 $B%W%m%;%9$r:F3+$9$k!%(B |
130
26b7a4e943aa
Describe the bisect extension.
Bryan O'Sullivan <bos@serpentine.com>
parents:
129
diff
changeset
|
1083 \end{enumerate} |
314
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1084 \hgcmd{bisect}$B$N%W%m%;%9$O!$%F%9%H$,@.8y$+$i<:GT$XJQ2=$7$?%A%'%s%8%;%C%H(B |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1085 $B$rFCDj$G$-$k$H=*N;$9$k!%(B |
130
26b7a4e943aa
Describe the bisect extension.
Bryan O'Sullivan <bos@serpentine.com>
parents:
129
diff
changeset
|
1086 |
314
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1087 %To start the search, we must run the \hgcmdargs{bisect}{--reset} command. |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1088 %\interaction{bisect.search.init} |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1089 |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1090 $B%5!<%A$r;O$a$k$K$O(B\hgcmdargs{bisect}{--reset}$B$r<B9T$9$k!%(B |
130
26b7a4e943aa
Describe the bisect extension.
Bryan O'Sullivan <bos@serpentine.com>
parents:
129
diff
changeset
|
1091 \interaction{bisect.search.init} |
26b7a4e943aa
Describe the bisect extension.
Bryan O'Sullivan <bos@serpentine.com>
parents:
129
diff
changeset
|
1092 |
314
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1093 %In our case, the binary test we use is simple: we check to see if any |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1094 %file in the repository contains the string ``i have a gub''. If it |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1095 %does, this changeset contains the change that ``caused the bug''. By |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1096 %convention, a changeset that has the property we're searching for is |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1097 %``bad'', while one that doesn't is ``good''. |
130
26b7a4e943aa
Describe the bisect extension.
Bryan O'Sullivan <bos@serpentine.com>
parents:
129
diff
changeset
|
1098 |
314
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1099 $B$3$N%1!<%9$G$O!$%P%$%J%j%F%9%H$OC1=c$G!$%j%]%8%H%jFb$K(B``i have a gub''$B$r(B |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1100 $B4^$`%U%!%$%k$,$"$k$+$I$&$+$r%A%'%C%/$9$k$@$1$G$"$k!%$b$7$3$l$,$"$l$P!$$=(B |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1101 $B$N%A%'%s%8%;%C%H$,%P%0$r0z$-5/$3$7$F$$$kJQ99$r4^$s$G$$$k$H$$$&$3$H$K$J$k!%(B |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1102 $B47Nc$K=>$C$F!$C5$7$F$$$k%A%'%s%8%;%C%H$r(B``bad''$B!$$=$l0J30$r(B``good''$B$H8F(B |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1103 $B$V$3$H$K$9$k!%(B |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1104 |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1105 %Most of the time, the revision to which the working directory is |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1106 %synced (usually the tip) already exhibits the problem introduced by |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1107 %the buggy change, so we'll mark it as ``bad''. |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1108 %\interaction{bisect.search.bad-init} |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1109 |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1110 $BBgDq$N>l9g!$%o!<%-%s%0%G%#%l%/%H%j$,F14|$7$F$$$k%j%S%8%g%s!JDL>o$O(Btip$B$N(B |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1111 $B$O$:$@!K$O!$%P%0$N$"$kJQ99$K$h$C$F0z$-5/$3$5$l$?LdBj$r<($7$F$$$k$N$G!$$3(B |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1112 $B$N%j%S%8%g%s$r(B``bad''$B$H%^!<%/$9$k!%(B |
130
26b7a4e943aa
Describe the bisect extension.
Bryan O'Sullivan <bos@serpentine.com>
parents:
129
diff
changeset
|
1113 \interaction{bisect.search.bad-init} |
26b7a4e943aa
Describe the bisect extension.
Bryan O'Sullivan <bos@serpentine.com>
parents:
129
diff
changeset
|
1114 |
314
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1115 %Our next task is to nominate a changeset that we know \emph{doesn't} |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1116 %have the bug; the \hgcmd{bisect} command will ``bracket'' its search |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1117 %between the first pair of good and bad changesets. In our case, we |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1118 %know that revision~10 didn't have the bug. (I'll have more words |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1119 %about choosing the first ``good'' changeset later.) |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1120 %\interaction{bisect.search.good-init} |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1121 |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1122 $B<!$K%P%0$r(B\emph{$B4^$^$J$$(B}$B%j%S%8%g%s$r;XL>$9$k!%(B\hgcmd{bisect}$B%3%^%s%I$O(B |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1123 $B:G=i$N(B``good''$B%A%'%s%8%;%C%H$H(B``bad''$B%A%'%s%8%;%C%H$r%V%i%1%C%H$9$k!%$3(B |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1124 $B$NNc$G$O!$%j%S%8%g%s(B~10$B$O%P%0$r;}$?$J$$$HJ,$+$C$F$$$k!%!J:G=i$N(B``good'' |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1125 $B%A%'%s%8%;%C%H$NA*$SJ}$K$D$$$F$O8e=R$9$k!%!K(B |
130
26b7a4e943aa
Describe the bisect extension.
Bryan O'Sullivan <bos@serpentine.com>
parents:
129
diff
changeset
|
1126 \interaction{bisect.search.good-init} |
26b7a4e943aa
Describe the bisect extension.
Bryan O'Sullivan <bos@serpentine.com>
parents:
129
diff
changeset
|
1127 |
314
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1128 %Notice that this command printed some output. |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1129 %\begin{itemize} |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1130 %\item It told us how many changesets it must consider before it can |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1131 % identify the one that introduced the bug, and how many tests that |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1132 % will require. |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1133 %\item It updated the working directory to the next changeset to test, |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1134 % and told us which changeset it's testing. |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1135 %\end{itemize} |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1136 |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1137 $B%3%^%s%I$+$i=PNO$,$"$k$3$H$KCm0U!%(B |
130
26b7a4e943aa
Describe the bisect extension.
Bryan O'Sullivan <bos@serpentine.com>
parents:
129
diff
changeset
|
1138 \begin{itemize} |
314
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1139 \item $B%P%0$NF~$C$?%A%'%s%8%;%C%H$rFCDj$9$k$^$G$K9MN8$9$Y$-%A%'%s%8%;%C%H(B |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1140 $B$N8D?t$H!$I,MW$J8!::$N2s?t$rI=<($9$k!%(B |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1141 \item $B%o!<%-%s%0%G%#%l%/%H%j$r<!$N%F%9%H$9$Y$-%A%'%s%8%;%C%H$K99?7$7!$(B |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1142 $B$I$N%A%'%s%8%;%C%H$r%F%9%H$7$F$$$k$N$+$rI=<($9$k!%(B |
130
26b7a4e943aa
Describe the bisect extension.
Bryan O'Sullivan <bos@serpentine.com>
parents:
129
diff
changeset
|
1143 \end{itemize} |
26b7a4e943aa
Describe the bisect extension.
Bryan O'Sullivan <bos@serpentine.com>
parents:
129
diff
changeset
|
1144 |
314
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1145 %We now run our test in the working directory. We use the |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1146 %\command{grep} command to see if our ``bad'' file is present in the |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1147 %working directory. If it is, this revision is bad; if not, this |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1148 %revision is good. |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1149 %\interaction{bisect.search.step1} |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1150 |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1151 $B$3$3$G%o!<%-%s%0%G%#%l%/%H%j$G%F%9%H$r9T$&$3$H$,$G$-$k!%(B\command{grep}$B%3(B |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1152 $B%^%s%I$r;H$C$F(B``bad''$B%U%!%$%k$,%o!<%-%s%0%G%#%l%/%H%j$K$"$k$+$I$&$+$r%A%'%C(B |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1153 $B%/$9$k!%$b$7B8:_$9$l$P!$%j%S%8%g%s$O(Bbad$B$G!$B8:_$7$J$1$l$P%j%S%8%g%s$O(B |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1154 good$B$H$$$&$3$H$K$J$k!%(B |
131
153efeaa8f57
Fix stupid build bugs.
Bryan O'Sullivan <bos@serpentine.com>
parents:
130
diff
changeset
|
1155 \interaction{bisect.search.step1} |
130
26b7a4e943aa
Describe the bisect extension.
Bryan O'Sullivan <bos@serpentine.com>
parents:
129
diff
changeset
|
1156 |
314
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1157 %This test looks like a perfect candidate for automation, so let's turn |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1158 %it into a shell function. |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1159 %\interaction{bisect.search.mytest} |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1160 %We can now run an entire test step with a single command, |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1161 %\texttt{mytest}. |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1162 %\interaction{bisect.search.step2} |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1163 %A few more invocations of our canned test step command, and we're |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1164 %done. |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1165 %\interaction{bisect.search.rest} |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1166 |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1167 $B$3$N%F%9%H$O40A4$K<+F02=$G$-$k!%%7%'%k4X?t$K$7$F$_$h$&!%(B |
131
153efeaa8f57
Fix stupid build bugs.
Bryan O'Sullivan <bos@serpentine.com>
parents:
130
diff
changeset
|
1168 \interaction{bisect.search.mytest} |
314
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1169 $B%F%9%HA4BN$r0l$D$N(B\texttt{mytest}$B%3%^%s%I$H$7$F<B9T$G$-$k$h$&$K$J$C$?!%(B |
131
153efeaa8f57
Fix stupid build bugs.
Bryan O'Sullivan <bos@serpentine.com>
parents:
130
diff
changeset
|
1170 \interaction{bisect.search.step2} |
314
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1171 $B$3$N%Q%C%/$5$l$?%F%9%H%3%^%s%I$r5/F0$9$k$@$1$G%F%9%H$,40N;$9$k!%(B |
131
153efeaa8f57
Fix stupid build bugs.
Bryan O'Sullivan <bos@serpentine.com>
parents:
130
diff
changeset
|
1172 \interaction{bisect.search.rest} |
130
26b7a4e943aa
Describe the bisect extension.
Bryan O'Sullivan <bos@serpentine.com>
parents:
129
diff
changeset
|
1173 |
314
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1174 %Even though we had~40 changesets to search through, the \hgcmd{bisect} |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1175 %command let us find the changeset that introduced our ``bug'' with |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1176 %only five tests. Because the number of tests that the \hgcmd{bisect} |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1177 %command grows logarithmically with the number of changesets to |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1178 %search, the advantage that it has over the ``brute force'' search |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1179 %approach increases with every changeset you add. |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1180 |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
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 |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
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 |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
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 |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1184 $BBP?tE($KA}$($k$,!$iMDY$7C5:w$KBP$9$kM%0L@-$O!$%A%'%s%8%;%C%H$,A}2C$9$k$K(B |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1185 $B=>$C$FA}2C$9$k!%(B |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1186 |
130
26b7a4e943aa
Describe the bisect extension.
Bryan O'Sullivan <bos@serpentine.com>
parents:
129
diff
changeset
|
1187 |
314
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1188 %\subsection{Cleaning up after your search} |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1189 \subsection{$B%5!<%A8e$N%/%j!<%s%"%C%W(B} |
130
26b7a4e943aa
Describe the bisect extension.
Bryan O'Sullivan <bos@serpentine.com>
parents:
129
diff
changeset
|
1190 |
314
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1191 %When you're finished using the \hgcmd{bisect} command in a |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1192 %repository, you can use the \hgcmdargs{bisect}{reset} command to drop |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1193 %the information it was using to drive your search. The command |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1194 %doesn't use much space, so it doesn't matter if you forget to run this |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1195 %command. However, \hgcmd{bisect} won't let you start a new search in |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1196 %that repository until you do a \hgcmdargs{bisect}{reset}. |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1197 %\interaction{bisect.search.reset} |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1198 |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1199 $B%j%]%8%H%jFb$G(B\hgcmd{bisect}$B%3%^%s%I$r;H$$=*$C$?8e$K(B |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1200 \hgcmdargs{bisect}{reset}$B%3%^%s%I$GC5:w$K;H$C$?>pJs$r>C5n$9$k$3$H$,$G$-(B |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1201 $B$k!%%3%^%s%I$OBg$-$J%9%Z!<%9$r;H$&$o$1$G$O$J$$$N$G!$$3$N%3%^%s%I$r<B9T$9(B |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1202 $B$k$N$rK:$l$F$bFC$KLdBj$O$J$$!%$7$+$7(B\hgcmd{bisect}$B$O(B |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1203 \hgcmdargs{bisect}{reset}$B$,<B9T$5$l$k$^$G!$$=$N%j%]%8%H%jFb$G?7$?$JC5:w(B |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1204 $B$r;O$a$k$3$H$O$G$-$J$$!%(B |
131
153efeaa8f57
Fix stupid build bugs.
Bryan O'Sullivan <bos@serpentine.com>
parents:
130
diff
changeset
|
1205 \interaction{bisect.search.reset} |
130
26b7a4e943aa
Describe the bisect extension.
Bryan O'Sullivan <bos@serpentine.com>
parents:
129
diff
changeset
|
1206 |
314
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1207 %\section{Tips for finding bugs effectively} |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1208 \section{$B8zN(E*$J%P%0$NH/8+K!(B} |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1209 |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1210 %\subsection{Give consistent input} |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1211 \subsection{$B0l4S$7$?F~NO$r9T$&(B} |
130
26b7a4e943aa
Describe the bisect extension.
Bryan O'Sullivan <bos@serpentine.com>
parents:
129
diff
changeset
|
1212 |
314
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1213 %The \hgcmd{bisect} command requires that you correctly report the |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1214 %result of every test you perform. If you tell it that a test failed |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1215 %when it really succeeded, it \emph{might} be able to detect the |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1216 %inconsistency. If it can identify an inconsistency in your reports, |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1217 %it will tell you that a particular changeset is both good and bad. |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1218 %However, it can't do this perfectly; it's about as likely to report |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1219 %the wrong changeset as the source of the bug. |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1220 |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
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 |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
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 |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1223 $B$$!%F~NO$NCf$GITDj$rFCDj$G$-$l$P!$%3%^%s%I$OFCDj$N%A%'%s%8%;%C%H$,(Bgood$B$+(B |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
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 |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1225 $B%s%8%;%C%H$r%P%0$N860x$@$HJs9p$9$k2DG=@-$,9b$$!%(B |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1226 |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1227 %\subsection{Automate as much as possible} |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1228 \subsection{$B$G$-$k8B$j<+F02=$9$k(B} |
130
26b7a4e943aa
Describe the bisect extension.
Bryan O'Sullivan <bos@serpentine.com>
parents:
129
diff
changeset
|
1229 |
314
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1230 %When I started using the \hgcmd{bisect} command, I tried a few times |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1231 %to run my tests by hand, on the command line. This is an approach |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1232 %that I, at least, am not suited to. After a few tries, I found that I |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1233 %was making enough mistakes that I was having to restart my searches |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1234 %several times before finally getting correct results. |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1235 |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1236 \hgcmd{bisect}$B%3%^%s%I$r;H$$$O$8$a$?;~!$?t2s!$%3%^%s%I%i%$%s$+$i<j$G%F%9(B |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1237 $B%H$r<B9T$7$?!%$3$NJ}K!$OE,$7$?J}K!$G$O$J$$!%?t2s$N%F%9%H$N8e$G!$:G=*E*$J(B |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1238 $B7k2L$rF@$k$?$a$K%5!<%A$r$d$j$J$*$5$J$1$l$P$J$i$J$$$3$H$K5$$E$/$3$H$,2?EY(B |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1239 $B$+$"$C$?!%(B |
130
26b7a4e943aa
Describe the bisect extension.
Bryan O'Sullivan <bos@serpentine.com>
parents:
129
diff
changeset
|
1240 |
314
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1241 %My initial problems with driving the \hgcmd{bisect} command by hand |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1242 %occurred even with simple searches on small repositories; if the |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1243 %problem you're looking for is more subtle, or the number of tests that |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1244 %\hgcmd{bisect} must perform increases, the likelihood of operator |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1245 %error ruining the search is much higher. Once I started automating my |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1246 %tests, I had much better results. |
130
26b7a4e943aa
Describe the bisect extension.
Bryan O'Sullivan <bos@serpentine.com>
parents:
129
diff
changeset
|
1247 |
314
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1248 \hgcmd{bisect}$B%3%^%s%I$r<j$G<B9T$7$F$$$?;~$N:G=i$NLdBj$O!$>.$5$J%j%]%8%H(B |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1249 $B%j$G$NC1=c$J%5!<%A$G$b5/$3$C$?!%$b$7LdBj$,$b$C$HNt0-$G!$(B\hgcmd{bisect}$B$,(B |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1250 $B<B9T$7$J$1$l$P$J$i$J$$%F%9%H$N?t$,A}$($l$P!$%*%Z%l!<%?$N%(%i!<$,5/$3$k2D(B |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1251 $BG=@-$O$:$C$H9b$/$J$k!%0lEY%F%9%H$r<+F02=$7$F$+$i$O!$$:$C$H$h$$7k2L$,F@$i(B |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1252 $B$l$k$h$&$K$J$C$?!%(B |
130
26b7a4e943aa
Describe the bisect extension.
Bryan O'Sullivan <bos@serpentine.com>
parents:
129
diff
changeset
|
1253 |
314
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1254 %The key to automated testing is twofold: |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1255 %\begin{itemize} |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1256 %\item always test for the same symptom, and |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1257 %\item always feed consistent input to the \hgcmd{bisect} command. |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1258 %\end{itemize} |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1259 %In my tutorial example above, the \command{grep} command tests for the |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1260 %symptom, and the \texttt{if} statement takes the result of this check |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1261 %and ensures that we always feed the same input to the \hgcmd{bisect} |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1262 %command. The \texttt{mytest} function marries these together in a |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1263 %reproducible way, so that every test is uniform and consistent. |
130
26b7a4e943aa
Describe the bisect extension.
Bryan O'Sullivan <bos@serpentine.com>
parents:
129
diff
changeset
|
1264 |
314
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1265 $B%F%9%H$r<+F02=$9$k%-!<$O(B2$B$D$"$k!%(B |
130
26b7a4e943aa
Describe the bisect extension.
Bryan O'Sullivan <bos@serpentine.com>
parents:
129
diff
changeset
|
1266 \begin{itemize} |
314
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1267 \item $B>o$KF1$8C{8u$r%F%9%H$9$k!%$=$7$F(B |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1268 \item $B>o$K(B\hgcmd{bisect}$B%3%^%s%I$K0l4S$7$?F~NO$r9T$&!%(B |
130
26b7a4e943aa
Describe the bisect extension.
Bryan O'Sullivan <bos@serpentine.com>
parents:
129
diff
changeset
|
1269 \end{itemize} |
314
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1270 $B>e$N%A%e!<%H%j%"%kNc$G$O(B\command{grep}$B%3%^%s%I$,C{8u$r%F%9%H$7$F$*$j!$(B |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1271 \texttt{if}$BJ8$,$3$N%A%'%C%/$N7k2L$r<h$j!$>o$KF1$8F~NO$,(B\hgcmd{bisect}$B%3(B |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1272 $B%^%s%I$K$J$5$l$k$h$&$K$J$C$F$$$?!%(B\texttt{mytest}$B4X?t$O!$:F8=2DG=$JJ}K!(B |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1273 $B$G!$$3$l$i$r7k$S$D$1!$$3$3$N%F%9%H$,0lMM$G0l4S$9$k$h$&$K$J$C$F$$$?!%(B |
130
26b7a4e943aa
Describe the bisect extension.
Bryan O'Sullivan <bos@serpentine.com>
parents:
129
diff
changeset
|
1274 |
314
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1275 |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1276 %\subsection{Check your results} |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1277 \subsection{$B7k2L$r%A%'%C%/$9$k(B} |
130
26b7a4e943aa
Describe the bisect extension.
Bryan O'Sullivan <bos@serpentine.com>
parents:
129
diff
changeset
|
1278 |
314
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1279 %Because the output of a \hgcmd{bisect} search is only as good as the |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1280 %input you give it, don't take the changeset it reports as the |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1281 %absolute truth. A simple way to cross-check its report is to manually |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1282 %run your test at each of the following changesets: |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1283 %\begin{itemize} |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1284 %\item The changeset that it reports as the first bad revision. Your |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1285 % test should still report this as bad. |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1286 %\item The parent of that changeset (either parent, if it's a merge). |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1287 % Your test should report this changeset as good. |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1288 %\item A child of that changeset. Your test should report this |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1289 % changeset as bad. |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1290 %\end{itemize} |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1291 |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1292 \hgcmd{bisect}$B%5!<%A$N=PNO$O!$%f!<%6$NF~NO$,@5$7$$>l9g$K8B$C$F@5$7$$$N$G!$(B |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1293 $B%3%^%s%I$,Js9p$9$k%A%'%s%8%;%C%H$r@dBP$K@5$7$$$H9M$($F$O$$$1$J$$!%Js9p$N(B |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1294 $B%/%m%9%A%'%C%/$r9T$&C1=c$JJ}K!$O!$0J2<$N%A%'%s%8%;%C%H$KBP$7$F!$<jF0$G%F(B |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1295 $B%9%H$r9T$&$3$H$G$"$k!%(B |
130
26b7a4e943aa
Describe the bisect extension.
Bryan O'Sullivan <bos@serpentine.com>
parents:
129
diff
changeset
|
1296 \begin{itemize} |
314
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1297 \item $B:G=i$N(Bbad$B%j%S%8%g%s$H$7$FJs9p$5$l$k%A%'%s%8%;%C%H!%$3$l$K$D$$$F%F(B |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1298 $B%9%H$O(Bbad$B$H$J$kH&$G$"$k(B |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1299 \item $B$=$N%A%'%s%8%;%C%H$N?F!J%^!<%8$5$l$F$$$k$J$iN>J}$N?F!K!%%F%9%H$O(B |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1300 good$B$K$J$kH&$G$"$k(B |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1301 \item $B:G=i$N(Bbad$B%j%S%8%g%s$H$7$FJs9p$5$l$k%A%'%s%8%;%C%H$N;R!%%F%9%H$O(B |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1302 bad$B$H$J$kH&$G$"$k(B |
130
26b7a4e943aa
Describe the bisect extension.
Bryan O'Sullivan <bos@serpentine.com>
parents:
129
diff
changeset
|
1303 \end{itemize} |
26b7a4e943aa
Describe the bisect extension.
Bryan O'Sullivan <bos@serpentine.com>
parents:
129
diff
changeset
|
1304 |
314
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1305 %\subsection{Beware interference between bugs} |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1306 \subsection{$B%P%0F1;N$NAj8_43>D$KN10U$9$k(B} |
130
26b7a4e943aa
Describe the bisect extension.
Bryan O'Sullivan <bos@serpentine.com>
parents:
129
diff
changeset
|
1307 |
314
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1308 %It's possible that your search for one bug could be disrupted by the |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1309 %presence of another. For example, let's say your software crashes at |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1310 %revision 100, and worked correctly at revision 50. Unknown to you, |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1311 %someone else introduced a different crashing bug at revision 60, and |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1312 %fixed it at revision 80. This could distort your results in one of |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1313 %several ways. |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1314 |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1315 $B0l$D$N%P%0$KBP$9$k%5!<%A$,$=$NB>$N%P%0$NB8:_$G:.Mp$5$;$i$l$k$3$H$,M-$jF@(B |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1316 $B$k!%Nc$($P%=%U%H%&%'%"$,%j%S%8%g%s(B100$B$G%/%i%C%7%e$7!$%j%S%8%g%s(B50$B$GF0:n(B |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1317 $B$7$?$H$9$k!%$"$J$?$K$OL$CN$@$,!$C/$+JL$N?M$,%j%S%8%g%s(B60$B$GB>$N%/%i%C%7%e(B |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1318 $B$9$k%P%0$r;}$A9~$_!$%j%S%8%g%s(B80$B$G=$@5$7$?$H$9$k!%$3$l$O7k2L$rJ#?t$NJ}8~(B |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1319 $B$XY`6J$2F@$k!%(B |
130
26b7a4e943aa
Describe the bisect extension.
Bryan O'Sullivan <bos@serpentine.com>
parents:
129
diff
changeset
|
1320 |
314
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1321 %It is possible that this other bug completely ``masks'' yours, which |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1322 %is to say that it occurs before your bug has a chance to manifest |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1323 %itself.If you can't avoid that other bug (for example, it prevents |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1324 %your project from building), and so can't tell whether your bug is |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1325 %present in a particular changeset, the \hgcmd{bisect} command cannot |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1326 %help you directly. Instead, you can mark a changeset as untested by |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1327 %running \hgcmdargs{bisect}{--skip}. |
130
26b7a4e943aa
Describe the bisect extension.
Bryan O'Sullivan <bos@serpentine.com>
parents:
129
diff
changeset
|
1328 |
314
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1329 $B$3$NJL$N%P%0$,DI$$$+$1$F$$$k%P%0$r40A4$K%^%9%/$7$F$7$^$&$3$H$bM-$jF@$k!%(B |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1330 $BDI$$$+$1$F$$$k%P%0$,L@$i$+$K$J$kA0$K$3$l$,5/$-$k$3$H$bM-$jF@$k!%B>$N%P%0(B |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1331 $B$,KI$.@Z$l$J$$$J$i!$%P%0$,FCDj$N%A%'%s%8%;%C%H$K4^$^$l$k$H8@$&$3$H$b$G$-(B |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1332 $B$J$$!%(B\hgcmd{bisect}$B%3%^%s%I$OD>@\$"$J$?$r=u$1$k$3$H$,$G$-$J$$!%$=$NBe$o(B |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1333 $B$j!$$"$k%A%'%s%8%;%C%H$r(B\hgcmdargs{bisect}{--skip}$B$K$h$C$FL$%F%9%H$H%^!<(B |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1334 $B%/$9$k$3$H$,$G$-$k!%(B |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1335 |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1336 |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1337 %A different problem could arise if your test for a bug's presence is |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1338 %not specific enough. If you check for ``my program crashes'', then |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1339 %both your crashing bug and an unrelated crashing bug that masks it |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1340 %will look like the same thing, and mislead \hgcmd{bisect}. |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1341 |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1342 $B%P%0$N%F%9%H$,==J,$K>\:Y$G$J$+$C$?>l9g!$JL$NLdBj$,5/$3$jF@$k!%%W%m%0%i%`(B |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1343 $B$,%/%i%C%7%e$9$k$+$I$&$+$r%A%'%C%/$7$F$$$k;~!$DI@W$7$F$$$k%/%i%C%7%e%P%0(B |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1344 $B$H!$$=$l$H$OL54X78$J%/%i%C%7%e%P%0$,:.:_$F$$$k$H$3$l$i$OF1$8$K8+$($F$7$^(B |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1345 $B$$!$7k2LE*$K%A%'%C%/$r%^%9%/$7$F$7$^$$!$(B\hgcmd{bisect}$B$r%_%9%j!<%I$9$k!%(B |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1346 |
282 | 1347 |
314
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1348 %Another useful situation in which to use \hgcmdargs{bisect}{--skip} is |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1349 %if you can't test a revision because your project was in a broken and |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1350 %hence untestable state at that revision, perhaps because someone |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1351 %checked in a change that prevented the project from building. |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1352 |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1353 \hgcmdargs{bisect}{--skip}$B$N;HMQ$,M-MQ$J$b$&0l$DJL$N>u67$O!$C/$+$,%S%k%I(B |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
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 |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
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 |
130
26b7a4e943aa
Describe the bisect extension.
Bryan O'Sullivan <bos@serpentine.com>
parents:
129
diff
changeset
|
1356 |
314
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1357 |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1358 %\subsection{Bracket your search lazily} |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1359 \subsection{$BC5:w$rBUBF$K%V%i%1%C%H$9$k(B} |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1360 |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1361 %Choosing the first ``good'' and ``bad'' changesets that will mark the |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1362 %end points of your search is often easy,but it bears a little |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1363 %discussion nevertheless. From the perspective of \hgcmd{bisect}, the |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1364 %``newest'' changeset is conventionally ``bad'', and the older |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1365 %changeset is ``good''. |
130
26b7a4e943aa
Describe the bisect extension.
Bryan O'Sullivan <bos@serpentine.com>
parents:
129
diff
changeset
|
1366 |
314
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1367 $B:G=i$N(Bgood$B$H(Bbad$B%A%'%s%8%;%C%H$NAH$rA*$S!$%5!<%AHO0O$r;XDj$9$k$N$OB?$/$N(B |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1368 $B>l9g4JC1$@$,!$<c43$N5DO@$NM>CO$,$"$k!%(B\hgcmd{bisect}$B$+$i8+$?;~!$:G?7$N%A%'(B |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1369 $B%s%8%;%C%H$O(Bbad$B$G!$8E$$%A%'%s%8%;%C%H$O(Bgood$B$H$J$k!%(B |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1370 |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1371 %If you're having trouble remembering when a suitable ``good'' change |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1372 %was, so that you can tell \hgcmd{bisect}, you could do worse than |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1373 %testing changesets at random. Just remember to eliminate contenders |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1374 %that can't possibly exhibit the bug (perhaps because the feature with |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1375 %the bug isn't present yet) and those where another problem masks the |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1376 %bug (as I discussed above). |
130
26b7a4e943aa
Describe the bisect extension.
Bryan O'Sullivan <bos@serpentine.com>
parents:
129
diff
changeset
|
1377 |
314
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1378 $BE,@Z$J(Bgood$B%A%'%s%8%;%C%H$r3P$($F$$$J$$;~!$(B\hgcmd{bisect}$B$K$=$l$r;XDj$9$k(B |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1379 $B$H!$%i%s%@%`$KA*$V$h$j$b0-$$C5:w$r9T$&2DG=@-$,$"$k!%%P%0$r<($5$J$$!J$*$=(B |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1380 $B$i$/%P%0$N$"$k5!G=$,<BAu$5$l$F$$$J$$!K%A%'%s%8%;%C%H$H!$B>$NLdBj$,DI@WCf(B |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1381 $B$N%P%0$r%^%9%/$7$F$7$^$&$h$&$J%A%'%s%8%;%C%H$N$_$r>C5n$9$k$3$H$r3P$($F$*(B |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1382 $B$/$Y$-$@!%(B |
130
26b7a4e943aa
Describe the bisect extension.
Bryan O'Sullivan <bos@serpentine.com>
parents:
129
diff
changeset
|
1383 |
314
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1384 %Even if you end up ``early'' by thousands of changesets or months of |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1385 %history, you will only add a handful of tests to the total number that |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1386 %\hgcmd{bisect} must perform, thanks to its logarithmic behaviour. |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1387 |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1388 \hgcmd{bisect}$B$,9T$o$J$1$l$P$J$i$J$$%F%9%H$N2s?t$O!$BP>]$H$9$k%A%'%s%8%;%C(B |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1389 $B%H$NBP?t$KHfNc$9$k$?$a!$?t%u7n$K5Z$VMzNr$NCf$N?t@i$N%A%'%s%8%;%C%H$NCf$K(B |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1390 $BBP$7$F$b>/?t$N%F%9%H$rDI2C$9$k$@$1$G:Q$`!%(B |
aa132d5e2b32
completed draft translation for undo.tex.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
313
diff
changeset
|
1391 |
130
26b7a4e943aa
Describe the bisect extension.
Bryan O'Sullivan <bos@serpentine.com>
parents:
129
diff
changeset
|
1392 |
121
9094c9fda8ec
Start chapter on error recovery.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
1393 %%% Local Variables: |
291
504f23b4f625
started japanese translation
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
290
diff
changeset
|
1394 %%% mode: yatex |
121
9094c9fda8ec
Start chapter on error recovery.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
1395 %%% TeX-master: "00book" |
9094c9fda8ec
Start chapter on error recovery.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
1396 %%% End: |