annotate ja/hook.tex @ 800:1a30d2627512

Propagate 2ff0a43f1152 Update ch03
author Yoshiki Yazawa <yaz@honeyplanet.jp>
date Thu, 18 Jun 2009 20:04:44 +0900
parents 2a93b1d35990
children 8a3041e6f3cb
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
374
32c932f185ed - fixed mq.tex a bit.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
1 %\chapter{Handling repository events with hooks}
32c932f185ed - fixed mq.tex a bit.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
2 \chapter{$B%j%]%8%H%j%$%Y%s%H$r%U%C%/$G<h$j07$&(B}
34
c0979ed1eabd Get started on hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
3 \label{chap:hook}
c0979ed1eabd Get started on hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
4
375
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
5 %Mercurial offers a powerful mechanism to let you perform automated
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
6 %actions in response to events that occur in a repository. In some
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
7 %cases, you can even control Mercurial's response to those events.
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
8
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
9 Mercurial$B$O!$%j%]%8%H%j$K5/$3$k%$%Y%s%H$KBP$7$F<+F02=$5$l$?%"%/%7%g%s$r9T(B
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
10 $B$&6/NO$J%a%+%K%:%`$r;}$C$F$$$k!%$$$/$D$+$N%$%Y%s%H$KBP$7$F$O!$(BMercurial$B$N(B
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
11 $BH?1~$r@)8f$9$k$3$H$b$G$-$k!%(B
34
c0979ed1eabd Get started on hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
12
375
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
13 %The name Mercurial uses for one of these actions is a \emph{hook}.
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
14 %Hooks are called ``triggers'' in some revision control systems, but
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
15 %the two names refer to the same idea.
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
16
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
17 Mercurial$B$O(B\emph{$B%U%C%/(B}$B$H8F$P$l$k5!9=$r;H$C$F%"%/%7%g%s$r9T$&!%%U%C%/$O(B
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
18 $BB>$N%j%S%8%g%s%3%s%H%m!<%k%7%9%F%`$G$O(B``$B%H%j%,(B''$B$H8F$P$l$k$3$H$b$"$k$,!$(B
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
19 $B$3$l$i$O<B:]$OF1$8$b$N$G$"$k!%(B
34
c0979ed1eabd Get started on hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
20
374
32c932f185ed - fixed mq.tex a bit.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
21 %\section{An overview of hooks in Mercurial}
32c932f185ed - fixed mq.tex a bit.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
22 \section{Mercurial$B$G$N%U%C%/$N35MW(B}
38
b49a7dd4e564 More content for hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 37
diff changeset
23
375
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
24 %Here is a brief list of the hooks that Mercurial supports. We will
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
25 %revisit each of these hooks in more detail later, in
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
26 %section~\ref{sec:hook:ref}.
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
27
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
28 Mercurial$B$,%5%]!<%H$9$k%U%C%/$N0lIt$rNs5s$9$k!%8D!9$N%U%C%/$K$D$$$F$O(B
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
29 $B8e$[$I(Bsection~\ref{sec:hook:ref}$B$G>\:Y$K?($l$k!%(B
41
d1a3394f8bcf More hook content.
Bryan O'Sullivan <bos@serpentine.com>
parents: 40
diff changeset
30
38
b49a7dd4e564 More content for hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 37
diff changeset
31 \begin{itemize}
375
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
32 %\item[\small\hook{changegroup}] This is run after a group of
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
33 % changesets has been brought into the repository from elsewhere.
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
34 \item[\small\hook{changegroup}] $B%A%'%s%8%;%C%H%0%k!<%W$,30It$+$i%j%]%8%H(B
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
35 $B%j$K2C$o$C$?8e$G8F$S=P$5$l$k!%(B
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
36
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
37 %\item[\small\hook{commit}] This is run after a new changeset has been
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
38 % created in the local repository.
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
39 \item[\small\hook{commit}] $B%m!<%+%k%j%]%8%H%j$G?7$7$$%A%'%s%8%;%C%H$,:n(B
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
40 $B@.$5$l$?8e$K8F$S=P$5$l$k!%(B
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
41
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
42 %\item[\small\hook{incoming}] This is run once for each new changeset
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
43 % that is brought into the repository from elsewhere. Notice the
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
44 % difference from \hook{changegroup}, which is run once per
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
45 % \emph{group} of changesets brought in.
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
46
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
47 \item[\small\hook{incoming}] $B?7$7$$%A%'%s%8%;%C%H$,30It$+$i%j%]%8%H%j$K2C(B
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
48 $B$o$kKh$K8F$S=P$5$l$k!%(B\emph{group}$B$,2C$o$kKh$K8F$S=P$5$l$k%U%C(B
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
49 $B%/$K(B\hook{changegroup}$B%U%C%/$,$"$k!%(B
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
50
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
51 %\item[\small\hook{outgoing}] This is run after a group of changesets
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
52 % has been transmitted from this repository.
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
53 \item[\small\hook{outgoing}] $B%j%]%8%H%j$+$i%A%'%s%8%;%C%H%0%k!<%W$,30It(B
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
54 $B$KAw?.$5$l$?8e$K8F$S=P$5$l$k!%(B
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
55
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
56 %\item[\small\hook{prechangegroup}] This is run before starting to
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
57 % bring a group of changesets into the repository.
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
58 \item[\small\hook{prechangegroup}] $B%A%'%s%8%;%C%H%0%k!<%W$r%j%]%8%H%j$+(B
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
59 $B$i30It$K;}$A=P$9A0$K8F$S=P$5$l$k!%(B
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
60
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
61 %\item[\small\hook{precommit}] Controlling. This is run before starting
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
62 % a commit.
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
63 \item[\small\hook{precommit}] Controlling. $B%3%_%C%H$,;O$^$kA0$K8F$S=P$5(B
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
64 $B$l$k!%(B
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
65
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
66 %\item[\small\hook{preoutgoing}] Controlling. This is run before
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
67 % starting to transmit a group of changesets from this repository.
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
68 \item[\small\hook{preoutgoing}] Controlling. $B%A%'%s%8%;%C%H%0%k!<%W$r%j(B
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
69 $B%]%8%H%j$+$i30It$KAw?.$9$kA0$K8F$S=P$5$l$k!%(B
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
70
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
71 %\item[\small\hook{pretag}] Controlling. This is run before creating a tag.
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
72 \item[\small\hook{pretag}] Controlling. $B%?%0$,:n@.$5$l$kA0$K8F$S=P$5$l$k!%(B
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
73
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
74 %\item[\small\hook{pretxnchangegroup}] Controlling. This is run after a
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
75 % group of changesets has been brought into the local repository from
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
76 % another, but before the transaction completes that will make the
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
77 % changes permanent in the repository.
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
78 \item[\small\hook{pretxnchangegroup}] Controlling. $B%A%'%s%8%;%C%H%0%k!<%W(B
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
79 $B$,30It$+$i%m!<%+%k%j%]%8%H%j$K2C$o$C$?8e!$1JB3E*$K5-O?$9$k$?(B
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
80 $B$a$N%H%i%s%6%/%7%g%s$,40N;$9$kA0$K8F$S=P$5$l$k!%(B
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
81
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
82 %\item[\small\hook{pretxncommit}] Controlling. This is run after a new
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
83 % changeset has been created in the local repository, but before the
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
84 % transaction completes that will make it permanent.
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
85 \item[\small\hook{pretxncommit}] Controlling. $B?7$7$$%A%'%s%8%;%C%H$,%m!<(B
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
86 $B%+%k%j%]%8%H%j$G:n@.$5$l$?8e!$1JB3E*$K5-O?$9$k$?$a$N%H%i%s%6(B
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
87 $B%/%7%g%s$,40N;$9$kA0$K8F$S=P$5$l$k!%(B
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
88
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
89 %\item[\small\hook{preupdate}] Controlling. This is run before starting
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
90 % an update or merge of the working directory.
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
91 \item[\small\hook{preupdate}] Controlling. $B%o!<%-%s%0%G%#%l%/%H%j$N99?7(B
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
92 $B$^$?$O%^!<%8$,9T$o$l$kA0$K8F$S=P$5$l$k!%(B
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
93
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
94 %\item[\small\hook{tag}] This is run after a tag is created.
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
95 \item[\small\hook{tag}] $B%?%0$,:n@.$5$l$?8e$G8F$S=P$5$l$k!%(B
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
96
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
97 %\item[\small\hook{update}] This is run after an update or merge of the
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
98 % working directory has finished.
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
99 \item[\small\hook{update}] $B%o!<%-%s%0%G%#%l%/%H%j$N99?7$+%^!<%8$,40N;$7(B
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
100 $B$?;~$K8F$S=P$5$l$k!%(B
38
b49a7dd4e564 More content for hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 37
diff changeset
101 \end{itemize}
375
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
102 %Each of the hooks whose description begins with the word
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
103 %``Controlling'' has the ability to determine whether an activity can
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
104 %proceed. If the hook succeeds, the activity may proceed; if it fails,
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
105 %the activity is either not permitted or undone, depending on the hook.
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
106
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
107 $B%U%C%/$N$&$A!$@bL@$,(B``Controlling''$B$H$$$&8l$G;O$^$k$b$N$O!$%U%C%/$N@.H]$r(B
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
108 $BH=Dj$7!$0J8e$NF0:n$r9T$&$+$I$&$+7hDj$9$k5!G=$,$"$k!%%U%C%/$,@.8y$9$k$HF0(B
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
109 $B:n$O@h$X?J$`!%%U%C%/$,@.8y$7$J$+$C$?>l9g$O0J8e$NF0:n$O<B9T$,5v2D$5$l$J$$(B
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
110 $B$+!$F0:n$,40N;$;$:=*$k!%(B
38
b49a7dd4e564 More content for hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 37
diff changeset
111
374
32c932f185ed - fixed mq.tex a bit.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
112 %\section{Hooks and security}
32c932f185ed - fixed mq.tex a bit.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
113 \section{$B%U%C%/$H%;%-%e%j%F%#(B}
38
b49a7dd4e564 More content for hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 37
diff changeset
114
374
32c932f185ed - fixed mq.tex a bit.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
115 %\subsection{Hooks are run with your privileges}
32c932f185ed - fixed mq.tex a bit.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
116 \subsection{$B%U%C%/$O%f!<%6$N8"8B$GF0:n$9$k(B}
38
b49a7dd4e564 More content for hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 37
diff changeset
117
375
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
118 %When you run a Mercurial command in a repository, and the command
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
119 %causes a hook to run, that hook runs on \emph{your} system, under
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
120 %\emph{your} user account, with \emph{your} privilege level. Since
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
121 %hooks are arbitrary pieces of executable code, you should treat them
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
122 %with an appropriate level of suspicion. Do not install a hook unless
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
123 %you are confident that you know who created it and what it does.
38
b49a7dd4e564 More content for hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 37
diff changeset
124
375
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
125 $B%j%]%8%H%jFb$G(BMercurial$B%3%^%s%I$r<B9T$7!$%3%^%s%I$,%U%C%/$r8F$S=P$7$?>l(B
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
126 $B9g!$%U%C%/$O(B\emph{$BA`:n<T(B}$B$N%7%9%F%`$G!$(B\emph{$BA`:n<T(B}$B$NFC8"%l%Y%k$GF0:n$9(B
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
127 $B$k!%%U%C%/$OG$0U$N<B9T%3!<%I$J$N$G!$Aj1~$NN10U$,I,MW$G$"$k!%%U%C%/$r:n$C(B
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
128 $B$?$N$,C/$G!$$=$N%U%C%/$,2?$r$9$k$N$+$-$A$s$HM}2r$9$k$3$H$J$7$K%U%C%/$r%$(B
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
129 $B%s%9%H!<%k$7$F$O$J$i$J$$!%(B
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
130
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
131 %In some cases, you may be exposed to hooks that you did not install
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
132 %yourself. If you work with Mercurial on an unfamiliar system,
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
133 %Mercurial will run hooks defined in that system's global \hgrc\ file.
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
134
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
135 $B<+J,$G%$%s%9%H!<%k$7$?$N$G$O$J$$%U%C%/$r<B9T$5$;$F$7$^$&$3$H$bM-$jF@$k!%(B
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
136 $BB>=j$N%7%9%F%`$N>e$G(BMercurial$B$r;H$&>l9g!$(BMercurial$B$,%7%9%F%`%o%$%I$N(B
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
137 \hgrc\ $B%U%!%$%k$GDj5A$5$l$?%U%C%/$r5/F0$9$k2DG=@-$,$"$k!%(B
38
b49a7dd4e564 More content for hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 37
diff changeset
138
375
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
139 %If you are working with a repository owned by another user, Mercurial
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
140 %can run hooks defined in that user's repository, but it will still run
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
141 %them as ``you''. For example, if you \hgcmd{pull} from that
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
142 %repository, and its \sfilename{.hg/hgrc} defines a local
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
143 %\hook{outgoing} hook, that hook will run under your user account, even
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
144 %though you don't own that repository.
38
b49a7dd4e564 More content for hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 37
diff changeset
145
375
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
146 $BB>$N%f!<%6$,=jM-$9$k%j%]%8%H%j$G:n6H$9$k>l9g!$(BMercurial$B$O=jM-<T$N%j%]%8(B
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
147 $B%H%jFb$GDj5A$5$l$?%U%C%/$r<B9T$7F@$k$,!$<B9T8"8B$O$"$J$?$N$b$N$G9T$o$l$k!%(B
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
148 $BNc$($P$=$N%j%]%8%H%j$+$i(B\hgcmd{pull}$B$r9T$&$H$-!$%j%]%8%H%jFb$N(B
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
149 \sfilename{.hg/hgrc}$B%U%!%$%k$G%m!<%+%k$J(B\hook{outgoing}$B%U%C%/$,Dj5A$5$l$F(B
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
150 $B$$$k$H!$$"$J$?$O$=$N%j%]%8%H%j$r=jM-$7$F$$$J$$$K$b$+$+$o$i$:$=$N%U%C%/$O(B
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
151 $B$"$J$?$N8"8B$G<B9T$5$l$k!%(B
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
152
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
153 %\begin{note}
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
154 % This only applies if you are pulling from a repository on a local or
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
155 % network filesystem. If you're pulling over http or ssh, any
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
156 % \hook{outgoing} hook will run under whatever account is executing
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
157 % the server process, on the server.
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
158 %\end{note}
38
b49a7dd4e564 More content for hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 37
diff changeset
159 \begin{note}
375
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
160 $B$3$l$O%m!<%+%k$J%j%]%8%H%j$d%M%C%H%o!<%/%U%!%$%k%7%9%F%`>e$N%j%]%8%H%j$+(B
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
161 $B$i(Bpull$B$7$?>l9g$K$N$_E,MQ$5$l$k!%(Bhttp$B$^$?$O(Bssh$B$r;H$C$F(Bpull$B$7$?>l9g!$$9$Y(B
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
162 $B$F$N(B\hook{outgoing}$B%U%C%/$O%5!<%P>e$G%5!<%P%W%m%;%9$r<B9T$7$F$$$k%"%+%&(B
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
163 $B%s%H$N8"8B$G<B9T$5$l$k!%(B
38
b49a7dd4e564 More content for hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 37
diff changeset
164 \end{note}
b49a7dd4e564 More content for hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 37
diff changeset
165
375
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
166 %XXX To see what hooks are defined in a repository, use the
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
167 %\hgcmdargs{config}{hooks} command. If you are working in one
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
168 %repository, but talking to another that you do not own (e.g.~using
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
169 %\hgcmd{pull} or \hgcmd{incoming}), remember that it is the other
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
170 %repository's hooks you should be checking, not your own.
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
171
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
172 XXX $B%j%]%8%H%jFb$GDj5A$5$l$F$$$k%U%C%/$r8+$k$K$O(B
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
173 \hgcmdargs{config}{hooks}$B%3%^%s%I$r;H$&!%$"$k%j%]%8%H%j$G:n6H$7$F$$$F!$?7(B
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
174 $B$7$$%3!<%I$rB>$N%j%]%8%H%j$+$iF~<j$9$k$?$a$KDL?.$r9T$&>l9g!JNc$($P(B
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
175 \hgcmd{pull}$B$+(B\hgcmd{incoming}$B$r<B9T$9$k!K(B $B!$%A%'%C%/$9$Y$-%U%C%/$O<j85$N(B
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
176 $B%j%]%8%H%j$N$b$N$G$O$J$/!$%j%b!<%H$N%j%]%8%H%j$N%U%C%/$G$"$k!%(B
38
b49a7dd4e564 More content for hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 37
diff changeset
177
374
32c932f185ed - fixed mq.tex a bit.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
178 %\subsection{Hooks do not propagate}
375
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
179 \subsection{$B%U%C%/$OEAGE$7$J$$(B}
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
180
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
181 %In Mercurial, hooks are not revision controlled, and do not propagate
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
182 %when you clone, or pull from, a repository. The reason for this is
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
183 %simple: a hook is a completely arbitrary piece of executable code. It
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
184 %runs under your user identity, with your privilege level, on your
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
185 %machine.
38
b49a7dd4e564 More content for hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 37
diff changeset
186
375
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
187 Mercurial$B$G$O!$%U%C%/$O%j%S%8%g%s4IM}$5$l$:!$%j%]%8%H%j$+$i%/%m!<%s$7$?$j(B
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
188 pull$B$7$F$bEAGE$7$J$$!%$3$&$J$C$F$$$kM}M3$OC1=c$G!$%U%C%/$OG$0U$N<B9T2DG=(B
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
189 $B%3!<%I$G$"$k$+$i$G$"$k!%%U%C%/$O$"$J$?$N%^%7%s$N>e$G$"$J$?$N%f!<%6!<(BID$B$H(B
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
190 $BFC8"%l%Y%k$GF0:n$GF0$/!%(B
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
191
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
192 %It would be extremely reckless for any distributed revision control
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
193 %system to implement revision-controlled hooks, as this would offer an
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
194 %easily exploitable way to subvert the accounts of users of the
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
195 %revision control system.
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
196
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
197 $BJ,;6%j%S%8%g%s%3%s%H%m!<%k%7%9%F%`$K%j%S%8%g%s4IM}$5$l$?%U%C%/$r<BAu$9$k(B
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
198 $B$N$O$H$F$bL5KE$G$"$k!%$3$N$h$&$J5!9=$,$"$k$H%j%S%8%g%s%3%s%H%m!<%k%7%9%F(B
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
199 $B%`$N%f!<%6%"%+%&%s%H$r56Au$9$k$h$&$J;E3]$1$r4JC1$K<B8=$G$-$F$7$^$&!%(B
38
b49a7dd4e564 More content for hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 37
diff changeset
200
375
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
201 %Since Mercurial does not propagate hooks, if you are collaborating
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
202 %with other people on a common project, you should not assume that they
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
203 %are using the same Mercurial hooks as you are, or that theirs are
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
204 %correctly configured. You should document the hooks you expect people
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
205 %to use.
38
b49a7dd4e564 More content for hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 37
diff changeset
206
375
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
207 Mercurial$B$O%U%C%/$rEAGE$5$;$J$$$N$G!$6&DL$N%W%m%8%'%/%H$GB>$N3+H/<T$H6(NO(B
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
208 $B$7$F$$$k>l9g!$H`$i$O$"$J$?$,;H$C$F$k$N$HF1$8(BMercurial$B%U%C%/$r;H$C$F$$$k$H(B
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
209 $B2>Dj$7$?$j!$H`$i$N%j%]%8%H%j$G$b%U%C%/$,F1MM$K@5$7$/@_Dj$5$l$F$$$k$H2>Dj(B
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
210 $B$9$Y$-$G$O$J$$!%H`$i$,%U%C%/$r;H$&$h$&$KK>$`$N$G$"$l$P!$;HMQK!$K$D$$$F%I(B
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
211 $B%-%e%a%s%H$r:n@.$9$Y$-$G$"$k!%(B
38
b49a7dd4e564 More content for hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 37
diff changeset
212
375
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
213 %In a corporate intranet, this is somewhat easier to control, as you
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
214 %can for example provide a ``standard'' installation of Mercurial on an
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
215 %NFS filesystem, and use a site-wide \hgrc\ file to define hooks that
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
216 %all users will see. However, this too has its limits; see below.
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
217
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
218 $B4k6HFb$N%$%s%H%i%M%C%H$G$O%3%s%H%m!<%k$O4vJ,4JC1$G$"$k!%(B NFS$B%U%!%$%k%7%9(B
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
219 $B%F%`>e$G(BMercurial$B$N(B``$BI8=`(B''$B%$%s%9%H%l!<%7%g%sNc$rDs6!$7!$$9$Y$F$N%f!<%6$,(B
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
220 $B;2>H$9$k%5%$%H%o%$%I$N(B\hgrc\ $B%U%!%$%k$rMQ0U$7!$$=$NCf$G%U%C%/$rDj5A$9$k$3(B
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
221 $B$H$,$G$-$k!%$7$+$7$3$NJ}K!$K$b2<5-$N$h$&$J7gE@$,$"$k!%(B
38
b49a7dd4e564 More content for hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 37
diff changeset
222
374
32c932f185ed - fixed mq.tex a bit.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
223 %\subsection{Hooks can be overridden}
32c932f185ed - fixed mq.tex a bit.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
224 \subsection{$B%U%C%/$O%*!<%P%i%$%I2DG=$G$"$k(B}
38
b49a7dd4e564 More content for hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 37
diff changeset
225
375
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
226 %Mercurial allows you to override a hook definition by redefining the
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
227 %hook. You can disable it by setting its value to the empty string, or
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
228 %change its behaviour as you wish.
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
229
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
230 Mercurial$B$G$O!$%U%C%/$r:FDj5A$9$k$3$H$K$h$C$F!$4{B8$N%U%C%/Dj5A$r%*!<%P%i(B
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
231 $B%$%I$9$k$3$H$,$G$-$k!%$3$l$OJQ?t$r6u$NJ8;zNs$K$7$?$j!$5sF0$rJQ99$9$k$3$H(B
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
232 $B$G6X;_$9$k$3$H$,$G$-$k!%(B
38
b49a7dd4e564 More content for hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 37
diff changeset
233
375
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
234 %If you deploy a system-~or site-wide \hgrc\ file that defines some
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
235 %hooks, you should thus understand that your users can disable or
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
236 %override those hooks.
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
237
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
238 $B%U%C%/$rDj5A$7$?%7%9%F%`%o%$%I$^$?$O%5%$%H%o%$%I$N(B\hgrc\ $B%U%!%$%k$r;HMQ$7(B
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
239 $B$F$b!$%j%]%8%H%j$N%f!<%6$,%U%C%/$r6X;_$7$?$j%*!<%P%i%$%I$G$-$F$7$^$&$N$K(B
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
240 $B5$IU$/$@$m$&!%(B
38
b49a7dd4e564 More content for hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 37
diff changeset
241
374
32c932f185ed - fixed mq.tex a bit.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
242 %\subsection{Ensuring that critical hooks are run}
32c932f185ed - fixed mq.tex a bit.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
243 \subsection{$B%/%j%F%#%+%k$J%U%C%/$,3N<B$K<B9T$5$l$k$h$&$K$9$k(B}
38
b49a7dd4e564 More content for hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 37
diff changeset
244
375
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
245 %Sometimes you may want to enforce a policy that you do not want others
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
246 %to be able to work around. For example, you may have a requirement
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
247 %that every changeset must pass a rigorous set of tests. Defining this
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
248 %requirement via a hook in a site-wide \hgrc\ won't work for remote
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
249 %users on laptops, and of course local users can subvert it at will by
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
250 %overriding the hook.
38
b49a7dd4e564 More content for hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 37
diff changeset
251
375
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
252 $B;~$K$OB>$N3+H/<T$,2sHr:v$r$H$l$J$$$h$&$J%]%j%7!<$rMW@A$7$?$$>l9g$,$"$k$@(B
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
253 $B$m$&!%Nc$($P$9$Y$F$N%A%'%s%8%;%C%H$,873J$J%F%9%H%;%C%H$K%Q%9$9$k$3$H$rI,(B
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
254 $BMW$H$9$k>l9g$,9M$($i$l$k!%$3$l$r%5%$%H%o%$%I$N(B\hgrc\ $B$G%U%C%/$H$7$FDj5A(B
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
255 $B$7$?>l9g!$$3$l$O%i%C%W%H%C%W$r;H$C$F$$$k%j%b!<%H%f!<%6$K$O5!G=$7$J$$$7!$(B
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
256 $B%U%C%/$r%*!<%P%i%$%I$G$-$k$?$a!$%m!<%+%k%f!<%6$K$H$C$F$bL5;k$G$-$F$7$^$&!%(B
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
257
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
258 %Instead, you can set up your policies for use of Mercurial so that
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
259 %people are expected to propagate changes through a well-known
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
260 %``canonical'' server that you have locked down and configured
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
261 %appropriately.
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
262
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
263 $B$=$NBe$o$j!$(BMercurial$B$N;HMQ$K4X$9$k%]%j%7!<$r@_Dj$7!$E,@Z$K@_Dj$5$l!$87=E(B
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
264 $B$K4IM}$5$l$?4{CN$N(B``$B%+%N%K%+%k(B''$B%5!<%P$rDL$8$FJQ99$,GH5Z$9$k$h$&$K$9$k$3(B
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
265 $B$H$,$G$-$k!%(B
38
b49a7dd4e564 More content for hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 37
diff changeset
266
375
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
267 %One way to do this is via a combination of social engineering and
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
268 %technology. Set up a restricted-access account; users can push
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
269 %changes over the network to repositories managed by this account, but
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
270 %they cannot log into the account and run normal shell commands. In
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
271 %this scenario, a user can commit a changeset that contains any old
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
272 %garbage they want.
38
b49a7dd4e564 More content for hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 37
diff changeset
273
375
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
274 $B$3$l$r<B8=$9$k0lK!$O%=!<%7%c%k%(%s%8%K%"%j%s%0$H5;=Q$NAH$_9g$o$;$G9T$&J}(B
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
275 $BK!$G$"$k!%8BDj%"%/%;%9%"%+%&%s%H$r@_Dj$7!$$3$N%"%+%&%s%H$G4IM}$5$l$F$$$k(B
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
276 $B%j%]%8%H%j$KBP$7$F%f!<%6$OJQ99$r%M%C%H%o!<%/$r2p$7$F(Bpush$B$G$-$k!%$7$+$7%f!<(B
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
277 $B%6$O$3$N%"%+%&%s%H$G%m%0%$%s$7$?$j!$DL>o$N%7%'%k%3%^%s%I$r<B9T$9$k$3$H$O(B
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
278 $B$G$-$J$$!%$3$N%7%J%j%*$G$O!$%f!<%6$O$I$s$J8E$$%4%_$r4^$s$@%A%'%s%8%;%C%H(B
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
279 $B$G$b%3%_%C%H$9$k$3$H$,$G$-$k!%(B
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
280
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
281 %When someone pushes a changeset to the server that everyone pulls
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
282 %from, the server will test the changeset before it accepts it as
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
283 %permanent, and reject it if it fails to pass the test suite. If
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
284 %people only pull changes from this filtering server, it will serve to
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
285 %ensure that all changes that people pull have been automatically
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
286 %vetted.
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
287
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
288 $BB?$/$N%f!<%6$,(Bpull$B$9$k%5!<%P$KC/$+$,%A%'%s%8%;%C%H$r(Bpush$B$7$?>l9g!$%5!<%P(B
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
289 $B$O%A%'%s%8%;%C%H$r915WE*$K<u$1F~$l$kA0$K%A%'%C%/$r9T$$!$0lO"$N%F%9%H$r%Q(B
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
290 $B%9$G$-$J$1$l$P%j%8%'%/%H$r9T$&!%%f!<%6$,$3$N%U%#%k%?%5!<%P$+$i$N$_(Bpull$B$r(B
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
291 $B9T$&$N$G$"$l$P!$A4$F$NJQ99$O<+F0E*$KA4$F8!::$5$l$F$$$k$3$H$K$J$k!%(B
38
b49a7dd4e564 More content for hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 37
diff changeset
292
374
32c932f185ed - fixed mq.tex a bit.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
293 %\section{Care with \texttt{pretxn} hooks in a shared-access repository}
32c932f185ed - fixed mq.tex a bit.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
294 \section{$B6&M-%"%/%;%9%j%]%8%H%j$G(B\texttt{pretxn}$B%U%C%/$r;H$&(B}
41
d1a3394f8bcf More hook content.
Bryan O'Sullivan <bos@serpentine.com>
parents: 40
diff changeset
295
375
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
296 %If you want to use hooks to do some automated work in a repository
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
297 %that a number of people have shared access to, you need to be careful
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
298 %in how you do this.
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
299
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
300 $BJ#?t$N%f!<%6$,6&M-%"%/%;%9$r9T$&%j%]%8%H%j$G!$<+F02=$5$l$?:n6H$r9T$&$?$a(B
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
301 $B$K%U%C%/$r;HMQ$7$?$$$J$i!$$I$N$h$&$K9T$&$+Cm0U?<$/9M$($kI,MW$,$"$k!%(B
41
d1a3394f8bcf More hook content.
Bryan O'Sullivan <bos@serpentine.com>
parents: 40
diff changeset
302
375
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
303 %Mercurial only locks a repository when it is writing to the
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
304 %repository, and only the parts of Mercurial that write to the
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
305 %repository pay attention to locks. Write locks are necessary to
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
306 %prevent multiple simultaneous writers from scribbling on each other's
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
307 %work, corrupting the repository.
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
308
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
309 Mercurial$B$O%j%]%8%H%j$K=q$-9~$_$r9T$&$H$-$K$@$1%j%]%8%H%j$r%m%C%/$9$k!%(B
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
310 $B$^$?(BMercurial$B$N=q$-9~$_$r9T$&ItJ,$N$_$,%m%C%/$r9MN8$9$k!%=q$-9~$_%m%C%/(B
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
311 $B$O!$J#?t$NF1;~=q$-9~$_$,B>$NJQ99$r>e=q$-$7!$%j%]%8%H%j$rGKB;$9$k$N$rKI$0!%(B
41
d1a3394f8bcf More hook content.
Bryan O'Sullivan <bos@serpentine.com>
parents: 40
diff changeset
312
375
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
313 %Because Mercurial is careful with the order in which it reads and
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
314 %writes data, it does not need to acquire a lock when it wants to read
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
315 %data from the repository. The parts of Mercurial that read from the
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
316 %repository never pay attention to locks. This lockless reading scheme
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
317 %greatly increases performance and concurrency.
41
d1a3394f8bcf More hook content.
Bryan O'Sullivan <bos@serpentine.com>
parents: 40
diff changeset
318
375
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
319 Mercurial$B$O%G!<%?$NFI$_=q$-$N=g=x$rCm0U?<$/9T$&$?$a!$%j%]%8%H%j$+$i$N%G!<(B
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
320 $B%?FI$_=P$7$N:]$K%m%C%/$r<hF@$9$kI,MW$,$J$$!%(B Mercurial$B$N%j%]%8%H%j$+$iFI(B
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
321 $B$_=P$7$r9T$&ItJ,$O!$%m%C%/$rA4$/5$$K$9$kI,MW$,$J$$!%$3$NL5%m%C%/FI$_=P$7(B
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
322 $B$K$h$C$F!$F1;~<B9T@-$H@-G=$rBgI}$K9b$a$F$$$k!%(B
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
323
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
324 %With great performance comes a trade-off, though, one which has the
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
325 %potential to cause you trouble unless you're aware of it. To describe
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
326 %this requires a little detail about how Mercurial adds changesets to a
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
327 %repository and reads those changes.
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
328
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
329 $B$7$+$7$J$,$i$3$N9b@-G=$O$=$l$rCN$i$J$1$l$PLdBj$r0z$-5/$3$9$"$k%H%l!<%I%*(B
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
330 $B%U$r$b$b$?$i$9!%$3$l$r@bL@$9$k$?$a$K!$(BMercurial$B$,$I$N$h$&$K%A%'%s%8%;%C%H(B
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
331 $B$r%j%]%8%H%j$KDI2C$7!$$=$l$i$rFI$_=P$9$+$N>\:Y$K?($l$J$1$l$P$J$i$J$$!%(B
41
d1a3394f8bcf More hook content.
Bryan O'Sullivan <bos@serpentine.com>
parents: 40
diff changeset
332
375
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
333 %When Mercurial \emph{writes} metadata, it writes it straight into the
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
334 %destination file. It writes file data first, then manifest data
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
335 %(which contains pointers to the new file data), then changelog data
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
336 %(which contains pointers to the new manifest data). Before the first
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
337 %write to each file, it stores a record of where the end of the file
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
338 %was in its transaction log. If the transaction must be rolled back,
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
339 %Mercurial simply truncates each file back to the size it was before the
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
340 %transaction began.
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
341
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
342 Mercurial$B$O%a%?%G!<%?$r(B\emph{$B=q$-9~$`(B}$B$H$-!$D>@\L\E*$N%U%!%$%k$K=q$-9~$_(B
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
343 $B$9$k!%(BMercurial$B$O$^$:%U%!%$%k%G!<%?$r=q$-9~$_!$<!$$$G!J?7$7$$%U%!%$%k%G!<(B
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
344 $B%?$N>l=j$r<($9%]%$%s%?$r4^$`!K%^%K%U%'%9%H%G!<%?$r=q$-9~$`!%$=$7$F!J?7$7(B
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
345 $B$$%^%K%U%'%9%H%G!<%?$N>l=j$r<($9%]%$%s%?$r4^$`!K%A%'%s%8%m%0%G!<%?$r=q$-(B
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
346 $B9~$`!%3F!9$N%U%!%$%k$X$N:G=i$N=q$-9~$_$NA0$K!$%U%!%$%k$NKvHx$N%l%3!<%I$r(B
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
347 $B%H%i%s%6%/%7%g%s%m%0$KJ]B8$9$k!%%H%i%s%6%/%7%g%s$,%m!<%k%P%C%/$5$l$k>l9g(B
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
348 $B$O!$(BMercurial$B$O3F!9$N%U%!%$%k$r%H%i%s%6%/%7%g%s$,;O$^$kA0$N%5%$%:$K@Z$j5M(B
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
349 $B$a$k!%(B
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
350
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
351 %When Mercurial \emph{reads} metadata, it reads the changelog first,
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
352 %then everything else. Since a reader will only access parts of the
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
353 %manifest or file metadata that it can see in the changelog, it can
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
354 %never see partially written data.
41
d1a3394f8bcf More hook content.
Bryan O'Sullivan <bos@serpentine.com>
parents: 40
diff changeset
355
375
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
356 Mercurial$B$O%a%?%G!<%?$r(B\emph{$BFI$`(B}$B;~$K$^$:%A%'%s%8%m%0$rFI$_!$<!$$$G;D$j(B
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
357 $B$NItJ,$rFI$`!%%j!<%@$O%A%'%s%8%m%0$K8=$l$k%^%K%U%'%9%H$N0lIt$^$?$O%U%!%$(B
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
358 $B%k%a%?%G!<%?$N0lIt$K$N$_%"%/%;%9$9$k$?$a!$ItJ,E*$K=q$+$l$?%G!<%?$r8+$k$3(B
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
359 $B$H$O$G$-$J$$!%(B
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
360
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
361 %Some controlling hooks (\hook{pretxncommit} and
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
362 %\hook{pretxnchangegroup}) run when a transaction is almost complete.
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
363 %All of the metadata has been written, but Mercurial can still roll the
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
364 %transaction back and cause the newly-written data to disappear.
41
d1a3394f8bcf More hook content.
Bryan O'Sullivan <bos@serpentine.com>
parents: 40
diff changeset
365
375
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
366 $B$$$/$D$+$N@)8f%U%C%/!J(B\hook{pretxncommit}$B$H(B\hook{pretxnchangegroup}$B!K$O%H(B
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
367 $B%i%s%6%/%7%g%s$,$[$\40N;$7$?;~$K<B9T$5$l$k!%$9$Y$F$N%a%?%G!<%?$,=q$-9~$^(B
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
368 $B$l$k$,!$$3$N;~E@$G$b(BMercurial$B$O%H%i%s%6%/%7%g%s$r85$KLa$9$3$H$,$G$-!$$=$N(B
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
369 $B>l9g$O?7$7$/=q$+$l$?%G!<%?$O>C<:$9$k!%(B
41
d1a3394f8bcf More hook content.
Bryan O'Sullivan <bos@serpentine.com>
parents: 40
diff changeset
370
375
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
371 %If one of these hooks runs for long, it opens a window of time during
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
372 %which a reader can see the metadata for changesets that are not yet
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
373 %permanent, and should not be thought of as ``really there''. The
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
374 %longer the hook runs, the longer that window is open.
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
375
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
376 $B$3$l$i$N%U%C%/$N$&$A(B1$B$D$,D9;~4V$K$o$?$C$F<B9T$5$l$F$$$k$H!$%j!<%@$,%A%'%s(B
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
377 $B%8%;%C%H$N%a%?%G!<%?$rFI$`$3$H$N$G$-$k%?%$%`%&%#%s%I%&$,3+$/!%$3$N%A%'%s(B
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
378 $B%8%;%C%H$O$^$@1JB3E*$J$b$N$K$J$C$F$*$i$:!$=>$C$F<B:_$9$k$H9M$($k$Y$-$G$O(B
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
379 $B$J$$$b$N$G$"$k!%%U%C%/$,<B9T$5$l$F$$$k;~4V$,D9$/$J$l$P$J$k$[$I!$%?%$%`%&%#(B
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
380 $B%s%I%&$,3+$/;~4V$bD9$/$J$k!%(B
24c6081cea2b more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 374
diff changeset
381
374
32c932f185ed - fixed mq.tex a bit.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
382 %\subsection{The problem illustrated}
32c932f185ed - fixed mq.tex a bit.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
383 \subsection{$BLdBj$N>\:Y(B}
134
b727a63518d4 Minor updates to race description.
Bryan O'Sullivan <bos@serpentine.com>
parents: 41
diff changeset
384
377
4a9d7e24b915 a bit more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 375
diff changeset
385 %In principle, a good use for the \hook{pretxnchangegroup} hook would
4a9d7e24b915 a bit more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 375
diff changeset
386 %be to automatically build and test incoming changes before they are
4a9d7e24b915 a bit more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 375
diff changeset
387 %accepted into a central repository. This could let you guarantee that
4a9d7e24b915 a bit more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 375
diff changeset
388 %nobody can push changes to this repository that ``break the build''.
4a9d7e24b915 a bit more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 375
diff changeset
389 %But if a client can pull changes while they're being tested, the
4a9d7e24b915 a bit more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 375
diff changeset
390 %usefulness of the test is zero; an unsuspecting someone can pull
4a9d7e24b915 a bit more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 375
diff changeset
391 %untested changes, potentially breaking their build.
4a9d7e24b915 a bit more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 375
diff changeset
392
4a9d7e24b915 a bit more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 375
diff changeset
393 $B<BMQ$K$*$1$k(B\hook{pretxnchangegroup}$B%U%C%/$NNI$$;HMQK!$H$7$F$O!$E~Ce$7$?(B
4a9d7e24b915 a bit more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 375
diff changeset
394 $BJQ99$,Cf1{$N%j%]%8%H%j$K<h$j9~$^$l$kA0$K<+F0$G%S%k%I$H%F%9%H$r9T$&$3$H$,(B
4a9d7e24b915 a bit more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 375
diff changeset
395 $B9M$($i$l$k!%$3$l$K$h$j!$%S%k%I$rK8$2$kJQ99$OC/$b%j%]%8%H%j$K(Bpush$B$G$-$J$$(B
4a9d7e24b915 a bit more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 375
diff changeset
396 $B$3$H$,3N<B$K$J$k!%%/%i%$%"%s%H$,%F%9%HCf$KJQ99$r(Bpull$B$9$k$3$H$,$G$-$l$P!$(B
4a9d7e24b915 a bit more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 375
diff changeset
397 $B$3$N%F%9%H$NM-MQ@-$O%<%m$K$J$C$F$7$^$&!%5?$$$r;}$?$:$KC/$+$,%F%9%H$5$l$F(B
4a9d7e24b915 a bit more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 375
diff changeset
398 $B$$$J$$JQ99$r(Bpull$B$G$-$k$N$G$"$l$P!$H`$i$N%S%k%I$O<:GT$9$k2DG=@-$,$"$k!%(B
4a9d7e24b915 a bit more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 375
diff changeset
399
4a9d7e24b915 a bit more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 375
diff changeset
400 %The safest technological answer to this challenge is to set up such a
4a9d7e24b915 a bit more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 375
diff changeset
401 %``gatekeeper'' repository as \emph{unidirectional}. Let it take
4a9d7e24b915 a bit more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 375
diff changeset
402 %changes pushed in from the outside, but do not allow anyone to pull
4a9d7e24b915 a bit more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 375
diff changeset
403 %changes from it (use the \hook{preoutgoing} hook to lock it down).
4a9d7e24b915 a bit more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 375
diff changeset
404 %Configure a \hook{changegroup} hook so that if a build or test
4a9d7e24b915 a bit more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 375
diff changeset
405 %succeeds, the hook will push the new changes out to another repository
4a9d7e24b915 a bit more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 375
diff changeset
406 %that people \emph{can} pull from.
41
d1a3394f8bcf More hook content.
Bryan O'Sullivan <bos@serpentine.com>
parents: 40
diff changeset
407
377
4a9d7e24b915 a bit more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 375
diff changeset
408 $B$3$NLdBj$X$N5;=QE*$K:G$b0BA4$J2sEz$O!$(B``$BLgHV(B''$B%j%]%8%H%j$r(B\emph{$B0lJ}8~(B}$B$K(B
4a9d7e24b915 a bit more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 375
diff changeset
409 $B@_Dj$9$k$3$H$G$"$k!%%j%]%8%H%j$r30It$+$i(Bpush$B$5$l$?JQ99$r<u$1<h$k$,!$C/$b(B
4a9d7e24b915 a bit more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 375
diff changeset
410 pull$B$G$-$J$$$h$&$K@_Dj$9$k!J(B\hook{preoutgoing}$B%U%C%/$r;H$C$F%j%]%8%H%j$r(B
4a9d7e24b915 a bit more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 375
diff changeset
411 $B%m%C%/$9$k!K!%(B\hook{changegroup}$B%U%C%/$r@_Dj$7!$%S%k%I$d%F%9%H$,@.8y$7$?(B
378
5530934319b8 compile fix
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 377
diff changeset
412 $B$H$-$K8B$C$F!$%U%C%/$,?7$?$JJQ99$r%f!<%6$N(Bpull\emph{$B$G$-$k(B}$BJL$N%j%]%8%H(B
377
4a9d7e24b915 a bit more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 375
diff changeset
413 $B%j$K(Bpush$B$9$k$h$&$K$9$k!%(B
4a9d7e24b915 a bit more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 375
diff changeset
414
4a9d7e24b915 a bit more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 375
diff changeset
415 %In practice, putting a centralised bottleneck like this in place is
4a9d7e24b915 a bit more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 375
diff changeset
416 %not often a good idea, and transaction visibility has nothing to do
4a9d7e24b915 a bit more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 375
diff changeset
417 %with the problem. As the size of a project---and the time it takes to
4a9d7e24b915 a bit more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 375
diff changeset
418 %build and test---grows, you rapidly run into a wall with this ``try
4a9d7e24b915 a bit more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 375
diff changeset
419 %before you buy'' approach, where you have more changesets to test than
4a9d7e24b915 a bit more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 375
diff changeset
420 %time in which to deal with them. The inevitable result is frustration
4a9d7e24b915 a bit more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 375
diff changeset
421 %on the part of all involved.
41
d1a3394f8bcf More hook content.
Bryan O'Sullivan <bos@serpentine.com>
parents: 40
diff changeset
422
377
4a9d7e24b915 a bit more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 375
diff changeset
423 $B<B:]>e$O!$$3$N$h$&$K=8Cf$7$?%\%H%k%M%C%/$rCV$/$3$H$ONI$$9M$($H$O8@$($:!$(B
4a9d7e24b915 a bit more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 375
diff changeset
424 $B%H%i%s%6%/%7%g%s$N2D;k@-$OA4$/$J$$!%%W%m%8%'%/%H$N%5%$%:$*$h$S%S%k%I$H%F(B
4a9d7e24b915 a bit more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 375
diff changeset
425 $B%9%H$KMW$9$k;~4V$,A}2C$9$k$K=>$C$F!$$3$N$h$&$J(B``$B;vA0$K;n$9(B''$B<jK!$OJI$KFM(B
4a9d7e24b915 a bit more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 375
diff changeset
426 $B$-Ev$?$k!%%F%9%H$K;H$($k;~4V$G;+$-@Z$l$J$$$[$I$N%A%'%s%8%;%C%H$r;n$5$J$1(B
4a9d7e24b915 a bit more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 375
diff changeset
427 $B$l$P$J$i$J$/$J$k$+$i$G$"$k!%%U%i%9%H%l!<%7%g%s$,Cy$k$N$OHr$1$i$l$J$$$@$m(B
4a9d7e24b915 a bit more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 375
diff changeset
428 $B$&!%(B
134
b727a63518d4 Minor updates to race description.
Bryan O'Sullivan <bos@serpentine.com>
parents: 41
diff changeset
429
377
4a9d7e24b915 a bit more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 375
diff changeset
430 %An approach that scales better is to get people to build and test
4a9d7e24b915 a bit more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 375
diff changeset
431 %before they push, then run automated builds and tests centrally
4a9d7e24b915 a bit more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 375
diff changeset
432 %\emph{after} a push, to be sure all is well. The advantage of this
4a9d7e24b915 a bit more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 375
diff changeset
433 %approach is that it does not impose a limit on the rate at which the
4a9d7e24b915 a bit more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 375
diff changeset
434 %repository can accept changes.
4a9d7e24b915 a bit more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 375
diff changeset
435
4a9d7e24b915 a bit more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 375
diff changeset
436 $B$h$j%9%1!<%k$9$k<jK!$O!$3+H/<T$K(Bpush$BA0$N%S%k%I$H%F%9%H$r$5$;$k$3$H$G$"(B
4a9d7e24b915 a bit more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 375
diff changeset
437 $B$k!%Cf1{$G<+F0$K$h$k%S%k%I$H%F%9%H$r9T$&$N$O!$(Bpush\emph{$B8e(B}$B$K!$A4$F$KLdBj(B
4a9d7e24b915 a bit more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 375
diff changeset
438 $B$,$J$$$3$H$r3NG'$9$k$?$a$K9T$&!%$3$N%"%W%m!<%A$NMxE@$O%j%]%8%H%j$,JQ99$r(B
4a9d7e24b915 a bit more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 375
diff changeset
439 $B<u$1F~$l$k%Z!<%9$K2?$b@)8B$r2]$5$J$$$3$H$G$"$k!%(B
41
d1a3394f8bcf More hook content.
Bryan O'Sullivan <bos@serpentine.com>
parents: 40
diff changeset
440
374
32c932f185ed - fixed mq.tex a bit.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
441 %\section{A short tutorial on using hooks}
32c932f185ed - fixed mq.tex a bit.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
442 \section{$B%U%C%/$N;HMQK!(B}
34
c0979ed1eabd Get started on hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
443 \label{sec:hook:simple}
c0979ed1eabd Get started on hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
444
379
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 378
diff changeset
445 %It is easy to write a Mercurial hook. Let's start with a hook that
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 378
diff changeset
446 %runs when you finish a \hgcmd{commit}, and simply prints the hash of
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 378
diff changeset
447 %the changeset you just created. The hook is called \hook{commit}.
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 378
diff changeset
448
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 378
diff changeset
449 Mercurial$B%U%C%/$r=q$/$N$OMF0W$$!%$3$3$G$O(B\hgcmd{commit}$B%3%^%s%I$,=*N;$7(B
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 378
diff changeset
450 $B$?:]$K!$:n@.$5$l$?%A%'%s%8%;%C%H$N%O%C%7%eCM$rI=<($9$k$/%U%C%/$r=q$$$F$_(B
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 378
diff changeset
451 $B$h$&!%$3$N%U%C%/$r(B\hook{commit}$B$H8F$V$3$H$K$9$k!%(B
34
c0979ed1eabd Get started on hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
452
c0979ed1eabd Get started on hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
453 \begin{figure}[ht]
c0979ed1eabd Get started on hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
454 \interaction{hook.simple.init}
379
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 378
diff changeset
455 % \caption{A simple hook that runs when a changeset is committed}
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 378
diff changeset
456 \caption{$B%A%'%s%8%;%C%H$,%3%_%C%H$5$l$?;~$KF0:n$9$kC1=c$J%U%C%/(B}
34
c0979ed1eabd Get started on hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
457 \label{ex:hook:init}
c0979ed1eabd Get started on hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
458 \end{figure}
c0979ed1eabd Get started on hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
459
379
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 378
diff changeset
460 %All hooks follow the pattern in example~\ref{ex:hook:init}. You add
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 378
diff changeset
461 %an entry to the \rcsection{hooks} section of your \hgrc\. On the left
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 378
diff changeset
462 %is the name of the event to trigger on; on the right is the action to
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 378
diff changeset
463 %take. As you can see, you can run an arbitrary shell command in a
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 378
diff changeset
464 %hook. Mercurial passes extra information to the hook using
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 378
diff changeset
465 %environment variables (look for \envar{HG\_NODE} in the example).
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 378
diff changeset
466
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 378
diff changeset
467 $BA4$F$N%U%C%/$ONc(B~\ref{ex:hook:init}$B$HF1$8%Q%?!<%s$K$J$k!%(B \hgrc $B%U%!%$%k$N(B
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 378
diff changeset
468 \rcsection{hooks}$B%;%/%7%g%s$K%(%s%H%j$rDI2C$9$k!%:8JU$K%H%j%,!<$H$J$k%Y%s(B
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 378
diff changeset
469 $B%H$r5-=R$7!$1&JU$KBP1~$9$k%"%/%7%g%s$r5-=R$9$k!%Nc$K<($7$?DL$j!$%U%C%/$K(B
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 378
diff changeset
470 $B$OG$0U$N%7%'%k%3%^%s%I$r=q$/$3$H$,$G$-$k!%4D6-JQ?t$r@_Dj$9$k$3$H$G(B
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 378
diff changeset
471 Mercurial$B$+$i%U%C%/$KDI2C$N>pJs$rEO$9$3$H$,$G$-$k!%!JNc$N(B
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 378
diff changeset
472 \envar{HG\_NODE}$B$r;2>H!%!K(B
34
c0979ed1eabd Get started on hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
473
374
32c932f185ed - fixed mq.tex a bit.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
474 %\subsection{Performing multiple actions per event}
32c932f185ed - fixed mq.tex a bit.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
475 \subsection{1$B$D$N%$%Y%s%H$KJ#?t$N%"%/%7%g%s$r9T$&(B}
34
c0979ed1eabd Get started on hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
476
379
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 378
diff changeset
477 %Quite often, you will want to define more than one hook for a
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 378
diff changeset
478 %particular kind of event, as shown in example~\ref{ex:hook:ext}.
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 378
diff changeset
479 %Mercurial lets you do this by adding an \emph{extension} to the end of
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 378
diff changeset
480 %a hook's name. You extend a hook's name by giving the name of the
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 378
diff changeset
481 %hook, followed by a full stop (the ``\texttt{.}'' character), followed
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 378
diff changeset
482 %by some more text of your choosing. For example, Mercurial will run
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 378
diff changeset
483 %both \texttt{commit.foo} and \texttt{commit.bar} when the
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 378
diff changeset
484 %\texttt{commit} event occurs.
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 378
diff changeset
485
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 378
diff changeset
486 $BNc(B~\ref{ex:hook:ext}$B$K<($7$?$h$&$K!$FCDj$N%$%Y%s%H$K(B2$B$D0J>e$N%U%C%/$rDj5A(B
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 378
diff changeset
487 $B$9$k$3$H$,I,MW$K$J$k$3$H$,B?$$$@$m$&!%(B Mercurial$B$G$O!$%U%C%/L>$N:G8e$K(B
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 378
diff changeset
488 \emph{$B3HD%;R(B}$B$rDI2C$9$k$3$H$G$3$l$,2DG=$K$J$k!%3HD%;R$rIU$1$k$K(B
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 378
diff changeset
489 $B$O!$(B``\texttt{.}'' $BJ8;z$H!$$3$l$KB3$/2?J8;z$+$+$i$J$kL>A0$r%U%C%/$K$D$1$l(B
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 378
diff changeset
490 $B$P$h$$!%Nc$($P(BMercurial$B$O(B\texttt{commit}$B%$%Y%s%H$,5/$-$?;~$K(B
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 378
diff changeset
491 \texttt{commit.foo}$B$H(B\texttt{commit.bar}$B%U%C%/$NN>J}$r8F$S=P$9!%(B
34
c0979ed1eabd Get started on hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
492
c0979ed1eabd Get started on hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
493 \begin{figure}[ht]
c0979ed1eabd Get started on hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
494 \interaction{hook.simple.ext}
379
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 378
diff changeset
495 % \caption{Defining a second \hook{commit} hook}
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 378
diff changeset
496 \caption{2$BHVL\$N(B\hook{commit}$B%U%C%/$rDj5A$9$k(B}
34
c0979ed1eabd Get started on hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
497 \label{ex:hook:ext}
c0979ed1eabd Get started on hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
498 \end{figure}
c0979ed1eabd Get started on hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
499
379
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 378
diff changeset
500 %To give a well-defined order of execution when there are multiple
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 378
diff changeset
501 %hooks defined for an event, Mercurial sorts hooks by extension, and
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 378
diff changeset
502 %executes the hook commands in this sorted order. In the above
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 378
diff changeset
503 %example, it will execute \texttt{commit.bar} before
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 378
diff changeset
504 %\texttt{commit.foo}, and \texttt{commit} before both.
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 378
diff changeset
505
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 378
diff changeset
506 1$B$D$N%$%Y%s%H$KJ#?t$N%U%C%/$,Dj5A$5$l$F$$$k;~!$(BMercurial$B$O%U%C%/$r3HD%;R(B
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 378
diff changeset
507 $B$G%=!<%H$7!$%=!<%H$5$l$?=g=x$K=>$C$F%U%C%/$r<B9T$9$k!%>e5-$NNc$G$O(B
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 378
diff changeset
508 \texttt{commit}$B!$(B\texttt{commit.bar}$B!$(B\texttt{commit.foo}$B$N=g$K<B9T$9$k!%(B
34
c0979ed1eabd Get started on hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
509
379
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 378
diff changeset
510 %It is a good idea to use a somewhat descriptive extension when you
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 378
diff changeset
511 %define a new hook. This will help you to remember what the hook was
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 378
diff changeset
512 %for. If the hook fails, you'll get an error message that contains the
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 378
diff changeset
513 %hook name and extension, so using a descriptive extension could give
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 378
diff changeset
514 %you an immediate hint as to why the hook failed (see
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 378
diff changeset
515 %section~\ref{sec:hook:perm} for an example).
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 378
diff changeset
516
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 378
diff changeset
517 $B?7$7$$%U%C%/$rDj5A$9$k;~$K!$FbMF$r@bL@$9$k$h$&$J3HD%;R$rIU$1$k$N$O$h$$9M(B
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 378
diff changeset
518 $B$($G$"$k!%$3$&$9$k$3$H$K$h$C$F!$%U%C%/$NL\E*$,2?$J$N$+$r3P$($d$9$/$J$k!%(B
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 378
diff changeset
519 $B%U%C%/$,<:GT$7$?>l9g!$%(%i!<%a%C%;!<%8$K$O%U%C%/L>$H3HD%;R$,4^$^$l$k!%@b(B
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 378
diff changeset
520 $BL@E*$J3HD%;R$O%U%C%/$,<:GT$7$?M}M3$rCN$k$h$$<j$,$+$j$H$J$k!%!JNc(B
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 378
diff changeset
521 $B$O(B~\ref{sec:hook:perm}$B$r;2>H$N$3$H!%!K(B
34
c0979ed1eabd Get started on hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
522
374
32c932f185ed - fixed mq.tex a bit.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
523 %\subsection{Controlling whether an activity can proceed}
32c932f185ed - fixed mq.tex a bit.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
524 \subsection{$BF0:n$,?J9T$G$-$k$+$I$&$+@)8f$9$k(B}
34
c0979ed1eabd Get started on hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
525 \label{sec:hook:perm}
c0979ed1eabd Get started on hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
526
379
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 378
diff changeset
527 %In our earlier examples, we used the \hook{commit} hook, which is
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 378
diff changeset
528 %run after a commit has completed. This is one of several Mercurial
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 378
diff changeset
529 %hooks that run after an activity finishes. Such hooks have no way of
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 378
diff changeset
530 %influencing the activity itself.
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 378
diff changeset
531
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 378
diff changeset
532 $BA0$NNc$G$O%3%_%C%H$,40N;$7$?8e$K<B9T$5$l$k(B\hook{commit}$B%U%C%/$rMQ$$$?!%$3(B
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 378
diff changeset
533 $B$l$O(BMercurial$B%U%C%/$N$&$A!$F0:n$,=*N;$7$?8e$K<B9T$5$l$k$b$N$N$&$A$N(B1$B$D$G(B
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 378
diff changeset
534 $B$"$k!%$3$N$h$&$J%U%C%/$O!$(BMercurial$B$NF0:n$=$N$b$N$K1F6A$r5Z$\$5$J$$!%(B
34
c0979ed1eabd Get started on hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
535
379
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 378
diff changeset
536 %Mercurial defines a number of events that occur before an activity
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 378
diff changeset
537 %starts; or after it starts, but before it finishes. Hooks that
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 378
diff changeset
538 %trigger on these events have the added ability to choose whether the
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 378
diff changeset
539 %activity can continue, or will abort.
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 378
diff changeset
540
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 378
diff changeset
541 Mercurial$B$OF0:n$N3+;OA0$d!$3+;O8e=*N;$9$k$^$G$N4V$KH/@8$9$k%$%Y%s%H$rB??t(B
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 378
diff changeset
542 $BDj5A$7$F$$$k!%$3$l$i$N%$%Y%s%H$G%H%j%,!<$5$l$k%U%C%/$O!$F0:n$rB39T$9$k$+(B
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 378
diff changeset
543 $BCfCG$9$k$+7h$a$k$3$H$,$G$-$k!%(B
34
c0979ed1eabd Get started on hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
544
379
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 378
diff changeset
545 %The \hook{pretxncommit} hook runs after a commit has all but
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 378
diff changeset
546 %completed. In other words, the metadata representing the changeset
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 378
diff changeset
547 %has been written out to disk, but the transaction has not yet been
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 378
diff changeset
548 %allowed to complete. The \hook{pretxncommit} hook has the ability to
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 378
diff changeset
549 %decide whether the transaction can complete, or must be rolled back.
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 378
diff changeset
550
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 378
diff changeset
551 \hook{pretxncommit}$B%U%C%/$O%3%_%C%H8e!$%3%_%C%H$N40N;A0$K8F$S=P$5$l$k!%(B
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 378
diff changeset
552 $B8@$$BX$($k$H!$%A%'%s%8%;%C%H$r<($9%a%?%G!<%?$,%G%#%9%/$K=q$-9~$^$l$?8e(B
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 378
diff changeset
553 $B$G!$%H%i%s%6%/%7%g%s$,40N;$9$kA0$K8F$S=P$5$l$k!%(B
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 378
diff changeset
554 \hook{pretxncommit}$B%U%C%/$O%H%i%s%6%/%7%g%s$r40N;$9$k$+!$%m!<%k%P%C%/$9(B
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 378
diff changeset
555 $B$k$+$r7hDj$9$k5!G=$,$"$k!%(B
34
c0979ed1eabd Get started on hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
556
379
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 378
diff changeset
557 %If the \hook{pretxncommit} hook exits with a status code of zero, the
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 378
diff changeset
558 %transaction is allowed to complete; the commit finishes; and the
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 378
diff changeset
559 %\hook{commit} hook is run. If the \hook{pretxncommit} hook exits with
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 378
diff changeset
560 %a non-zero status code, the transaction is rolled back; the metadata
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 378
diff changeset
561 %representing the changeset is erased; and the \hook{commit} hook is
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 378
diff changeset
562 %not run.
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 378
diff changeset
563
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 378
diff changeset
564 \hook{pretxncommit}$B%U%C%/$,%9%F!<%?%9%3!<%I(B0$B$G=*N;$9$k$H%H%i%s%6%/%7%g%s(B
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 378
diff changeset
565 $B$O40N;$9$k$3$H$,$G$-!$%3%_%C%H$,=*N;$7!$(B\hook{commit}$B%U%C%/$,8F$S=P$5$l$k!%(B
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 378
diff changeset
566 \hook{pretxncommit}$B%U%C%/$,Hs(B0$B$N%9%F!<%?%9%3!<%I$G=*N;$9$k$H!$%H%i%s%6%/(B
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 378
diff changeset
567 $B%7%g%s$O%m!<%k%P%C%/$5$l!$%A%'%s%8%;%C%H$r<($9%a%?%G!<%?$O>C5n$5$l$k!%$3(B
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 378
diff changeset
568 $B$N>l9g(B\hook{commit}$B%U%C%/$O8F$S=P$5$l$J$$!%(B
34
c0979ed1eabd Get started on hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
569
c0979ed1eabd Get started on hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
570 \begin{figure}[ht]
c0979ed1eabd Get started on hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
571 \interaction{hook.simple.pretxncommit}
379
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 378
diff changeset
572 % \caption{Using the \hook{pretxncommit} hook to control commits}
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 378
diff changeset
573 \caption{$B%3%_%C%H$r@)8f$9$k$?$a$K(B\hook{pretxncommit}$B%U%C%/$r;HMQ$9$k(B}
34
c0979ed1eabd Get started on hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
574 \label{ex:hook:pretxncommit}
c0979ed1eabd Get started on hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
575 \end{figure}
c0979ed1eabd Get started on hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
576
379
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 378
diff changeset
577 %The hook in example~\ref{ex:hook:pretxncommit} checks that a commit
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 378
diff changeset
578 %comment contains a bug ID. If it does, the commit can complete. If
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 378
diff changeset
579 %not, the commit is rolled back.
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 378
diff changeset
580
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 378
diff changeset
581 ~\ref{ex:hook:pretxncommit}$B$O%3%_%C%H%3%a%s%H$,%P%0(BID$B$r4^$`$+$r%A%'%C%/(B
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 378
diff changeset
582 $B$9$k!%$b$74^$^$l$l$P%3%_%C%H$O40N;$9$k!%4^$^$J$$>l9g$O%3%_%C%H$O%m!<%k%P%C(B
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 378
diff changeset
583 $B%/$5$l$k!%(B
34
c0979ed1eabd Get started on hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
584
374
32c932f185ed - fixed mq.tex a bit.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
585 %\section{Writing your own hooks}
32c932f185ed - fixed mq.tex a bit.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
586 \section{$B%*%j%8%J%k$N%U%C%/$r=q$/(B}
37
9fd0c59b009a Add to hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 34
diff changeset
587
379
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 378
diff changeset
588 %When you are writing a hook, you might find it useful to run Mercurial
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 378
diff changeset
589 %either with the \hggopt{-v} option, or the \rcitem{ui}{verbose} config
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 378
diff changeset
590 %item set to ``true''. When you do so, Mercurial will print a message
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 378
diff changeset
591 %before it calls each hook.
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 378
diff changeset
592
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 378
diff changeset
593 $B%U%C%/$r=q$/>l9g!$(BMercurial$B$r(B\hggopt{-v}$B%*%W%7%g%s$rIU$1$?$j(B
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 378
diff changeset
594 \rcitem{ui}{verbose}$B@_Dj9`L\$r(B``true''$B$K@_Dj$9$k$3$H$OLr$KN)$D!%$3$N>l(B
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 378
diff changeset
595 $B9g!$(BMercurial$B$O3F!9$N%U%C%/$r8F$VA0$K%a%C%;!<%8$rI=<($9$k!%(B
37
9fd0c59b009a Add to hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 34
diff changeset
596
374
32c932f185ed - fixed mq.tex a bit.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
597 %\subsection{Choosing how your hook should run}
32c932f185ed - fixed mq.tex a bit.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
598 \subsection{$B%U%C%/$,$NF0:nJ}K!$rA*$V(B}
37
9fd0c59b009a Add to hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 34
diff changeset
599 \label{sec:hook:lang}
34
c0979ed1eabd Get started on hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
600
379
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 378
diff changeset
601 %You can write a hook either as a normal program---typically a shell
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 378
diff changeset
602 %script---or as a Python function that is executed within the Mercurial
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 378
diff changeset
603 %process.
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 378
diff changeset
604
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 378
diff changeset
605 $B%U%C%/$O%7%'%k%9%/%j%W%H$N$h$&$JDL>o$N%W%m%0%i%`$H$7$F=q$/$3$H$b$G$-$k$7!$(B
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 378
diff changeset
606 Mercurial$B%W%m%;%9$NFbIt$G8F$S=P$5$l$k(BPython$B4X?t$H$7$F=q$/$3$H$b$G$-$k!%(B
34
c0979ed1eabd Get started on hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
607
379
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 378
diff changeset
608 %Writing a hook as an external program has the advantage that it
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 378
diff changeset
609 %requires no knowledge of Mercurial's internals. You can call normal
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 378
diff changeset
610 %Mercurial commands to get any added information you need. The
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 378
diff changeset
611 %trade-off is that external hooks are slower than in-process hooks.
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 378
diff changeset
612
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 378
diff changeset
613 $B%U%C%/$r30It%W%m%0%i%`$H$7$F=q$/MxE@$O(BMercurial$B$NFbItF0:n$rCN$i$J$/$F$b%U%C(B
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 378
diff changeset
614 $B%/$,=q$1$k$3$H$G$"$k!%I,MW$JDI2C$N>pJs$rF@$k$?$a$KDL>o$N(BMercurial$B%3%^%s%I(B
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 378
diff changeset
615 $B$r8F$S=P$9$3$H$,$G$-$k!%30It%U%C%/$O%W%m%;%9Fb%U%C%/$h$j$bDcB.$J$N$,%H%l!<(B
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 378
diff changeset
616 $B%I%*%U$G$"$k!%(B
34
c0979ed1eabd Get started on hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
617
379
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 378
diff changeset
618 %An in-process Python hook has complete access to the Mercurial API,
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 378
diff changeset
619 %and does not ``shell out'' to another process, so it is inherently
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 378
diff changeset
620 %faster than an external hook. It is also easier to obtain much of the
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 378
diff changeset
621 %information that a hook requires by using the Mercurial API than by
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 378
diff changeset
622 %running Mercurial commands.
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 378
diff changeset
623
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 378
diff changeset
624 Python$B%W%m%;%9Fb%U%C%/$O(BMercurial API$B$X$N40A4$J%"%/%;%9$,2DG=$G$"$k!%(B
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 378
diff changeset
625 $BB>$N%W%m%;%9$r@8@.$9$k$3$H$,$J$$$?$a!$K\<AE*$K30It%U%C%/$h$j$b9bB.$G$"$k!%(B
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 378
diff changeset
626 $B%U%C%/$,I,MW$H$9$k>pJs$NBgH>$O!$(BMercurial$B%3%^%s%I$r<B9T$9$k$h$j$b(B
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 378
diff changeset
627 Mercurial API$B$r;H$C$F=8$a$kJ}$,MF0W$$!%(B
34
c0979ed1eabd Get started on hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
628
379
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 378
diff changeset
629 %If you are comfortable with Python, or require high performance,
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 378
diff changeset
630 %writing your hooks in Python may be a good choice. However, when you
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 378
diff changeset
631 %have a straightforward hook to write and you don't need to care about
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 378
diff changeset
632 %performance (probably the majority of hooks), a shell script is
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 378
diff changeset
633 %perfectly fine.
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 378
diff changeset
634
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 378
diff changeset
635 Python$B$r;H$$47$l$F$$$?$j!$9b$$@-G=$,I,MW$J$i$P!$%U%C%/$r(BPython$B$G=q$/$N$,(B
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 378
diff changeset
636 $B$h$$$@$m$&!%$7$+$7=q$3$&$H$9$k$N$,C1=cL@2r$J%U%C%/$G!$!JB?$/$N%U%C%/$,$=(B
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 378
diff changeset
637 $B$&$G$"$k$h$&$K!K@-G=$K$OFC$K4X?4$,$J$$>l9g!$%7%'%k%9%/%j%W%H$H$7$F=q$$$F(B
beab196f78da - more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 378
diff changeset
638 $B$bA4$/LdBj$J$$!%(B
34
c0979ed1eabd Get started on hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
639
374
32c932f185ed - fixed mq.tex a bit.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
640 %\subsection{Hook parameters}
32c932f185ed - fixed mq.tex a bit.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
641 \subsection{$B%U%C%/%Q%i%a!<%?(B}
34
c0979ed1eabd Get started on hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
642 \label{sec:hook:param}
c0979ed1eabd Get started on hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
643
381
991befd0025c more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 379
diff changeset
644 %Mercurial calls each hook with a set of well-defined parameters. In
991befd0025c more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 379
diff changeset
645 %Python, a parameter is passed as a keyword argument to your hook
991befd0025c more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 379
diff changeset
646 %function. For an external program, a parameter is passed as an
991befd0025c more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 379
diff changeset
647 %environment variable.
991befd0025c more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 379
diff changeset
648
991befd0025c more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 379
diff changeset
649 Mercurial$B$O3F!9$N%U%C%/$N8F=P$7$N:]$K$-$A$s$HDj5A$5$l$?%Q%i%a!<%?$rEO(B
991befd0025c more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 379
diff changeset
650 $B$9!%(BPython$B$G$O%Q%i%a!<%?$O%-!<%o!<%I0z?t$H$7$F%U%C%/4X?t$KEO$5$l$k!%30It(B
991befd0025c more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 379
diff changeset
651 $B%W%m%0%i%`$K$O!$%Q%i%a!<%?$O4D6-JQ?t$H$7$FEO$5$l$k!%(B
34
c0979ed1eabd Get started on hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
652
381
991befd0025c more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 379
diff changeset
653 %Whether your hook is written in Python or as a shell script, the
991befd0025c more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 379
diff changeset
654 %hook-specific parameter names and values will be the same. A boolean
991befd0025c more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 379
diff changeset
655 %parameter will be represented as a boolean value in Python, but as the
991befd0025c more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 379
diff changeset
656 %number 1 (for ``true'') or 0 (for ``false'') as an environment
991befd0025c more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 379
diff changeset
657 %variable for an external hook. If a hook parameter is named
991befd0025c more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 379
diff changeset
658 %\texttt{foo}, the keyword argument for a Python hook will also be
991befd0025c more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 379
diff changeset
659 %named \texttt{foo}, while the environment variable for an external
991befd0025c more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 379
diff changeset
660 %hook will be named \texttt{HG\_FOO}.
991befd0025c more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 379
diff changeset
661
991befd0025c more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 379
diff changeset
662 $B%U%C%/$,(BPython$B$G=q$+$l$F$$$k$+!$%7%'%k%9%/%j%W%H$7$F=q$+$l$F$$$k$+$K4X$o(B
991befd0025c more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 379
diff changeset
663 $B$i$:!$%U%C%/8GM-$N%Q%i%a!<%?L>$HCM$OF1$8$b$N$,MQ$$$i$l$k!%%V!<%k7?%Q%i%a!<(B
991befd0025c more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 379
diff changeset
664 $B%?$O(BPython$B$G$O%V!<%kCM$H$7$F07$o$l$k$,!$30It%U%C%/$N$?$a$N4D6-JQ?t$G(B
991befd0025c more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 379
diff changeset
665 $B$O!$(B1$B!J(B``$B??(B''$B!K$^$?$O(B0$B!J(B``$B56(B''$B!K$H$$$&?tCM$H$7$F07$o$l$k!%(B
991befd0025c more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 379
diff changeset
666 $B%U%C%/%Q%i%a!<%?$K(B\texttt{foo}$B$H$$$&L>A0$,IU$1$i$l$F$$$k$H$-!$(BPython$B%U%C(B
991befd0025c more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 379
diff changeset
667 $B%/$X$N%-!<%o!<%I0z?t$bF1$8(B\texttt{foo}$B$H$$$&L>A0$K$J$k!%(B
991befd0025c more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 379
diff changeset
668 $B0lJ}!$30It%U%C%/$N$?$a$N4D6-JQ?t$G$O(B\texttt{HG\_FOO}$B$H$$$&L>A0$K$J$k!%(B
37
9fd0c59b009a Add to hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 34
diff changeset
669
374
32c932f185ed - fixed mq.tex a bit.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
670 %\subsection{Hook return values and activity control}
32c932f185ed - fixed mq.tex a bit.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
671 \subsection{$B%U%C%/$NLa$jCM$HF0:n$N@)8f(B}
37
9fd0c59b009a Add to hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 34
diff changeset
672
381
991befd0025c more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 379
diff changeset
673 %A hook that executes successfully must exit with a status of zero if
991befd0025c more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 379
diff changeset
674 %external, or return boolean ``false'' if in-process. Failure is
991befd0025c more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 379
diff changeset
675 %indicated with a non-zero exit status from an external hook, or an
991befd0025c more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 379
diff changeset
676 %in-process hook returning boolean ``true''. If an in-process hook
991befd0025c more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 379
diff changeset
677 %raises an exception, the hook is considered to have failed.
37
9fd0c59b009a Add to hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 34
diff changeset
678
779
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
679 $B@5$7$/F0:n$7$?30It%U%C%/$O%9%F!<%?%9$H$7$F%<%m$r!$%W%m%;%9Fb%U%C%/$N>l9g(B
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
680 $B$O%V!<%kCM(B``false''$B$rJV$5$J$1$l$P$J$i$J$$!%$J$s$i$+$N<:GT$,$"$C$?>l9g$O!$(B
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
681 $B30It%U%C%/$OHs%<%m$N=*N;%9%F!<%?%9$r!$%W%m%;%9Fb%U%C%/$O%V!<%kCM(B``true''
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
682 $B$rJV$9!%$b$7%W%m%;%9Fb%U%C%/$,Nc30$rH/@8$7$?>l9g$O!$%U%C%/$O<:GT$7$?$H8+(B
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
683 $B$J$5$l$k!%(B
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
684
381
991befd0025c more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 379
diff changeset
685 %For a hook that controls whether an activity can proceed, zero/false
991befd0025c more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 379
diff changeset
686 %means ``allow'', while non-zero/true/exception means ``deny''.
37
9fd0c59b009a Add to hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 34
diff changeset
687
779
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
688 $BF0:n$N7QB3$r@)8f$9$k%U%C%/$N>l9g$O!$%<%m!?(Bfalse$B$O7QB3$N5v2D$r!$Hs%<(B
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
689 $B%m!?(Btrue$B!?Nc30$N>l9g$O6X;_$r0UL#$9$k!%(B
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
690
374
32c932f185ed - fixed mq.tex a bit.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
691 %\subsection{Writing an external hook}
32c932f185ed - fixed mq.tex a bit.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
692 \subsection{$B30It%U%C%/$r:n@.$9$k(B}
37
9fd0c59b009a Add to hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 34
diff changeset
693
381
991befd0025c more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 379
diff changeset
694 %When you define an external hook in your \hgrc\ and the hook is run,
991befd0025c more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 379
diff changeset
695 %its value is passed to your shell, which interprets it. This means
991befd0025c more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 379
diff changeset
696 %that you can use normal shell constructs in the body of the hook.
991befd0025c more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 379
diff changeset
697
991befd0025c more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 379
diff changeset
698 $B30It%U%C%/$r(B \hgrc\ $B$GDj5A$7!$<B9T$9$k>l9g!$%U%C%/$O%7%'%k$KEO$5$l$kCM$r(B
991befd0025c more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 379
diff changeset
699 $BJQ49$9$?$a!$%U%C%/$NK\BNItJ,$G%7%'%k%9%/%j%W%H$r5-=R$9$k$3$H$,$G$-$k!%(B
37
9fd0c59b009a Add to hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 34
diff changeset
700
381
991befd0025c more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 379
diff changeset
701 %An executable hook is always run with its current directory set to a
991befd0025c more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 379
diff changeset
702 %repository's root directory.
991befd0025c more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 379
diff changeset
703
991befd0025c more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 379
diff changeset
704 $B30It%U%C%/$O>o$K%j%]%8%H%j$N%k!<%H%G%#%l%/%H%j$r%+%l%s%H%G%#%l%/%H%j$H$7(B
991befd0025c more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 379
diff changeset
705 $B$F<B9T$5$l$k!%(B
991befd0025c more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 379
diff changeset
706
991befd0025c more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 379
diff changeset
707 %Each hook parameter is passed in as an environment variable; the name
991befd0025c more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 379
diff changeset
708 %is upper-cased, and prefixed with the string ``\texttt{HG\_}''.
37
9fd0c59b009a Add to hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 34
diff changeset
709
381
991befd0025c more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 379
diff changeset
710 $B3F!9$N%U%C%/%Q%i%a!<%?$O4D6-JQ?t$H$7$FEO$5$l$k!%$9$J$o$A!$L>A0$OA4$FBgJ8(B
991befd0025c more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 379
diff changeset
711 $B;z$K$J$j!$(B``\texttt{HG\_}''$B$H$$$&@\F,<-$,IU$1$i$l$k!%(B
37
9fd0c59b009a Add to hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 34
diff changeset
712
381
991befd0025c more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 379
diff changeset
713 %With the exception of hook parameters, Mercurial does not set or
991befd0025c more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 379
diff changeset
714 %modify any environment variables when running a hook. This is useful
991befd0025c more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 379
diff changeset
715 %to remember if you are writing a site-wide hook that may be run by a
991befd0025c more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 379
diff changeset
716 %number of different users with differing environment variables set.
991befd0025c more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 379
diff changeset
717 %In multi-user situations, you should not rely on environment variables
991befd0025c more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 379
diff changeset
718 %being set to the values you have in your environment when testing the
991befd0025c more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 379
diff changeset
719 %hook.
991befd0025c more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 379
diff changeset
720
991befd0025c more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 379
diff changeset
721 $B%U%C%/%Q%i%a!<%?$rNc30$H$7$F!$(BMercurial$B$O%U%C%/$r<B9T$9$k:]$K4D6-JQ?t$NDj(B
991befd0025c more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 379
diff changeset
722 $B5A$dJQ99$r9T$o$J$$!%B?$/$N%f!<%6$,<B9T$9$k%5%$%H%o%$%I$N%U%C%/$r:n@.$9$k(B
991befd0025c more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 379
diff changeset
723 $B>l9g!$%f!<%6$,@_Dj$7$F$$$k4D6-JQ?t$O0[$J$k$3$H$r5-21$7$F$*$/$Y$-$G$"$k!%(B
991befd0025c more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 379
diff changeset
724 $B%^%k%A%f!<%64D6-$N>l9g!$%U%C%/$r;n$9:]$K$"$J$?$,@_Dj$7$F$$$k4D6-JQ?t$K0M(B
991befd0025c more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 379
diff changeset
725 $BB8$9$Y$-$G$O$J$$!%(B
37
9fd0c59b009a Add to hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 34
diff changeset
726
374
32c932f185ed - fixed mq.tex a bit.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
727 %\subsection{Telling Mercurial to use an in-process hook}
32c932f185ed - fixed mq.tex a bit.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
728 \subsection{Mercurial$B$K%W%m%;%9Fb%U%C%/$r;H$&$h$&$K;X<($9$k(B}
37
9fd0c59b009a Add to hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 34
diff changeset
729
382
d64d38d2a91a more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 381
diff changeset
730 %The \hgrc\ syntax for defining an in-process hook is slightly
d64d38d2a91a more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 381
diff changeset
731 %different than for an executable hook. The value of the hook must
d64d38d2a91a more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 381
diff changeset
732 %start with the text ``\texttt{python:}'', and continue with the
d64d38d2a91a more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 381
diff changeset
733 %fully-qualified name of a callable object to use as the hook's value.
d64d38d2a91a more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 381
diff changeset
734
d64d38d2a91a more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 381
diff changeset
735 $B%W%m%;%9$J$$%U%C%/$rDj5A$9$k(B \hgrc\ $B9=J8$O<B9T2DG=%U%C%/$H$O6O$+$K0[$J$C(B
d64d38d2a91a more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 381
diff changeset
736 $B$F$$$k!%%U%C%/$NCM$OI,$:(B``\texttt{python:}''$B$G;O$^$j!$8e$K%U%C%/CM$H$7$F(B
d64d38d2a91a more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 381
diff changeset
737 $BMQ$$$i$l$k8F=P$72DG=%*%V%8%'%/%H$N40A4$JL>A0$,B3$+$J$1$l$P$J$i$J$$!%(B
d64d38d2a91a more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 381
diff changeset
738
d64d38d2a91a more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 381
diff changeset
739 %The module in which a hook lives is automatically imported when a hook
d64d38d2a91a more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 381
diff changeset
740 %is run. So long as you have the module name and \envar{PYTHONPATH}
d64d38d2a91a more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 381
diff changeset
741 %right, it should ``just work''.
37
9fd0c59b009a Add to hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 34
diff changeset
742
382
d64d38d2a91a more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 381
diff changeset
743 $B%U%C%/$,4^$^$l$k%b%8%e!<%k$O%U%C%/$,<B9T$5$l$k;~$K<+F0E*$KFI$_9~$^$l$k!%(B
d64d38d2a91a more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 381
diff changeset
744 $B%b%8%e!<%kL>$*$h$S(B\envar{PYTHONPATH}$B$,@5$7$$$+$.$jI,$:F0:n$9$k$O$:$G$"$k!%(B
37
9fd0c59b009a Add to hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 34
diff changeset
745
382
d64d38d2a91a more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 381
diff changeset
746 %The following \hgrc\ example snippet illustrates the syntax and
d64d38d2a91a more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 381
diff changeset
747 %meaning of the notions we just described.
d64d38d2a91a more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 381
diff changeset
748 %\begin{codesample2}
d64d38d2a91a more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 381
diff changeset
749 % [hooks]
d64d38d2a91a more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 381
diff changeset
750 % commit.example = python:mymodule.submodule.myhook
d64d38d2a91a more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 381
diff changeset
751 %\end{codesample2}
d64d38d2a91a more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 381
diff changeset
752 %When Mercurial runs the \texttt{commit.example} hook, it imports
d64d38d2a91a more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 381
diff changeset
753 %\texttt{mymodule.submodule}, looks for the callable object named
d64d38d2a91a more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 381
diff changeset
754 %\texttt{myhook}, and calls it.
d64d38d2a91a more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 381
diff changeset
755
d64d38d2a91a more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 381
diff changeset
756 $B:#@bL@$7$?9=J8$H35G0$r@bL@$9$kCGJRE*$JNc$r0J2<$N(B\hgrc\ $B$K<($9!%(B
37
9fd0c59b009a Add to hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 34
diff changeset
757 \begin{codesample2}
9fd0c59b009a Add to hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 34
diff changeset
758 [hooks]
9fd0c59b009a Add to hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 34
diff changeset
759 commit.example = python:mymodule.submodule.myhook
9fd0c59b009a Add to hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 34
diff changeset
760 \end{codesample2}
382
d64d38d2a91a more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 381
diff changeset
761 Mercurial$B$,(B\texttt{commit.example}$B%U%C%/$r<B9T$9$k;~!$(B
d64d38d2a91a more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 381
diff changeset
762 \texttt{mymodule.submodule}$B$rFI$_9~$_!$8F=P$72DG=%*%V%8%'%/%H(B
d64d38d2a91a more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 381
diff changeset
763 \texttt{myhook}$B$rC5$7!$<B9T$9$k!%(B
37
9fd0c59b009a Add to hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 34
diff changeset
764
374
32c932f185ed - fixed mq.tex a bit.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
765 %\subsection{Writing an in-process hook}
32c932f185ed - fixed mq.tex a bit.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
766 \subsection{$B%W%m%;%9Fb%U%C%/$r:n@.$9$k(B}
37
9fd0c59b009a Add to hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 34
diff changeset
767
382
d64d38d2a91a more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 381
diff changeset
768 %The simplest in-process hook does nothing, but illustrates the basic
d64d38d2a91a more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 381
diff changeset
769 %shape of the hook API:
d64d38d2a91a more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 381
diff changeset
770 %\begin{codesample2}
d64d38d2a91a more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 381
diff changeset
771 % def myhook(ui, repo, **kwargs):
d64d38d2a91a more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 381
diff changeset
772 % pass
d64d38d2a91a more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 381
diff changeset
773 %\end{codesample2}
d64d38d2a91a more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 381
diff changeset
774 %The first argument to a Python hook is always a
d64d38d2a91a more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 381
diff changeset
775 %\pymodclass{mercurial.ui}{ui} object. The second is a repository object;
d64d38d2a91a more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 381
diff changeset
776 %at the moment, it is always an instance of
d64d38d2a91a more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 381
diff changeset
777 %\pymodclass{mercurial.localrepo}{localrepository}. Following these two
d64d38d2a91a more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 381
diff changeset
778 %arguments are other keyword arguments. Which ones are passed in
d64d38d2a91a more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 381
diff changeset
779 %depends on the hook being called, but a hook can ignore arguments it
d64d38d2a91a more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 381
diff changeset
780 %doesn't care about by dropping them into a keyword argument dict, as
d64d38d2a91a more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 381
diff changeset
781 %with \texttt{**kwargs} above.
d64d38d2a91a more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 381
diff changeset
782
d64d38d2a91a more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 381
diff changeset
783 $B<B:]$K$O2?$b9T$o$J$$:G$bC1=c$J%W%m%;%9Fb%U%C%/$r%U%C%/(BAPI$B$N4pK\E*$J;H$$J}(B
d64d38d2a91a more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 381
diff changeset
784 $B$r@bL@$9$k$?$a$K<($9!%(B
37
9fd0c59b009a Add to hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 34
diff changeset
785 \begin{codesample2}
9fd0c59b009a Add to hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 34
diff changeset
786 def myhook(ui, repo, **kwargs):
9fd0c59b009a Add to hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 34
diff changeset
787 pass
9fd0c59b009a Add to hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 34
diff changeset
788 \end{codesample2}
382
d64d38d2a91a more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 381
diff changeset
789 Python$B%U%C%/$X$N:G=i$N0z?t$O>o$K(B\pymodclass{mercurial.ui}{ui}$B%*%V%8%'%/%H(B
d64d38d2a91a more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 381
diff changeset
790 $B$G$"$k!%(B2$BHVL\$N0z?t$O%j%]%8%H%j%*%V%8%'%/%H$G!$8=:_$N$H$3$m>o$K(B
d64d38d2a91a more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 381
diff changeset
791 \pymodclass{mercurial.localrepo}{localrepository}$B$N%$%s%9%?%s%9$G$"$k!%B>(B
d64d38d2a91a more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 381
diff changeset
792 $B$N%-!<%o!<%I0z?t$O$3$l$i$N(B2$B$D$N0z?t$KB3$/!%$3$l$i$O8F$S=P$5$l$F$$$k%U%C%/(B
d64d38d2a91a more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 381
diff changeset
793 $B$K0MB8$9$k$,!$%U%C%/$O%-!<%o!<%I$N<-=q$K(B\texttt{**kwargs}$B$H5-=R$9$k$3$H(B
d64d38d2a91a more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 381
diff changeset
794 $B$G!$I,MW$N$J$$0z?t$rL5;k$9$k$3$H$b$G$-$k!%(B
34
c0979ed1eabd Get started on hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
795
374
32c932f185ed - fixed mq.tex a bit.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
796 %\section{Some hook examples}
32c932f185ed - fixed mq.tex a bit.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
797 \section{$B%U%C%/$NNc(B}
44
012df94a02fe Start hook examples. First is for trailing whitespace.
Bryan O'Sullivan <bos@serpentine.com>
parents: 41
diff changeset
798
374
32c932f185ed - fixed mq.tex a bit.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
799 %\subsection{Writing meaningful commit messages}
32c932f185ed - fixed mq.tex a bit.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
800 \subsection{$B0UL#$N$"$k%3%_%C%H%a%C%;!<%8$r=PNO$9$k(B}
49
18210d46491f More hook content.
Bryan O'Sullivan <bos@serpentine.com>
parents: 44
diff changeset
801
382
d64d38d2a91a more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 381
diff changeset
802 %It's hard to imagine a useful commit message being very short. The
d64d38d2a91a more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 381
diff changeset
803 %simple \hook{pretxncommit} hook of figure~\ref{ex:hook:msglen.go}
d64d38d2a91a more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 381
diff changeset
804 %will prevent you from committing a changeset with a message that is
d64d38d2a91a more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 381
diff changeset
805 %less than ten bytes long.
d64d38d2a91a more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 381
diff changeset
806
d64d38d2a91a more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 381
diff changeset
807 $BHs>o$KC;$$%3%_%C%H%a%C%;!<%8$,M-MQ$G$"$k$3$H$O$^$:$J$$!%(B
d64d38d2a91a more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 381
diff changeset
808 $B?^(B~\ref{ex:hook:msglen.go}$B$K<($9(B\hook{pretxncommit}$B$H$$$&C1=c$J%U%C%/$O(B10
d64d38d2a91a more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 381
diff changeset
809 $B%P%$%H0J2<$ND9$5$N%3%_%C%H%a%C%;!<%8$G%3%_%C%H$r9T$&$3$H$r6X;_$9$k!%(B
49
18210d46491f More hook content.
Bryan O'Sullivan <bos@serpentine.com>
parents: 44
diff changeset
810
18210d46491f More hook content.
Bryan O'Sullivan <bos@serpentine.com>
parents: 44
diff changeset
811 \begin{figure}[ht]
155
914babdc99c8 run-example: better error if bogus section name found.
Bryan O'Sullivan <bos@serpentine.com>
parents: 135
diff changeset
812 \interaction{hook.msglen.go}
382
d64d38d2a91a more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 381
diff changeset
813 % \caption{A hook that forbids overly short commit messages}
d64d38d2a91a more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 381
diff changeset
814 \caption{$B6KC<$KC;$$%3%_%C%H%a%C%;!<%8$r6X;_$9$k%U%C%/(B}
155
914babdc99c8 run-example: better error if bogus section name found.
Bryan O'Sullivan <bos@serpentine.com>
parents: 135
diff changeset
815 \label{ex:hook:msglen.go}
49
18210d46491f More hook content.
Bryan O'Sullivan <bos@serpentine.com>
parents: 44
diff changeset
816 \end{figure}
18210d46491f More hook content.
Bryan O'Sullivan <bos@serpentine.com>
parents: 44
diff changeset
817
374
32c932f185ed - fixed mq.tex a bit.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
818 %\subsection{Checking for trailing whitespace}
32c932f185ed - fixed mq.tex a bit.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
819 \subsection{$B$V$i2<$,$C$?6uGr$r%A%'%C%/$9$k(B}
44
012df94a02fe Start hook examples. First is for trailing whitespace.
Bryan O'Sullivan <bos@serpentine.com>
parents: 41
diff changeset
820
382
d64d38d2a91a more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 381
diff changeset
821 %An interesting use of a commit-related hook is to help you to write
d64d38d2a91a more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 381
diff changeset
822 %cleaner code. A simple example of ``cleaner code'' is the dictum that
d64d38d2a91a more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 381
diff changeset
823 %a change should not add any new lines of text that contain ``trailing
d64d38d2a91a more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 381
diff changeset
824 %whitespace''. Trailing whitespace is a series of space and tab
d64d38d2a91a more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 381
diff changeset
825 %characters at the end of a line of text. In most cases, trailing
d64d38d2a91a more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 381
diff changeset
826 %whitespace is unnecessary, invisible noise, but it is occasionally
d64d38d2a91a more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 381
diff changeset
827 %problematic, and people often prefer to get rid of it.
d64d38d2a91a more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 381
diff changeset
828
d64d38d2a91a more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 381
diff changeset
829 $B%3%_%C%H$K4XO"$7$?%U%C%/$N6=L#?<$$;HMQK!$N0l$D$K$h$j4qNo$J%3!<%I$r=q$/<j(B
d64d38d2a91a more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 381
diff changeset
830 $B=u$1$,$"$k!%(B ``$B4qNo$J%3!<%I(B''$B$N$4$/C1=c$JNc$O!$Nc$($P!$?7$?$J$V$i2<$,$C$?(B
d64d38d2a91a more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 381
diff changeset
831 $B6uGr$r4^$`9T$r4^$^$J$$$b$N$G$"$k!%$V$i2<$,$C$?6uGr$H$O!$9TKv$N0lO"$N%9%Z!<(B
d64d38d2a91a more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 381
diff changeset
832 $B%9$d%?%V$G$"$k!%$[$H$s$I$N>l9g!$$V$i2<$,$C$?6uGr$OITI,MW$J8+$($J$$%N%$%:(B
d64d38d2a91a more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 381
diff changeset
833 $B$G$"$k$,!$LdBj$r0z$-5/$3$9>l9g$b$"$j!$=|5n$7$?$,$k?M$,B?$$!%(B
d64d38d2a91a more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 381
diff changeset
834
d64d38d2a91a more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 381
diff changeset
835 %You can use either the \hook{precommit} or \hook{pretxncommit} hook to
d64d38d2a91a more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 381
diff changeset
836 %tell whether you have a trailing whitespace problem. If you use the
d64d38d2a91a more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 381
diff changeset
837 %\hook{precommit} hook, the hook will not know which files you are
d64d38d2a91a more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 381
diff changeset
838 %committing, so it will have to check every modified file in the
d64d38d2a91a more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 381
diff changeset
839 %repository for trailing white space. If you want to commit a change
d64d38d2a91a more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 381
diff changeset
840 %to just the file \filename{foo}, but the file \filename{bar} contains
d64d38d2a91a more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 381
diff changeset
841 %trailing whitespace, doing a check in the \hook{precommit} hook will
d64d38d2a91a more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 381
diff changeset
842 %prevent you from committing \filename{foo} due to the problem with
d64d38d2a91a more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 381
diff changeset
843 %\filename{bar}. This doesn't seem right.
44
012df94a02fe Start hook examples. First is for trailing whitespace.
Bryan O'Sullivan <bos@serpentine.com>
parents: 41
diff changeset
844
382
d64d38d2a91a more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 381
diff changeset
845 $B$V$i2<$,$j6uGr$NLdBj$rD>$9$?$a$K(B\hook{precommit}$B%U%C%/$d(B
d64d38d2a91a more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 381
diff changeset
846 \hook{pretxncommit}$B%U%C%/$rMQ$$$k$3$H$,$G$-$k!%(B\hook{precommit}$B%U%C%/$r;H(B
d64d38d2a91a more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 381
diff changeset
847 $B$&>l9g!$$I$N%U%!%$%k$r%3%_%C%H$9$k$N$+%U%C%/$OCN$k$3$H$,$J$$!%$=$N$?$a!$(B
d64d38d2a91a more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 381
diff changeset
848 $B%j%]%8%H%j$GJQ99$5$l$?%U%!%$%k$9$Y$F$K$D$$$F$V$i2<$,$j6uGr$r%A%'%C%/$9$k(B
d64d38d2a91a more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 381
diff changeset
849 $BI,MW$,$"$k!%(B \filename{foo}$B$H$$$&%U%!%$%k$r%3%_%C%H$7$?$$(B
d64d38d2a91a more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 381
diff changeset
850 $B$,!$(B\filename{bar}$B%U%!%$%k$,$V$i2<$,$j6uGr$r4^$s$G$$$k>l(B
d64d38d2a91a more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 381
diff changeset
851 $B9g!$(B\hook{precommit}$B%U%C%/$G%A%'%C%/$r9T$&$H!$%U%!%$%k(B\filename{bar}$B$NLd(B
d64d38d2a91a more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 381
diff changeset
852 $BBj$N$?$a$K(B\filename{foo}$B$N%3%_%C%H$,$G$-$J$/$J$k!%$3$l$O@5$7$$5sF0$H$O8@(B
d64d38d2a91a more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 381
diff changeset
853 $B$($J$$!%(B
44
012df94a02fe Start hook examples. First is for trailing whitespace.
Bryan O'Sullivan <bos@serpentine.com>
parents: 41
diff changeset
854
382
d64d38d2a91a more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 381
diff changeset
855 %Should you choose the \hook{pretxncommit} hook, the check won't occur
d64d38d2a91a more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 381
diff changeset
856 %until just before the transaction for the commit completes. This will
d64d38d2a91a more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 381
diff changeset
857 %allow you to check for problems only the exact files that are being
d64d38d2a91a more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 381
diff changeset
858 %committed. However, if you entered the commit message interactively
d64d38d2a91a more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 381
diff changeset
859 %and the hook fails, the transaction will roll back; you'll have to
d64d38d2a91a more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 381
diff changeset
860 %re-enter the commit message after you fix the trailing whitespace and
d64d38d2a91a more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 381
diff changeset
861 %run \hgcmd{commit} again.
d64d38d2a91a more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 381
diff changeset
862
d64d38d2a91a more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 381
diff changeset
863 \hook{pretxncommit}$B%U%C%/$rA*$S!$%A%'%C%/$,%3%_%C%H40N;%H%i%s%6%/%7%g%s$N(B
d64d38d2a91a more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 381
diff changeset
864 $BD>A0$^$G5/$-$J$$$h$&$K$9$Y$-$G$"$k!%$3$l$K$h$j!$%3%_%C%H$5$l$h$&$H$9$k%U%!(B
d64d38d2a91a more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 381
diff changeset
865 $B%$%k$@$1$r%A%'%C%/$9$k$3$H$,$G$-$k$h$&$K$J$k!%$7$+$7$J$,$i!$%3%_%C%H%a%C(B
d64d38d2a91a more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 381
diff changeset
866 $B%;!<%8$rBPOCE*$KF~NO$7!$%3%_%C%H$,<:GT$9$k$H%H%i%s%6%/%7%g%s$O%m!<%k%P%C(B
d64d38d2a91a more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 381
diff changeset
867 $B%/$9$k$?$a!$$V$i2<$,$j6uGr$r=$@5$7!$(B\hgcmd{commit}$B$r:F$S<B9T$7!$%3%_%C%H(B
d64d38d2a91a more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 381
diff changeset
868 $B$9$k:]$K%3%_%C%H%a%C%;!<%8$r:FF~NO$7$J$1$l$P$J$i$J$$!%(B
44
012df94a02fe Start hook examples. First is for trailing whitespace.
Bryan O'Sullivan <bos@serpentine.com>
parents: 41
diff changeset
869
012df94a02fe Start hook examples. First is for trailing whitespace.
Bryan O'Sullivan <bos@serpentine.com>
parents: 41
diff changeset
870 \begin{figure}[ht]
012df94a02fe Start hook examples. First is for trailing whitespace.
Bryan O'Sullivan <bos@serpentine.com>
parents: 41
diff changeset
871 \interaction{hook.ws.simple}
382
d64d38d2a91a more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 381
diff changeset
872 % \caption{A simple hook that checks for trailing whitespace}
d64d38d2a91a more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 381
diff changeset
873 \caption{$B$V$i2<$,$C$?6uGr$r%A%'%C%/$9$kC1=c$J%U%C%/(B}
44
012df94a02fe Start hook examples. First is for trailing whitespace.
Bryan O'Sullivan <bos@serpentine.com>
parents: 41
diff changeset
874 \label{ex:hook:ws.simple}
012df94a02fe Start hook examples. First is for trailing whitespace.
Bryan O'Sullivan <bos@serpentine.com>
parents: 41
diff changeset
875 \end{figure}
012df94a02fe Start hook examples. First is for trailing whitespace.
Bryan O'Sullivan <bos@serpentine.com>
parents: 41
diff changeset
876
382
d64d38d2a91a more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 381
diff changeset
877 %Figure~\ref{ex:hook:ws.simple} introduces a simple \hook{pretxncommit}
d64d38d2a91a more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 381
diff changeset
878 %hook that checks for trailing whitespace. This hook is short, but not
d64d38d2a91a more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 381
diff changeset
879 %very helpful. It exits with an error status if a change adds a line
d64d38d2a91a more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 381
diff changeset
880 %with trailing whitespace to any file, but does not print any
d64d38d2a91a more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 381
diff changeset
881 %information that might help us to identify the offending file or
d64d38d2a91a more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 381
diff changeset
882 %line. It also has the nice property of not paying attention to
d64d38d2a91a more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 381
diff changeset
883 %unmodified lines; only lines that introduce new trailing whitespace
d64d38d2a91a more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 381
diff changeset
884 %cause problems.
d64d38d2a91a more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 381
diff changeset
885
d64d38d2a91a more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 381
diff changeset
886 $B?^(B~\ref{ex:hook:ws.simple}$B$O(B\hook{pretxncommit}$B$H$$$&$V$i2<$,$j6uGr$r%A%'%C(B
d64d38d2a91a more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 381
diff changeset
887 $B%/$9$kC1=c$J%U%C%/$rF3F~$7$F$$$k!%$3$N%U%C%/$OC;$$$,!$$=$l$[$IM-MQ$G$O$J(B
d64d38d2a91a more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 381
diff changeset
888 $B$$!%99?7$,$V$i2<$,$j6uGr$r4^$`9T$r$I$N%U%!%$%k$KDI2C$7$F$b!$$3$N%U%C%/$O(B
d64d38d2a91a more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 381
diff changeset
889 $B%(%i!<%9%F!<%?%9$H6&$K=*N;$9$k$,!$LdBj$N$"$k%U%!%$%k$d9T$rFCDj$9$k$?$a$N(B
d64d38d2a91a more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 381
diff changeset
890 $B>pJs$O0l@ZI=<($7$J$$!%$3$N%U%C%/$OJQ99$N$J$$9T$K$OA4$/4X?4$r;}$?$J$$$H$$(B
d64d38d2a91a more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 381
diff changeset
891 $B$&NI$$@-<A$b;}$C$F$$$k!%?75,$K$V$i2<$,$j6uGr$r2C$($kLdBj$N$"$k9T$N$_$r8!(B
d64d38d2a91a more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 381
diff changeset
892 $B::$9$k!%(B
49
18210d46491f More hook content.
Bryan O'Sullivan <bos@serpentine.com>
parents: 44
diff changeset
893
18210d46491f More hook content.
Bryan O'Sullivan <bos@serpentine.com>
parents: 44
diff changeset
894 \begin{figure}[ht]
18210d46491f More hook content.
Bryan O'Sullivan <bos@serpentine.com>
parents: 44
diff changeset
895 \interaction{hook.ws.better}
382
d64d38d2a91a more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 381
diff changeset
896 % \caption{A better trailing whitespace hook}
d64d38d2a91a more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 381
diff changeset
897 \caption{$B$V$i2<$,$j6uGr$r%A%'%C%/$9$k%U%C%/$N2~NIHG(B}
49
18210d46491f More hook content.
Bryan O'Sullivan <bos@serpentine.com>
parents: 44
diff changeset
898 \label{ex:hook:ws.better}
18210d46491f More hook content.
Bryan O'Sullivan <bos@serpentine.com>
parents: 44
diff changeset
899 \end{figure}
18210d46491f More hook content.
Bryan O'Sullivan <bos@serpentine.com>
parents: 44
diff changeset
900
382
d64d38d2a91a more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 381
diff changeset
901 %The example of figure~\ref{ex:hook:ws.better} is much more complex,
d64d38d2a91a more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 381
diff changeset
902 %but also more useful. It parses a unified diff to see if any lines
d64d38d2a91a more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 381
diff changeset
903 %add trailing whitespace, and prints the name of the file and the line
d64d38d2a91a more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 381
diff changeset
904 %number of each such occurrence. Even better, if the change adds
d64d38d2a91a more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 381
diff changeset
905 %trailing whitespace, this hook saves the commit comment and prints the
d64d38d2a91a more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 381
diff changeset
906 %name of the save file before exiting and telling Mercurial to roll the
d64d38d2a91a more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 381
diff changeset
907 %transaction back, so you can use
d64d38d2a91a more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 381
diff changeset
908 %\hgcmdargs{commit}{\hgopt{commit}{-l}~\emph{filename}} to reuse the
d64d38d2a91a more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 381
diff changeset
909 %saved commit message once you've corrected the problem.
49
18210d46491f More hook content.
Bryan O'Sullivan <bos@serpentine.com>
parents: 44
diff changeset
910
382
d64d38d2a91a more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 381
diff changeset
911 $B?^(B~\ref{ex:hook:ws.better}$B$O$+$J$jJ#;($@$,!$$h$jM-MQ$G$"$k!%$3$N%U%C%/$OE}(B
d64d38d2a91a more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 381
diff changeset
912 $B9g7A<0$N(Bdiff$B$r%Q!<%9$7!$$V$i2<$,$j6uGr$r4^$`%i%$%s$rC5$9!%$=$7$F8+$D$1$k(B
d64d38d2a91a more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 381
diff changeset
913 $B$H%U%!%$%kL>$H9THV9f$rI=<($9$k!%$5$i$KJQ99$,$V$i2<$,$j6uGr$rDI2C$9$k$H!$(B
d64d38d2a91a more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 381
diff changeset
914 $B$3$N%U%C%/$O%3%_%C%H%3%a%s%H$rJ]B8$7!$=*N;A0$KJ]B8%U%!%$%k$NL>A0$rI=<($9(B
d64d38d2a91a more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 381
diff changeset
915 $B$k!%$=$7$F(BMercurial$B$K%H%i%s%6%/%7%g%s$r%m!<%k%P%C%/$9$k$3$H$r;X<($9$k!%Ld(B
d64d38d2a91a more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 381
diff changeset
916 $BBj$r=$@5$7$?8e$GJ]B8$5$l$?%3%_%C%H%a%C%;!<%8$r;H$&$K$O(B
d64d38d2a91a more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 381
diff changeset
917 \hgcmdargs{commit}{\hgopt{commit}{-l}~\emph{filename}}$B$H$9$l$P$h$$!%(B
d64d38d2a91a more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 381
diff changeset
918
d64d38d2a91a more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 381
diff changeset
919 %As a final aside, note in figure~\ref{ex:hook:ws.better} the use of
d64d38d2a91a more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 381
diff changeset
920 %\command{perl}'s in-place editing feature to get rid of trailing
d64d38d2a91a more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 381
diff changeset
921 %whitespace from a file. This is concise and useful enough that I will
d64d38d2a91a more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 381
diff changeset
922 %reproduce it here.
d64d38d2a91a more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 381
diff changeset
923
d64d38d2a91a more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 381
diff changeset
924 $B:G8e$K!$?^(B~\ref{ex:hook:ws.better}$B$N$h$&$K%U%!%$%k$+$i$V$i2<$,$j6uGr$r=|5n(B
d64d38d2a91a more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 381
diff changeset
925 $B$9$k$?$a$K(B\command{perl}$B%3%^%s%I$N%$%s%W%l%$%9JT=85!G=$rMQ$$$k!%$3$l$O$3(B
d64d38d2a91a more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 381
diff changeset
926 $B$3$G:F8=$9$k$KEv$?$C$F==J,C;$/$+$DM-8z$G$"$k!%(B
d64d38d2a91a more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 381
diff changeset
927
49
18210d46491f More hook content.
Bryan O'Sullivan <bos@serpentine.com>
parents: 44
diff changeset
928 \begin{codesample2}
54
e94202d88199 Tix fypos.
Bryan O'Sullivan <bos@serpentine.com>
parents: 51
diff changeset
929 perl -pi -e 's,\\s+\$,,' filename
49
18210d46491f More hook content.
Bryan O'Sullivan <bos@serpentine.com>
parents: 44
diff changeset
930 \end{codesample2}
18210d46491f More hook content.
Bryan O'Sullivan <bos@serpentine.com>
parents: 44
diff changeset
931
374
32c932f185ed - fixed mq.tex a bit.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
932 %\section{Bundled hooks}
32c932f185ed - fixed mq.tex a bit.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
933 \section{$BAH$_9g$o$;%U%C%/(B}
49
18210d46491f More hook content.
Bryan O'Sullivan <bos@serpentine.com>
parents: 44
diff changeset
934
382
d64d38d2a91a more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 381
diff changeset
935 %Mercurial ships with several bundled hooks. You can find them in the
d64d38d2a91a more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 381
diff changeset
936 %\dirname{hgext} directory of a Mercurial source tree. If you are
d64d38d2a91a more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 381
diff changeset
937 %using a Mercurial binary package, the hooks will be located in the
d64d38d2a91a more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 381
diff changeset
938 %\dirname{hgext} directory of wherever your package installer put
d64d38d2a91a more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 381
diff changeset
939 %Mercurial.
d64d38d2a91a more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 381
diff changeset
940
d64d38d2a91a more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 381
diff changeset
941 Mercurial$B$K$O$$$/$D$+$N%U%C%/$,F1:-$5$l$F$$$k!%%U%C%/$O(BMercurial$B%=!<%9%D(B
d64d38d2a91a more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 381
diff changeset
942 $B%j!<$N(B\dirname{hgext}$B%G%#%l%/%H%j$K$"$k!%(B Mercurial$B$N%P%$%J%j%Q%C%1!<%8$r(B
d64d38d2a91a more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 381
diff changeset
943 $B;HMQ$7$F$$$k$N$G$"$l$P!$%U%C%/$O%Q%C%1!<%8%$%s%9%H!<%i$,(BMercurial$B$r%$%s%9(B
d64d38d2a91a more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 381
diff changeset
944 $B%H!<%k$7$?%G%#%l%/%H%jFb$N(B\dirname{hgext}$B%G%#%l%/%H%j$K$"$k$O$:$@!%(B
49
18210d46491f More hook content.
Bryan O'Sullivan <bos@serpentine.com>
parents: 44
diff changeset
945
374
32c932f185ed - fixed mq.tex a bit.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
946 %\subsection{\hgext{acl}---access control for parts of a repository}
32c932f185ed - fixed mq.tex a bit.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
947 \subsection{\hgext{acl}---$B%j%]%8%H%j$NItJ,$KBP$9$k%"%/%;%9%3%s%H%m!<%k(B}
49
18210d46491f More hook content.
Bryan O'Sullivan <bos@serpentine.com>
parents: 44
diff changeset
948
382
d64d38d2a91a more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 381
diff changeset
949 %The \hgext{acl} extension lets you control which remote users are
d64d38d2a91a more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 381
diff changeset
950 %allowed to push changesets to a networked server. You can protect any
d64d38d2a91a more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 381
diff changeset
951 %portion of a repository (including the entire repo), so that a
d64d38d2a91a more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 381
diff changeset
952 %specific remote user can push changes that do not affect the protected
d64d38d2a91a more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 381
diff changeset
953 %portion.
d64d38d2a91a more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 381
diff changeset
954
d64d38d2a91a more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 381
diff changeset
955 \hgext{acl}$B%(%/%9%F%s%7%g%s$O!$%j%b!<%H%f!<%6$K%A%'%s%8%;%C%H$r%M%C%H%o!<(B
d64d38d2a91a more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 381
diff changeset
956 $B%/@\B3$5$l$?%5!<%P$K%W%C%7%e$G$-$k$h$&$K$9$k!%FCDj$N%j%b!<%H%f!<%6$,J]8n(B
d64d38d2a91a more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 381
diff changeset
957 $B$5$l$?0J30$NItJ,$NJQ99$r%W%C%7%e$G$-$k$h$&$K%j%]%8%H%j$NG$0U$NItJ,!JA4BN(B
d64d38d2a91a more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 381
diff changeset
958 $B$r$b4^$`!K$rJ]8n$9$k$3$H$,$G$-$k!%(B
49
18210d46491f More hook content.
Bryan O'Sullivan <bos@serpentine.com>
parents: 44
diff changeset
959
382
d64d38d2a91a more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 381
diff changeset
960 %This extension implements access control based on the identity of the
d64d38d2a91a more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 381
diff changeset
961 %user performing a push, \emph{not} on who committed the changesets
d64d38d2a91a more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 381
diff changeset
962 %they're pushing. It makes sense to use this hook only if you have a
d64d38d2a91a more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 381
diff changeset
963 %locked-down server environment that authenticates remote users, and
d64d38d2a91a more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 381
diff changeset
964 %you want to be sure that only specific users are allowed to push
d64d38d2a91a more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 381
diff changeset
965 %changes to that server.
d64d38d2a91a more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 381
diff changeset
966
d64d38d2a91a more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 381
diff changeset
967 $B$3$N%(%/%9%F%s%7%g%s$O%f!<%6$,%W%C%7%e$r9T$&:]$K!$C/$,%A%'%s%8%;%C%H$r%3(B
d64d38d2a91a more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 381
diff changeset
968 $B%_%C%H(B\emph{$B$G$-$J$$(B}$B$h$&$K$9$k$3$H$G%"%/%;%9%3%s%H%m!<%k$r<BAu$7$F$$$k!%(B
d64d38d2a91a more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 381
diff changeset
969 $B$3$N%U%C%/$O!$%j%b!<%H%f!<%6$NG'>Z$r9T$&J]8n$5$l$?%5!<%P4D6-$G!$;XDj$5$l(B
d64d38d2a91a more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 381
diff changeset
970 $B$?%f!<%6$@$1$,JQ99$r%5!<%P$K%W%C%7%e$G$-$k$h$&$K$7$?$$>l9g$K$N$_0UL#$r$J(B
d64d38d2a91a more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 381
diff changeset
971 $B$9!%(B
62
8806b2875f10 Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 54
diff changeset
972
374
32c932f185ed - fixed mq.tex a bit.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
973 %\subsubsection{Configuring the \hook{acl} hook}
32c932f185ed - fixed mq.tex a bit.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
974 \subsubsection{\hook{acl}$B%U%C%/$N@_Dj(B}
62
8806b2875f10 Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 54
diff changeset
975
383
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
976 %In order to manage incoming changesets, the \hgext{acl} hook must be
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
977 %used as a \hook{pretxnchangegroup} hook. This lets it see which files
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
978 %are modified by each incoming changeset, and roll back a group of
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
979 %changesets if they modify ``forbidden'' files. Example:
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
980 %\begin{codesample2}
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
981 % [hooks]
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
982 % pretxnchangegroup.acl = python:hgext.acl.hook
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
983 %\end{codesample2}
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
984
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
985 \hgext{acl}$B%U%C%/$r!$E~Ce$9$k%A%'%s%8%;%C%H$r4IM}$9$k$?$a$K;H$&$?$a$K$O!$(B
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
986 \hook{pretxnchangegroup}$B%U%C%/$H$7$FMQ$$$kI,MW$,$"$k!%$3$N%U%C%/$O!$3F!9(B
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
987 $B$N%A%'%s%8%;%C%H$G$I$N%U%!%$%k$,JQ99$5$l$?$N$+$r%A%'%C%/$7!$JQ996X;_$N%U%!(B
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
988 $B%$%k$XJQ99$,$"$C$?>l9g$O%A%'%s%8%;%C%H$r%m!<%k%P%C%/$9$k!%Nc!'(B
62
8806b2875f10 Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 54
diff changeset
989 \begin{codesample2}
8806b2875f10 Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 54
diff changeset
990 [hooks]
8806b2875f10 Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 54
diff changeset
991 pretxnchangegroup.acl = python:hgext.acl.hook
8806b2875f10 Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 54
diff changeset
992 \end{codesample2}
8806b2875f10 Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 54
diff changeset
993
383
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
994 %The \hgext{acl} extension is configured using three sections.
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
995
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
996 \hgext{acl}$B%(%/%9%F%s%7%g%s$O(B3$B$D$N%;%/%7%g%s$G@_Dj$5$l$k!%(B
62
8806b2875f10 Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 54
diff changeset
997
383
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
998 %The \rcsection{acl} section has only one entry, \rcitem{acl}{sources},
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
999 %which lists the sources of incoming changesets that the hook should
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1000 %pay attention to. You don't normally need to configure this section.
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1001 %\begin{itemize}
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1002 %\item[\rcitem{acl}{serve}] Control incoming changesets that are arriving
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1003 % from a remote repository over http or ssh. This is the default
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1004 % value of \rcitem{acl}{sources}, and usually the only setting you'll
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1005 % need for this configuration item.
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1006 %\item[\rcitem{acl}{pull}] Control incoming changesets that are
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1007 % arriving via a pull from a local repository.
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1008 %\item[\rcitem{acl}{push}] Control incoming changesets that are
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1009 % arriving via a push from a local repository.
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1010 %\item[\rcitem{acl}{bundle}] Control incoming changesets that are
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1011 % arriving from another repository via a bundle.
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1012 %\end{itemize}
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1013
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1014 \rcsection{acl}$B%;%/%7%g%s$O!$(B\rcitem{acl}{sources}$B$H$$$&%(%s%H%j(B1$B$D$r;}(B
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1015 $B$D!%$3$N%(%s%H%j$G%U%C%/$,4F;k$9$Y$-E~Ce%A%'%s%8%;%C%HFb%=!<%9(B
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1016 $B$rNs5s$9$k!%(B
62
8806b2875f10 Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 54
diff changeset
1017 \begin{itemize}
383
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1018 \item[\rcitem{acl}{serve}] $B%j%b!<%H%j%]%8%H%j$+$i(Bhttp$B$^$?$O(Bssh$B$r;H$C$FE~(B
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1019 $BCe$9$k%A%'%s%8%;%C%H$r@)8f$9$k!%(B\rcitem{acl}{sources}$B$N%G%U%)(B
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1020 $B%k%HCM$G!$DL>o$O$3$N@_DjFb$GM#0l@_Dj$9$kI,MW$N$"$k9`L\$G$"(B
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1021 $B$k!%(B
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1022 \item[\rcitem{acl}{pull}] $B%m!<%+%k%j%]%8%H%j$+$i(Bpull$B$7$?%A%'%s%8%;%C%H$r(B
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1023 $B@)8f$9$k!%(B
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1024 \item[\rcitem{acl}{push}] $B%m!<%+%k%j%]%8%H%j$+$i(Bpush$B$7$?%A%'%s%8%;%C%H$r(B
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1025 $B@)8f$9$k!%(B
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1026 \item[\rcitem{acl}{bundle}] $BJL$N%j%]%8%H%j$+$i%P%s%I%k$K$h$C$FE~Ce$7$?%A%'(B
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1027 $B%s%8%;%C%H$r@)8f$9$k!%(B
62
8806b2875f10 Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 54
diff changeset
1028 \end{itemize}
8806b2875f10 Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 54
diff changeset
1029
383
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1030 %The \rcsection{acl.allow} section controls the users that are allowed to
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1031 %add changesets to the repository. If this section is not present, all
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1032 %users that are not explicitly denied are allowed. If this section is
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1033 %present, all users that are not explicitly allowed are denied (so an
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1034 %empty section means that all users are denied).
62
8806b2875f10 Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 54
diff changeset
1035
383
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1036 \rcsection{acl.allow}$B%;%/%7%g%s$O%A%'%s%8%;%C%H$N%j%]%8%H%j$X$NDI2C$r5v(B
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1037 $B2D$5$l$F$$$k%f!<%6$r@_Dj$9$k!%$3$N%;%/%7%g%s$,B8:_$7$J$$>l9g!$L@<(E*$K5q(B
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1038 $BH]$5$l$F$$$J$$$9$Y$F$N%f!<%6$O5v2D$5$l$k!%$3$N%;%/%7%g%s$,B8:_$9$k>l9g!$(B
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1039 $BL@<(E*$K5v2D$5$l$F$$$J$$$9$Y$F$N%f!<%6$O5qH]$5$l$k!%!J$9$J$o$A!$6u$N%;%/(B
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1040 $B%7%g%s$O$9$Y$F$N%f!<%6$N5qH]$H$$$&0UL#$K$J$k!%!K(B
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1041
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1042 %The \rcsection{acl.deny} section determines which users are denied
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1043 %from adding changesets to the repository. If this section is not
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1044 %present or is empty, no users are denied.
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1045
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1046 \rcsection{acl.deny}$B%;%/%7%g%s$O!$%j%]%8%H%j$X$N%A%'%s%8%;%C%HDI2C$r5qH](B
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1047 $B$9$k%f!<%6$r@_Dj$9$k!%$3$N%;%/%7%g%s$,B8:_$7$J$$$+!$6u$N>l9g$O$I$N%f!<%6(B
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1048 $B$b5qH]$5$l$J$$!%(B
62
8806b2875f10 Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 54
diff changeset
1049
383
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1050 %The syntaxes for the \rcsection{acl.allow} and \rcsection{acl.deny}
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1051 %sections are identical. On the left of each entry is a glob pattern
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1052 %that matches files or directories, relative to the root of the
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1053 %repository; on the right, a user name.
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1054
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1055 \rcsection{acl.allow}$B$H(B\rcsection{acl.deny}$B%;%/%7%g%s$N9=J8$OF10l$G$"$k!%(B
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1056 $B3F!9$N%(%s%H%j$N:8JU$O%U%!%$%k$^$?$O%G%#%l%/%H%j$K%^%C%A$9$k(Bglob$B%Q%?!<%s(B
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1057 $B$G!$%j%]%8%H%j%k!<%H$+$i$NAjBP%Q%9$G$"$k!%1&JU$O%f!<%6L>$G$"$k!%(B
62
8806b2875f10 Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 54
diff changeset
1058
383
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1059 %In the following example, the user \texttt{docwriter} can only push
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1060 %changes to the \dirname{docs} subtree of the repository, while
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1061 %\texttt{intern} can push changes to any file or directory except
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1062 %\dirname{source/sensitive}.
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1063 %\begin{codesample2}
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1064 % [acl.allow]
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1065 % docs/** = docwriter
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1066 %
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1067 % [acl.deny]
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1068 % source/sensitive/** = intern
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1069 %\end{codesample2}
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1070
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1071 $B0J2<$NNc$G$O!$(B\texttt{docwriter}$B$H$$$&%f!<%6$O!$%j%]%8%H%j$N(B
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1072 \dirname{docs}$B%5%V%D%j!<$K$7$+(Bpush$B$G$-$J$$!%$^$?(B\texttt{intern}$B$O(B
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1073 \dirname{source/sensitive}$B0J30$J$i$P$I$N%G%#%l%/%H%j$N$I$N%U%!%$%k$K$bJQ(B
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1074 $B99$r(Bpush$B$9$k$3$H$,$G$-$k!%(B
62
8806b2875f10 Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 54
diff changeset
1075 \begin{codesample2}
8806b2875f10 Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 54
diff changeset
1076 [acl.allow]
8806b2875f10 Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 54
diff changeset
1077 docs/** = docwriter
8806b2875f10 Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 54
diff changeset
1078
8806b2875f10 Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 54
diff changeset
1079 [acl.deny]
8806b2875f10 Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 54
diff changeset
1080 source/sensitive/** = intern
8806b2875f10 Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 54
diff changeset
1081 \end{codesample2}
8806b2875f10 Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 54
diff changeset
1082
374
32c932f185ed - fixed mq.tex a bit.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
1083 %\subsubsection{Testing and troubleshooting}
32c932f185ed - fixed mq.tex a bit.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
1084 \subsubsection{$B%F%9%H$HLdBj2r7h(B}
62
8806b2875f10 Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 54
diff changeset
1085
383
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1086 %If you want to test the \hgext{acl} hook, run it with Mercurial's
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1087
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1088 %debugging output enabled. Since you'll probably be running it on a
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1089 %server where it's not convenient (or sometimes possible) to pass in
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1090 %the \hggopt{--debug} option, don't forget that you can enable
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1091 %debugging output in your \hgrc:
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1092 %\begin{codesample2}
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1093 % [ui]
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1094 % debug = true
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1095 %\end{codesample2}
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1096 %With this enabled, the \hgext{acl} hook will print enough information
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1097 %to let you figure out why it is allowing or forbidding pushes from
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1098 %specific users.
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1099
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1100 \hgext{acl}$B%U%C%/$r%F%9%H$7$?$$>l9g$O!$(BMercurial$B$N%G%P%C%0=PNO$rM-8z$K$7(B
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1101 $B$F<B9T$9$k$HNI$$!%%5!<%P>e$G<B9T$9$k$N$G$"$l$P!"(B\hggopt{--debug}$B%*%W%7%g(B
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1102 $B%s$rEO$9$N$OITJX$G$"$C$?$j!"IT2DG=$G$"$C$?$j$9$k$3$H$,$"$k!#$3$N$?$a!"%G(B
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1103 $B%P%C%0=PNO$O(B \hgrc $B$G$($bM-8z$K$G$-$k$3$H$r5-21$7$F$*$/$Y$-$G$"$k!%(B
62
8806b2875f10 Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 54
diff changeset
1104 \begin{codesample2}
8806b2875f10 Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 54
diff changeset
1105 [ui]
8806b2875f10 Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 54
diff changeset
1106 debug = true
8806b2875f10 Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 54
diff changeset
1107 \end{codesample2}
383
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1108 $B%G%P%C%0=PNO$,M-8z$N>l9g!$(B\hgext{acl}$B%U%C%/$O!$FCDj$N%f!<%6$r5v2D$"$k$$(B
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1109 $B$O5qH]$7$?M}M3$rCN$k$N$K==J,$J>pJs$r=PNO$9$k!%(B
62
8806b2875f10 Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 54
diff changeset
1110
374
32c932f185ed - fixed mq.tex a bit.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
1111 %\subsection{\hgext{bugzilla}---integration with Bugzilla}
383
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1112 \subsection{\hgext{bugzilla}---Bugzilla$B$H$N7k9g(B}
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1113
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1114 %The \hgext{bugzilla} extension adds a comment to a Bugzilla bug
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1115 %whenever it finds a reference to that bug ID in a commit comment. You
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1116 %can install this hook on a shared server, so that any time a remote
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1117 %user pushes changes to this server, the hook gets run.
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1118
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1119 \hgext{bugzilla}$B%(%/%9%F%s%7%g%s$O!$(BBugzilla$B$G4IM}$5$l$F$$$k%P%0$X!$%3%_%C(B
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1120 $B%H%3%a%s%H$NCf$G%P%0(BID$B$r;2>H$7$F$$$k>l9g%3%a%s%H$rDI2C$9$k!%(B
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1121 $B$3$N%U%C%/$O6&M-%5!<%P$K$b%$%s%9%H!<%k$G$-$k$N$G!$%j%b!<%H%f!<%6$,(B
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1122 $BJQ99$r(Bpush$B$7$?>l9g$K$bF0:n$9$k!%(B
62
8806b2875f10 Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 54
diff changeset
1123
383
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1124 %It adds a comment to the bug that looks like this (you can configure
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1125 %the contents of the comment---see below):
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1126 %\begin{codesample2}
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1127 % Changeset aad8b264143a, made by Joe User <joe.user@domain.com> in
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1128 % the frobnitz repository, refers to this bug.
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1129 %
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1130 % For complete details, see
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1131 % http://hg.domain.com/frobnitz?cmd=changeset;node=aad8b264143a
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1132 %
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1133 % Changeset description:
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1134 % Fix bug 10483 by guarding against some NULL pointers
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1135 %\end{codesample2}
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1136 %The value of this hook is that it automates the process of updating a
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1137 %bug any time a changeset refers to it. If you configure the hook
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1138 %properly, it makes it easy for people to browse straight from a
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1139 %Bugzilla bug to a changeset that refers to that bug.
62
8806b2875f10 Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 54
diff changeset
1140
383
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1141 $B$3$N%U%C%/$O<!$N$h$&$K%P%0$X%3%a%s%H$rDI2C$9$k!%!J%3%a%s%H$NFbMF$O@_Dj2D(B
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1142 $BG=$G$"$k!%$3$l$K$D$$$F$O2<5-$r;2>H!%!K(B
62
8806b2875f10 Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 54
diff changeset
1143 \begin{codesample2}
8806b2875f10 Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 54
diff changeset
1144 Changeset aad8b264143a, made by Joe User <joe.user@domain.com> in
8806b2875f10 Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 54
diff changeset
1145 the frobnitz repository, refers to this bug.
8806b2875f10 Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 54
diff changeset
1146
8806b2875f10 Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 54
diff changeset
1147 For complete details, see
8806b2875f10 Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 54
diff changeset
1148 http://hg.domain.com/frobnitz?cmd=changeset;node=aad8b264143a
8806b2875f10 Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 54
diff changeset
1149
8806b2875f10 Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 54
diff changeset
1150 Changeset description:
8806b2875f10 Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 54
diff changeset
1151 Fix bug 10483 by guarding against some NULL pointers
8806b2875f10 Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 54
diff changeset
1152 \end{codesample2}
383
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1153 $B$3$N%U%C%/$O!$%A%'%s%8%;%C%H$,%P%0$r;2>H$7$?>l9g!$%P%0$N99?7$r<+F02=$G$-(B
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1154 $B$k$H$3$m$K2ACM$,$"$k!%$3$N%U%C%/$r$-$A$s$H@_Dj$9$l$P!$(BBugzilla$B%P%0$r1\Mw(B
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1155 $B$7$F$$$k%f!<%6$,!$%P%0$+$iD>$A$K4X78$9$k%A%'%s%8%;%C%H$r;2>H$G$-$k$h$&$K(B
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1156 $B$J$k!%(B
62
8806b2875f10 Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 54
diff changeset
1157
383
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1158 %You can use the code in this hook as a starting point for some more
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1159 %exotic Bugzilla integration recipes. Here are a few possibilities:
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1160 %\begin{itemize}
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1161 %\item Require that every changeset pushed to the server have a valid
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1162 % bug~ID in its commit comment. In this case, you'd want to configure
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1163 % the hook as a \hook{pretxncommit} hook. This would allow the hook
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1164 % to reject changes that didn't contain bug IDs.
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1165 %\item Allow incoming changesets to automatically modify the
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1166 % \emph{state} of a bug, as well as simply adding a comment. For
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1167 % example, the hook could recognise the string ``fixed bug 31337'' as
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1168 % indicating that it should update the state of bug 31337 to
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1169 % ``requires testing''.
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1170 %\end{itemize}
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1171
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1172 $B$3$N%U%C%/$N%3!<%I$r=PH/E@$H$7$F!$JL$N(BBugzilla$B$H$N7k9g$r9T$&$3$H$b2DG=(B
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1173 $B$G$"$k!%$$$/$D$+$NNc$r5s$2$k!'(B
62
8806b2875f10 Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 54
diff changeset
1174 \begin{itemize}
383
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1175 \item $B%5!<%P$K%W%C%7%e$5$l$?%A%'%s%8%;%C%H$9$Y$F$K%3%_%C%H%3%a%s%H$KM-8z(B
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1176 $B$J%P%0(BID$B$,$"$k$3$H$rMW5a$9$k!%$3$N>l9g!$%U%C%/$r(B
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1177 \hook{pretxncommit}$B%U%C%/$H$7$F@_Dj$9$kI,MW$,$"$k!%$3$l$K$h$C$F!$(B
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1178 $B%P%0(BID$B$r4^$^$J$$JQ99$r5qH]$9$k$3$H$,$G$-$k!%(B
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1179 \item $BE~Ce$9$k%A%'%s%8%;%C%H$K!$%3%a%s%HDI2C$K2C$($F!$%P%0$N(B\emph{$B%9%F!<(B
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1180 $B%H(B}$B$r<+F0E*$KJQ99$9$k$h$&$K$G$-$k!%Nc$($P!$%U%C%/$,(B``fixed bug
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1181 31337''$B$N$h$&$JJ8;zNs$rG'<1$7$F!$(Bbug 31337$B$N%9%F!<%H$r(B``requires
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1182 testing''$B$KJQ99$9$k$J$I$,9M$($i$l$k!%(B
62
8806b2875f10 Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 54
diff changeset
1183 \end{itemize}
8806b2875f10 Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 54
diff changeset
1184
374
32c932f185ed - fixed mq.tex a bit.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
1185 %\subsubsection{Configuring the \hook{bugzilla} hook}
32c932f185ed - fixed mq.tex a bit.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
1186 \subsubsection{\hook{bugzilla}$B%U%C%/$N@_Dj(B}
62
8806b2875f10 Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 54
diff changeset
1187 \label{sec:hook:bugzilla:config}
8806b2875f10 Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 54
diff changeset
1188
383
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1189 %You should configure this hook in your server's \hgrc\ as an
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1190 %\hook{incoming} hook, for example as follows:
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1191 %\begin{codesample2}
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1192 % [hooks]
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1193 % incoming.bugzilla = python:hgext.bugzilla.hook
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1194 %\end{codesample2}
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1195
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1196 $B$3$N%U%C%/$O<!$NNc$N$h$&$K%5!<%P>e$N(B\hgrc\ $B$G(B\hook{incoming}$B%U%C%/$H@_Dj(B
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1197 $B$9$Y$-$G$"$k!%(B
62
8806b2875f10 Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 54
diff changeset
1198 \begin{codesample2}
8806b2875f10 Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 54
diff changeset
1199 [hooks]
8806b2875f10 Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 54
diff changeset
1200 incoming.bugzilla = python:hgext.bugzilla.hook
8806b2875f10 Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 54
diff changeset
1201 \end{codesample2}
8806b2875f10 Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 54
diff changeset
1202
383
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1203 %Because of the specialised nature of this hook, and because Bugzilla
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1204 %was not written with this kind of integration in mind, configuring
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1205 %this hook is a somewhat involved process.
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1206
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1207 $B$3$N%U%C%/$NFCJL$J@-<A!$(BBugzilla$B$,$3$N$h$&$J7k9g$rG0F,$K=q$+$l$F$$$J$$$3(B
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1208 $B$H$K$h$C$F!$$3$N%U%C%/$N@_Dj$OJ#;($J%W%m%;%9$H$J$k!%(B
62
8806b2875f10 Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 54
diff changeset
1209
383
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1210 %Before you begin, you must install the MySQL bindings for Python on
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1211 %the host(s) where you'll be running the hook. If this is not
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1212 %available as a binary package for your system, you can download it
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1213 %from~\cite{web:mysql-python}.
62
8806b2875f10 Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 54
diff changeset
1214
383
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1215 $B@_Dj$r3+;O$9$kA0$K!$%U%C%/$r<B9T$9$k%[%9%H>e$G(BPython$BMQ$N(BMySQL$B%P%$%s%G%#%s(B
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1216 $B%0$r%$%s%9%H!<%k$9$kI,MW$,$"$k!%<B9T4D6-MQ$K%P%$%J%j%Q%C%1!<%8$,MQ0U$5$l(B
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1217 $B$F$$$J$1$l$P!$%=!<%9%U%!%$%k$r(B\cite{web:mysql-python}$B$+$i%@%&%s%m!<%I$9$k(B
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1218 $B$3$H$,$G$-$k!%(B
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1219
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1220 %Configuration information for this hook lives in the
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1221 %\rcsection{bugzilla} section of your \hgrc.
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1222 $B$3$N%U%C%/$N@_Dj>pJs$O!$(B\hgrc $B%U%!%$%k$N(B\rcsection{bugzilla}$B%;%/%7%g%s$K(B
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1223 $B$"$k!%(B
62
8806b2875f10 Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 54
diff changeset
1224 \begin{itemize}
383
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1225 %\item[\rcitem{bugzilla}{version}] The version of Bugzilla installed on
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1226 % the server. The database schema that Bugzilla uses changes
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1227 % occasionally, so this hook has to know exactly which schema to use.
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1228 % At the moment, the only version supported is \texttt{2.16}.
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1229 \item[\rcitem{bugzilla}{version}] $B%5!<%P$X%$%s%9%H!<%k$5$l$?(BBugzilla$B$N%P!<(B
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1230 $B%8%g%s!%(BBugzilla$B$N;HMQ$9$k%G!<%?%Y!<%9$N%9%-!<%^$O;~$KJQ99(B
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1231 $B$5$l$k$?$a!$%U%C%/$O$I$N%9%-!<%^$,;HMQ$5$l$k$N$+$rCN$kI,MW(B
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1232 $B$,$"$k!%8=;~E@$G$O(BBugzilla\texttt{2.16}$B$@$1$,%5%]!<%H$5$l(B
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1233 $B$F$$$k!%(B
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1234
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1235 %\item[\rcitem{bugzilla}{host}] The hostname of the MySQL server that
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1236 % stores your Bugzilla data. The database must be configured to allow
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1237 % connections from whatever host you are running the \hook{bugzilla}
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1238 % hook on.
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1239 \item[\rcitem{bugzilla}{host}] Bugzilla$B%G!<%?$r3JG<$7$F$$$k(BMySQL$B%5!<%P$N(B
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1240 $B%[%9%H%M!<%`!%%G!<%?%Y!<%9$O(B\hook{bugzilla}$B%U%C%/$r<B9T$9(B
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1241 $B$k%[%9%H$+$i@\B32DG=$K@_Dj$5$l$F$$$J$1$l$P$J$i$J$$!%(B
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1242
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1243 %\item[\rcitem{bugzilla}{user}] The username with which to connect to
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1244 % the MySQL server. The database must be configured to allow this
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1245 % user to connect from whatever host you are running the
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1246 % \hook{bugzilla} hook on. This user must be able to access and
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1247 % modify Bugzilla tables. The default value of this item is
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1248 % \texttt{bugs}, which is the standard name of the Bugzilla user in a
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1249 % MySQL database.
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1250 \item[\rcitem{bugzilla}{user}] MySQL$B%5!<%P$K@\B3$9$k%f!<%6L>!%%G!<%?%Y!<(B
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1251 $B%9$O(B\hook{bugzilla}$B%U%C%/$r<B9T$9$k%[%9%H>e$+$i$3$N%f!<%6$N(B
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1252 $B@\B3$r5v2D$9$k$h$&$K@_Dj$5$l$F$$$J$1$l$P$J$i$J$$!%$3$N%f!<(B
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1253 $B%6$O(BBugzilla$B%F!<%V%k$K%"%/%;%9$7!$JQ99$G$-$k8"8B$,$J$1$l$P(B
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1254 $B$J$i$J$$!%$3$N9`L\$N%G%U%)%k%HCM$O(BMySQL$B%G!<%?%Y!<%9$G$N(B
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1255 Bugzilla$B%f!<%6$NI8=`L>(B\texttt{bugs}$B$G$"$k!%(B
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1256
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1257 %\item[\rcitem{bugzilla}{password}] The MySQL password for the user you
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1258 % configured above. This is stored as plain text, so you should make
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1259 % sure that unauthorised users cannot read the \hgrc\ file where you
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1260 % store this information.
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1261 \item[\rcitem{bugzilla}{password}] $B>e5-$N%f!<%6$N(BMySQL$B%Q%9%o!<%I!%J?J8$G(B
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1262 $BJ]B8$5$l$k$?$a!$8"8B$N$J$$%f!<%6$,$3$N(B\hgrc\ $B%U%!%$%k$r3N<B(B
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1263 $B$KFI$a$J$$$h$&$K$7$F$*$/I,MW$,$"$k!%(B
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1264
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1265 %\item[\rcitem{bugzilla}{db}] The name of the Bugzilla database on the
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1266 % MySQL server. The default value of this item is \texttt{bugs},
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1267 % which is the standard name of the MySQL database where Bugzilla
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1268 % stores its data.
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1269 \item[\rcitem{bugzilla}{db}] MySQL$B%5!<%P>e$N(BBugzilla$B%G!<%?%Y!<%9$NL>A0!%(B
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1270 $B$3$N9`L\$N%G%U%)%k%HCM$O(B\texttt{bugs}$B$3$N9`L\$N%G%U%)%k%HCM(B
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1271 $B$O(BBugzilla$B$,%G!<%?$rJ]B8$9$k(BMySQL$B%G!<%?%Y!<%9$NI8=`L>(B
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1272 \texttt{bugs}$B$G$"$k!%(B
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1273
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1274 %\item[\rcitem{bugzilla}{notify}] If you want Bugzilla to send out a
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1275 % notification email to subscribers after this hook has added a
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1276 % comment to a bug, you will need this hook to run a command whenever
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1277 % it updates the database. The command to run depends on where you
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1278
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1279 % have installed Bugzilla, but it will typically look something like
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1280 % this, if you have Bugzilla installed in
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1281 % \dirname{/var/www/html/bugzilla}:
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1282 % \begin{codesample4}
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1283 % cd /var/www/html/bugzilla && ./processmail %s nobody@nowhere.com
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1284 % \end{codesample4}
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1285 % The Bugzilla \texttt{processmail} program expects to be given a
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1286 % bug~ID (the hook replaces ``\texttt{\%s}'' with the bug~ID) and an
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1287 % email address. It also expects to be able to write to some files in
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1288 % the directory that it runs in. If Bugzilla and this hook are not
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1289 % installed on the same machine, you will need to find a way to run
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1290 % \texttt{processmail} on the server where Bugzilla is installed.
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1291 \item[\rcitem{bugzilla}{notify}] $B%U%C%/$+$i%P%0$K%3%a%s%H$,DI2C$5$l$?;~!$(B
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1292 Bugzilla$B$+$i9VFI<T$KDLCN%a!<%k(B
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1293 $B$,Aw$i$l$k$h$&$K$7$?$$>l9g$O!$%U%C%/$,%G!<%?%Y!<%9$r99?7$7(B
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1294 $B$?>l9g$O>o$K%3%^%s%I$,<B9T$5$l$k$h$&$K@_Dj$7$J$1$l$P$J$i$J(B
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1295 $B$$!%<B9T$9$k%3%^%s%I$O!$(BBugzilla$B$r$I$3$K%$%s%9%H!<%k$7$?$+$K(B
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1296 $B0MB8$9$k!%(BBugzilla$B$r(B\dirname{/var/www/html/bugzilla}$B$K%$%s(B
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1297 $B%9%H!<%k$7$?>l9g!$E57?E*$J%3%^%s%I$O<!$N$h$&$K$J$k!'(B
62
8806b2875f10 Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 54
diff changeset
1298 \begin{codesample4}
8806b2875f10 Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 54
diff changeset
1299 cd /var/www/html/bugzilla && ./processmail %s nobody@nowhere.com
8806b2875f10 Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 54
diff changeset
1300 \end{codesample4}
383
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1301 Bugzilla \texttt{processmail}$B%W%m%0%i%`$O(Bbug~ID ($B%U%C%/$,(B
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1302 ``\texttt{\%s}''$B$r(Bbug~ID$B$KCV49$9$k!%(B)$B$H(Bemail$B%"%I%l%9$r<h$k!%$3$N%W%m%0%i(B
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1303 $B%`$O$^$?<B9T$5$l$k%G%#%l%/%H%jFb$G$$$/$D$+$N%U%!%$%k$X=q$-9~$_$rI,MW$H$9(B
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1304 $B$k!%(BBugzilla$B$H%U%C%/$,F1$8%^%7%s>e$K%$%s%9%H!<%k$5$l$F$$$J$$>l9g!$(B
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1305 Bugzilla$B$,%$%s%9%H!<%k$5$l$?%5!<%P>e$G(B\texttt{processmail}$B$r<B9T$9$kJ}K!(B
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1306 $B$r8+$D$1$kI,MW$,$"$k!%(B
62
8806b2875f10 Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 54
diff changeset
1307 \end{itemize}
8806b2875f10 Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 54
diff changeset
1308
374
32c932f185ed - fixed mq.tex a bit.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
1309 %\subsubsection{Mapping committer names to Bugzilla user names}
32c932f185ed - fixed mq.tex a bit.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
1310 \subsubsection{$B%3%_%C%H<T$NL>A0$r(BBugzilla$B$N%f!<%6L>$X%^%C%W$9$k(B}
62
8806b2875f10 Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 54
diff changeset
1311
383
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1312 %By default, the \hgext{bugzilla} hook tries to use the email address
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1313 %of a changeset's committer as the Bugzilla user name with which to
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1314 %update a bug. If this does not suit your needs, you can map committer
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1315 %email addresses to Bugzilla user names using a \rcsection{usermap}
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1316 %section.
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1317
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1318 $B%G%U%)%k%H$G$O(B\hgext{bugzilla}$B%U%C%/$O%P%0$r99?7$9$k(BBugzilla$B%f!<%6L>$H$7(B
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1319 $B$F%A%'%s%8%;%C%H$N%3%_%C%?$N(Bemail$B%"%I%l%9$r;H$*$&$H$9$k!%(B
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1320 $B$3$N5sF0$,K>$^$7$/$J$$>l9g$O!$(B\rcsection{usermap}$B%;%/%7%g%s$r$;$C$F$$$9$k(B
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1321 $B$3$H$G%3%_%C%?$N(Bemail$B%"%I%l%9$r(BBugzilla$B$N%f!<%6L>$K%^%C%W$9$k$3$H$,$G$-$k!%(B
62
8806b2875f10 Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 54
diff changeset
1322
383
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1323 %Each item in the \rcsection{usermap} section contains an email address
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1324 %on the left, and a Bugzilla user name on the right.
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1325 %\begin{codesample2}
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1326 % [usermap]
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1327 % jane.user@example.com = jane
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1328 %\end{codesample2}
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1329 %You can either keep the \rcsection{usermap} data in a normal \hgrc, or
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1330 %tell the \hgext{bugzilla} hook to read the information from an
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1331 %external \filename{usermap} file. In the latter case, you can store
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1332 %\filename{usermap} data by itself in (for example) a user-modifiable
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1333 %repository. This makes it possible to let your users maintain their
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1334 %own \rcitem{bugzilla}{usermap} entries. The main \hgrc\ file might
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1335 %look like this:
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1336 %\begin{codesample2}
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1337 % # regular hgrc file refers to external usermap file
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1338 % [bugzilla]
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1339 % usermap = /home/hg/repos/userdata/bugzilla-usermap.conf
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1340 %\end{codesample2}
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1341 %While the \filename{usermap} file that it refers to might look like
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1342 %this:
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1343 %\begin{codesample2}
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1344 % # bugzilla-usermap.conf - inside a hg repository
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1345 % [usermap]
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1346 % stephanie@example.com = steph
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1347 %\end{codesample2}
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1348
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1349 \rcsection{usermap}$B%;%/%7%g%s$N3F!9$N9`L\$O!$:8JU$K(Bemail$B%"%I%l%9!$1&JU$K(B
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1350 Bugzilla$B%f!<%6L>$r;}$D!%(B
62
8806b2875f10 Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 54
diff changeset
1351 \begin{codesample2}
8806b2875f10 Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 54
diff changeset
1352 [usermap]
8806b2875f10 Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 54
diff changeset
1353 jane.user@example.com = jane
8806b2875f10 Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 54
diff changeset
1354 \end{codesample2}
384
93df8137f563 compile fix
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 383
diff changeset
1355 \rcsection{usermap}$B%G!<%?$rDL>o$N(B \hgrc $B%U%!%$%k$KJ]B8$9$k$3$H$b(B
383
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1356 \hgext{bugzilla}$B%U%C%/$K30It$N(B\filename{usermap}$B%U%!%$%k$rFI$`$h$&$K;X<((B
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1357 $B$9$k$3$H$b$G$-$k!%8e<T$N>l9g!$Nc$($P(B\filename{usermap}$B%G!<%?$r%f!<%6$,JQ(B
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1358 $B992DG=$J%j%]%8%H%j$KCV$/$3$H$b2DG=$G$"$k!%$3$l$O%f!<%6$K(B
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1359 \rcitem{bugzilla}{usermap}$B%(%s%H%j$N4IM}$rG$$;$k$3$H$K$J$k!%%a%$%s$N(B
ef0c1fb05c84 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 382
diff changeset
1360 \hgrc\ $B%U%!%$%k$O<!$N$h$&$K$J$k!%!'(B
62
8806b2875f10 Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 54
diff changeset
1361 \begin{codesample2}
8806b2875f10 Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 54
diff changeset
1362 # regular hgrc file refers to external usermap file
8806b2875f10 Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 54
diff changeset
1363 [bugzilla]
8806b2875f10 Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 54
diff changeset
1364 usermap = /home/hg/repos/userdata/bugzilla-usermap.conf
8806b2875f10 Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 54
diff changeset
1365 \end{codesample2}
49
18210d46491f More hook content.
Bryan O'Sullivan <bos@serpentine.com>
parents: 44
diff changeset
1366
374
32c932f185ed - fixed mq.tex a bit.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
1367 %\subsubsection{Configuring the text that gets added to a bug}
32c932f185ed - fixed mq.tex a bit.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
1368 \subsubsection{$B%P%0$KDI2C$5$l$?J8;zNs$r@_Dj$9$k(B}
62
8806b2875f10 Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 54
diff changeset
1369
779
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1370 %You can configure the text that this hook adds as a comment; you
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1371 %specify it in the form of a Mercurial template. Several \hgrc\
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1372 %entries (still in the \rcsection{bugzilla} section) control this
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1373 %behaviour.
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1374 $B%U%C%/$,DI2C$9$k%3%a%s%HJ8;zNs$O(BMercurial$B%F%s%W%l!<%H$H$7$F;XDj$9$k$3$H$,(B
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1375 $B$G$-$k!%(B\hgrc $B$N%(%s%H%j(B(\rcsection{bugzilla}$B%;%/%7%g%s$K4^$^$l$F$$$k$b$N(B
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1376 $B$r4^$`(B)$B$G5sF0$r%3%s%H%m!<%k$G$-$k!%(B
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1377 %\begin{itemize}
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1378 %\item[\texttt{strip}] The number of leading path elements to strip
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1379 % from a repository's path name to construct a partial path for a URL.
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1380 % For example, if the repositories on your server live under
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1381 % \dirname{/home/hg/repos}, and you have a repository whose path is
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1382 % \dirname{/home/hg/repos/app/tests}, then setting \texttt{strip} to
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1383 % \texttt{4} will give a partial path of \dirname{app/tests}. The
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1384 % hook will make this partial path available when expanding a
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1385 % template, as \texttt{webroot}.
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1386 %\item[\texttt{template}] The text of the template to use. In addition
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1387 % to the usual changeset-related variables, this template can use
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1388 % \texttt{hgweb} (the value of the \texttt{hgweb} configuration item
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1389 % above) and \texttt{webroot} (the path constructed using
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1390 % \texttt{strip} above).
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1391 %\end{itemize}
62
8806b2875f10 Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 54
diff changeset
1392 \begin{itemize}
779
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1393 \item[\texttt{strip}] URL$B@8@.MQ$NItJ,%Q%9L>$r:n$k$?$a$K%j%]%8%H%j$N%Q%9L>(B
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1394 $B$+$i<h$j=|$+$l$k@h9TMWAG$N?t!%%5!<%P>e$N(B
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1395 \dirname{/home/hg/repos}$B$K%j%]%8%H%j72$,$"(B
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1396 $B$j!$(B\dirname{/home/hg/repos/app/tests}$B$H$$$&%j%]%8%H%j$r;}$C(B
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1397 $B$F$$$k>l9g!$(B\texttt{strip}$B$r(B\texttt{4}$B$K$9$k$HItJ,%Q%9L>(B
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1398 \dirname{app/tests}$B$,F@$i$l$k!%%U%C%/$O$3$NItJ,%Q%9$r%F%s%W(B
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1399 $B%l!<%H$N(B\texttt{webroot}$B$KE,MQ$9$k!%(B
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1400
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1401 \item[\texttt{template}] $B%F%s%W%l!<%H$K;HMQ$5$l$k%F%-%9%H!%DL>o$N%A%'%s%8(B
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1402 $B%;%C%H4XO"$NJQ?t$K2C$($F!$(B\texttt{hgweb}$B!J>e5-$N(B
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1403 \texttt{hgweb}$B$N@_DjCM!K$H(B\texttt{webroot}$B!J>e5-$N(B
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1404 \texttt{strip}$B$r;H$C$F:n$C$?%Q%9!K$,MxMQ$G$-$k(B.
62
8806b2875f10 Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 54
diff changeset
1405 \end{itemize}
8806b2875f10 Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 54
diff changeset
1406
779
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1407 %In addition, you can add a \rcitem{web}{baseurl} item to the
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1408 %\rcsection{web} section of your \hgrc. The \hgext{bugzilla} hook will
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1409 %make this available when expanding a template, as the base string to
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1410 %use when constructing a URL that will let users browse from a Bugzilla
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1411 %comment to view a changeset. Example:
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1412 $B$5$i$K!$(B\rcitem{web}{baseurl}$B9`L\$r(B\hgrc $B$N(B\rcsection{web}$B%;%/%7%g%s$KDI(B
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1413 $B2C$G$-$k!%$3$l$O%F%s%W%l!<%H$N3HD%;~$K(B\hgext{bugzilla}$B%U%C%/$K$h$j(B
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1414 Bugzilla$B%3%a%s%H$+$i%A%'%s%8%;%C%H$r;2>H$9$k:]$N(BURL$B@8@.$N%Y!<%9J8;zNs$H$7(B
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1415 $B$FMxMQ$5$l$k!%(B
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1416
64
d12a199ed472 Update hook reference.
Bryan O'Sullivan <bos@serpentine.com>
parents: 63
diff changeset
1417 \begin{codesample2}
d12a199ed472 Update hook reference.
Bryan O'Sullivan <bos@serpentine.com>
parents: 63
diff changeset
1418 [web]
d12a199ed472 Update hook reference.
Bryan O'Sullivan <bos@serpentine.com>
parents: 63
diff changeset
1419 baseurl = http://hg.domain.com/
d12a199ed472 Update hook reference.
Bryan O'Sullivan <bos@serpentine.com>
parents: 63
diff changeset
1420 \end{codesample2}
d12a199ed472 Update hook reference.
Bryan O'Sullivan <bos@serpentine.com>
parents: 63
diff changeset
1421
779
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1422 %Here is an example set of \hgext{bugzilla} hook config information.
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1423 \hgext{bugzilla}$B%U%C%/$N@_Dj>pJs$NNc$r<($9!%(B
62
8806b2875f10 Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 54
diff changeset
1424 \begin{codesample2}
8806b2875f10 Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 54
diff changeset
1425 [bugzilla]
8806b2875f10 Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 54
diff changeset
1426 host = bugzilla.example.com
8806b2875f10 Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 54
diff changeset
1427 password = mypassword
8806b2875f10 Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 54
diff changeset
1428 version = 2.16
8806b2875f10 Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 54
diff changeset
1429 # server-side repos live in /home/hg/repos, so strip 4 leading
8806b2875f10 Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 54
diff changeset
1430 # separators
8806b2875f10 Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 54
diff changeset
1431 strip = 4
8806b2875f10 Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 54
diff changeset
1432 hgweb = http://hg.example.com/
8806b2875f10 Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 54
diff changeset
1433 usermap = /home/hg/repos/notify/bugzilla.conf
8806b2875f10 Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 54
diff changeset
1434 template = Changeset \{node|short\}, made by \{author\} in the \{webroot\}
8806b2875f10 Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 54
diff changeset
1435 repo, refers to this bug.\\nFor complete details, see
8806b2875f10 Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 54
diff changeset
1436 \{hgweb\}\{webroot\}?cmd=changeset;node=\{node|short\}\\nChangeset
8806b2875f10 Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 54
diff changeset
1437 description:\\n\\t\{desc|tabindent\}
8806b2875f10 Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 54
diff changeset
1438 \end{codesample2}
8806b2875f10 Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 54
diff changeset
1439
374
32c932f185ed - fixed mq.tex a bit.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
1440 %\subsubsection{Testing and troubleshooting}
32c932f185ed - fixed mq.tex a bit.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
1441 \subsubsection{$B%F%9%H$HLdBj2r7h(B}
62
8806b2875f10 Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 54
diff changeset
1442
779
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1443 %The most common problems with configuring the \hgext{bugzilla} hook
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1444 %relate to running Bugzilla's \filename{processmail} script and mapping
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1445 %committer names to user names.
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1446
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1447 \hgext{bugzilla}$B%U%C%/$r@_Dj$9$k:]$K(BBugzilla$B$N(B\filename{processmail}$B%9%/(B
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1448 $B%j%W%H$N<B9T$H%3%_%C%?!<L>$N%f!<%6L>$X$N%^%C%T%s%0$,$h$/LdBj$K$J$k!%(B
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1449
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1450 %Recall from section~\ref{sec:hook:bugzilla:config} above that the user
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1451 %that runs the Mercurial process on the server is also the one that
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1452 %will run the \filename{processmail} script. The
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1453 %\filename{processmail} script sometimes causes Bugzilla to write to
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1454 %files in its configuration directory, and Bugzilla's configuration
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1455 %files are usually owned by the user that your web server runs under.
62
8806b2875f10 Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 54
diff changeset
1456
779
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1457 \ref{sec:hook:bugzilla:config}$B@a$G!$%5!<%P>e$G(BMercurial$B$rF0:n$5$;$F$$$k%f!<(B
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1458 $B%6$H(B\filename{processmail}$B%9%/%j%W%H$rF0$+$7$F$$$k%f!<%6$,F1$8$@$H=R$Y$?!%(B
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1459 \filename{processmail}$B%9%/%j%W%H$O(BBugzilla$B$K@_Dj%G%#%l%/%H%jFb$N%U%!%$%k(B
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1460 $B$K=q$-9~$^$;$k$3$H$,$"$k!%(B Bugzilla$B$N@_Dj%U%!%$%k$ODL>o!$%&%'%V%5!<%P$r5/(B
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1461 $BF0$7$F$$$k%f!<%6$N=jM-$G$"$k!%(B
62
8806b2875f10 Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 54
diff changeset
1462
779
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1463 %You can cause \filename{processmail} to be run with the suitable
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1464 %user's identity using the \command{sudo} command. Here is an example
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1465 %entry for a \filename{sudoers} file.
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1466 %\begin{codesample2}
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1467 % hg_user = (httpd_user) NOPASSWD: /var/www/html/bugzilla/processmail-wrapper %s
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1468 %\end{codesample2}
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1469 %This allows the \texttt{hg\_user} user to run a
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1470 %\filename{processmail-wrapper} program under the identity of
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1471 %\texttt{httpd\_user}.
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1472
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1473 \command{sudo}$B%3%^%s%I$r;H$&$3$H$G(B\filename{processmail}$B$rE,@Z$J%f!<%6$N(B
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1474 $B8"8B$G<B9T$9$k$3$H$,$G$-$k!%(B\filename{sudoers}$B%U%!%$%k$N5-=RNc$r<($9!%(B
62
8806b2875f10 Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 54
diff changeset
1475 \begin{codesample2}
8806b2875f10 Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 54
diff changeset
1476 hg_user = (httpd_user) NOPASSWD: /var/www/html/bugzilla/processmail-wrapper %s
8806b2875f10 Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 54
diff changeset
1477 \end{codesample2}
779
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1478 $B$3$NNc$G$O!$%f!<%6(B\texttt{hg\_user}$B$,(B\filename{processmail-wrapper}$B%W%m%0(B
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1479 $B%i%`$r%f!<%6(B\texttt{httpd\_user}$B$N8"8B$N85$G<B9T$9$k$3$H$,$G$-$k!%(B
62
8806b2875f10 Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 54
diff changeset
1480
779
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1481 %This indirection through a wrapper script is necessary, because
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1482 %\filename{processmail} expects to be run with its current directory
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1483 %set to wherever you installed Bugzilla; you can't specify that kind of
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1484 %constraint in a \filename{sudoers} file. The contents of the wrapper
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1485 %script are simple:
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1486 %\begin{codesample2}
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1487 % #!/bin/sh
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1488 % cd `dirname $0` && ./processmail "$1" nobody@example.com
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1489 %\end{codesample2}
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1490 %It doesn't seem to matter what email address you pass to
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1491 %\filename{processmail}.
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1492
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1493 $B$3$N%i%C%Q!<%9%/%j%W%H$+$i<B9T$9$k4V@\<B9T$OI,MW$G$"(B
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1494 $B$k!%(B\filename{processmail}$B$O(BBugzilla$B$r$I$3$K%$%s%9%H!<%k$7$F$b%+%l%s%H%G%#(B
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1495 $B%l%/%H%j$+$i<B9T$5$l$k$?$a$G$"$k!%<B9T@)8B$N<oN`$r(B\filename{sudoers}$B%U%!(B
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1496 $B%$%k$K5-=R$9$k!%%i%C%Q!<%9%/%j%W%H$NFbMF$O%7%s%W%k$J$b$N$G$"$k!%(B
62
8806b2875f10 Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 54
diff changeset
1497 \begin{codesample2}
8806b2875f10 Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 54
diff changeset
1498 #!/bin/sh
8806b2875f10 Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 54
diff changeset
1499 cd `dirname $0` && ./processmail "$1" nobody@example.com
8806b2875f10 Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 54
diff changeset
1500 \end{codesample2}
779
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1501 \filename{processmail}$B$KEO$9(Bemail$B%"%I%l%9$O$I$s$J$b$N$G$b$h$$!%(B
62
8806b2875f10 Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 54
diff changeset
1502
779
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1503 %If your \rcsection{usermap} is not set up correctly, users will see an
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1504 %error message from the \hgext{bugzilla} hook when they push changes
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1505 %to the server. The error message will look like this:
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1506 %\begin{codesample2}
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1507 % cannot find bugzilla user id for john.q.public@example.com
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1508 %\end{codesample2}
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1509 %What this means is that the committer's address,
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1510 %\texttt{john.q.public@example.com}, is not a valid Bugzilla user name,
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1511 %nor does it have an entry in your \rcsection{usermap} that maps it to
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1512 %a valid Bugzilla user name.
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1513
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1514 \rcsection{usermap}$B$,@5$7$/@_Dj$5$l$F$$$J$$>l9g!$JQ99$r%5!<%P$K%W%C%7%e$9(B
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1515 $B$k:]$K(B\hgext{bugzilla}$B%U%C%/$+$i$N%(%i!<%a%C%;!<%8$,%f!<%6$KAw$i$l$k!%(B
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1516 $B%(%i!<%a%C%;!<%8$O(B
62
8806b2875f10 Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 54
diff changeset
1517 \begin{codesample2}
8806b2875f10 Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 54
diff changeset
1518 cannot find bugzilla user id for john.q.public@example.com
8806b2875f10 Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 54
diff changeset
1519 \end{codesample2}
779
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1520 $B$N$h$&$JFbMF$G$"$k!%$3$l$O!$%3%_%C%?$N%"%I%l%9(B
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1521 \texttt{john.q.public@example.com}$B$,M-8z$J(BBugzilla$B%f!<%6%M!<%`$G$J$/!$$^(B
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1522 $B$?M-8z$J(BBugzilla$B%f!<%6L>$X$N%^%C%W%U%!%$%k$G$"$k(B\rcsection{usermap}$B$K$b(B
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1523 $B5-=R$,$J$$$H$$$&0UL#$G$"$k!%(B
62
8806b2875f10 Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 54
diff changeset
1524
374
32c932f185ed - fixed mq.tex a bit.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
1525 %\subsection{\hgext{notify}---send email notifications}
32c932f185ed - fixed mq.tex a bit.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
1526 \subsection{\hgext{notify}---$B%a!<%k$GDLCN$r9T$&(B}
62
8806b2875f10 Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 54
diff changeset
1527
779
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1528 %Although Mercurial's built-in web server provides RSS feeds of changes
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1529 %in every repository, many people prefer to receive change
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1530 %notifications via email. The \hgext{notify} hook lets you send out
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1531 %notifications to a set of email addresses whenever changesets arrive
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1532 %that those subscribers are interested in.
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1533
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1534 Mercurial$B$NAH$_9~$_%&%'%V%5!<%P$OA4$F$N%j%]%8%H%j$NJQ99$N(BRSS$B%U%#!<%I$rDs(B
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1535 $B6!$9$k$,!$JQ99$NDLCN$r%a!<%k$G<u$1<h$k$3$H$r9%$`%f!<%6$bB?$$!%(B\hgext{notify}
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1536 \hgext{notify}$B%U%C%/$O!$%A%'%s%8%;%C%H$,E~Ce$7$?;~$K4X?4$r;}$D%f!<%6$N%a!<(B
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1537 $B%k%"%I%l%9$KDLCN$rAw$k!%(B
62
8806b2875f10 Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 54
diff changeset
1538
779
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1539 %As with the \hgext{bugzilla} hook, the \hgext{notify} hook is
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1540 %template-driven, so you can customise the contents of the notification
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1541 %messages that it sends.
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1542
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1543 \hgext{bugzilla}$B$HF1MM$K(B\hgext{notify}$B%U%C%/$b%F%s%W%l!<%H$r;H$C$FAw?.$5(B
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1544 $B$l$kDLCN%a%C%;!<%8$NFbMF$r%+%9%?%^%$%:$9$k$3$H$,$G$-$k!%(B
62
8806b2875f10 Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 54
diff changeset
1545
779
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1546 %By default, the \hgext{notify} hook includes a diff of every changeset
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1547 %that it sends out; you can limit the size of the diff, or turn this
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1548 %feature off entirely. It is useful for letting subscribers review
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1549 %changes immediately, rather than clicking to follow a URL.
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1550
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1551 $B%G%U%)%k%H$G$O(B\hgext{notify}$B%U%C%/$OAw?.$5$l$kA4$F$N%A%'%s%8%;%C%H$N(Bdiff
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1552 $B$r4^$`!%$3$N(Bdiff$B$N%5%$%:$N>e8B$r@_Dj$7$?$j!$Aw?.<+BN$rDd;_$9$k$3$H$,$G$-(B
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1553 $B$k!%(Bdiff$B$rAw?.$9$k$H!$9VFI<T$,(BURL$B$r%/%j%C%/$9$k$3$H$J$/JQ99$r$9$0$K%l%S%e!<(B
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1554 $B$G$-$kMxE@$,$"$k!%(B
62
8806b2875f10 Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 54
diff changeset
1555
374
32c932f185ed - fixed mq.tex a bit.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
1556 %\subsubsection{Configuring the \hgext{notify} hook}
32c932f185ed - fixed mq.tex a bit.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
1557 \subsubsection{\hgext{notify}$B%U%C%/$N@_Dj(B}
62
8806b2875f10 Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 54
diff changeset
1558
779
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1559 %You can set up the \hgext{notify} hook to send one email message per
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1560 %incoming changeset, or one per incoming group of changesets (all those
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1561 %that arrived in a single pull or push).
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1562
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1563 \hgext{notify}$B%U%C%/$r@_Dj$7!$E~Ce$7$?%A%'%s%8%;%C%HKh$d!J0lEY$N(Bpull$B$d(B
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1564 push$B$GE~Ce$7$?!K0lO"$N%A%'%s%8%;%C%HKh$K(Bemail$B$rAw?.$9$k$3$H$,$G$-(B
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1565 $B$k!%(B
62
8806b2875f10 Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 54
diff changeset
1566 \begin{codesample2}
8806b2875f10 Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 54
diff changeset
1567 [hooks]
779
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1568 # $B0lO"$NJQ99Kh$K%a!<%k$rAw?.$9$k(B
62
8806b2875f10 Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 54
diff changeset
1569 changegroup.notify = python:hgext.notify.hook
779
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1570 # $BJQ990l$DKh$K%a!<%k$rAw?.$9$k(B
62
8806b2875f10 Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 54
diff changeset
1571 incoming.notify = python:hgext.notify.hook
8806b2875f10 Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 54
diff changeset
1572 \end{codesample2}
8806b2875f10 Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 54
diff changeset
1573
779
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1574 %Configuration information for this hook lives in the
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1575 %\rcsection{notify} section of a \hgrc\ file.
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1576
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1577 $B$3$N%U%C%/$N@_Dj$O(B\hgrc\ $B%U%!%$%k$N(B\rcsection{notify}$B%;%/%7%g%s$K=q$/!%(B
62
8806b2875f10 Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 54
diff changeset
1578 \begin{itemize}
779
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1579 %\item[\rcitem{notify}{test}] By default, this hook does not send out
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1580 % email at all; instead, it prints the message that it \emph{would}
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1581 % send. Set this item to \texttt{false} to allow email to be sent.
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1582 % The reason that sending of email is turned off by default is that it
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1583 % takes several tries to configure this extension exactly as you would
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1584 % like, and it would be bad form to spam subscribers with a number of
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1585 % ``broken'' notifications while you debug your configuration.
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1586 \item[\rcitem{notify}{test}] $B%G%U%)%k%H$G$O$3$N%U%C%/$O%a!<%k$rA4$/Aw?.$7(B
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1587 $B$J$$!%$=$NBe$o$j!$Aw?.$5$l$N$HF1$8FbMF$rI=<($9$k!%$3$N9`L\$r(B
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1588 \texttt{false}$B$K@_Dj$9$k$H%a!<%k$,Aw?.$5$l$k!%%G%U%)%k%H$G%a!<(B
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1589 $B%kAw?.$,%*%U$K$5$l$F$$$kM}M3$O!$0U?^$9$kDL$j$K$3$N@_Dj$r9T$&(B
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1590 $B$?$a$K$O?t2s$N;n9T$,I,MW$J$?$a$G$"$k!%%G%P%C%0Cf$K9VFI<T$K2u(B
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1591 $B$l$?DLCN$rAw$k$N$O%9%Q%`$^$,$$$G9%$^$7$/$J$$!%(B
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1592
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1593 %\item[\rcitem{notify}{config}] The path to a configuration file that
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1594 % contains subscription information. This is kept separate from the
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1595 % main \hgrc\ so that you can maintain it in a repository of its own.
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1596 % People can then clone that repository, update their subscriptions,
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1597 % and push the changes back to your server.
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1598 \item[\rcitem{notify}{config}] $B9VFI<T>pJs$r4^$`@_Dj%U%!%$%k$X$N%Q%9!%%a%$(B
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1599 $B%s$N(B\hgrc\ $B$HJ,N%$9$k$3$H$G!$%j%]%8%H%jKh$K%j%]%8%H%jFb$G4I(B
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1600 $BM}$G$-$k!%6(NO<T$O%j%]%8%H%j$r%/%m!<%s$7!$9VFI<T$r%"%C%W%G!<(B
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1601 $B%H$7$FJQ99$r%5!<%P$K(Bpush$B$G$-$k!%(B
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1602
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1603 %\item[\rcitem{notify}{strip}] The number of leading path separator
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1604 % characters to strip from a repository's path, when deciding whether
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1605 % a repository has subscribers. For example, if the repositories on
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1606 % your server live in \dirname{/home/hg/repos}, and \hgext{notify} is
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1607 % considering a repository named \dirname{/home/hg/repos/shared/test},
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1608 % setting \rcitem{notify}{strip} to \texttt{4} will cause
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1609 % \hgext{notify} to trim the path it considers down to
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1610 % \dirname{shared/test}, and it will match subscribers against that.
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1611 \item[\rcitem{notify}{strip}] $B%j%]%8%H%j$K9VFI<T$,$$$k$+$I$&$+H=Dj$9$k:](B
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1612 $B$K!$%j%]%8%H%j$N%Q%9$+$i=|5n$9$k@h9TItJ,$r%Q%96h@Z$jJ8;z$G<((B
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1613 $B$7$??t!%Nc$($P!$%5!<%P$G%j%]%8%H%j72$,(B
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1614 \dirname{/home/hg/repos}$B$KCV$+$l$F$*$j!$(B \hgext{notify}$B$,(B
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1615 \dirname{/home/hg/repos/shared/test}$B$H$$$&%j%]%8%H%j$rBP>]$H(B
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1616 $B$9$k;~!$(B\rcitem{notify}{strip} $B$r(B \texttt{4}$B$K@_Dj$9$k$H(B
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1617 \hgext{notify}$B$O%Q%9$r(B\dirname{shared/test}$B$KC;=L$7!$$3$l$r(B
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1618 $BMQ$$$F9VFI<T$N%^%C%A$r9T$&!%(B
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1619
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1620 %\item[\rcitem{notify}{template}] The template text to use when sending
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1621 % messages. This specifies both the contents of the message header
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1622 % and its body.
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1623 \item[\rcitem{notify}{template}] $B%a%C%;!<%8$rAw?.$9$k;~$K;H$o$l$k%F%-%9(B
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1624 $B%H$N%F%s%W%l!<%H!%%a%C%;!<%8$N%X%C%@$H%\%G%#N>J}$r@_Dj$9$k(B
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1625 $B$3$H$,$G$-$k!%(B
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1626
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1627 %\item[\rcitem{notify}{maxdiff}] The maximum number of lines of diff
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1628 % data to append to the end of a message. If a diff is longer than
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1629 % this, it is truncated. By default, this is set to 300. Set this to
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1630 % \texttt{0} to omit diffs from notification emails.
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1631 \item[\rcitem{notify}{maxdiff}] $B%a%C%;!<%8$NKvHx$KE:IU$5$l$k(Bdiff$B%G!<%?$N(B
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1632 $B:GBg9T?t!%(Bdiff$B$,$3$NCM$h$jBg$-$$>l9g$O@Z$j5M$a$i$l$k!%%G%U%)(B
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1633 $B%k%H$G$O(B300$B9T!%$3$NCM$r(B\texttt{0}$B$K$9$k$3$H$GDLCN(Bemail$B$X$N(B
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1634 diff$B$NE:IU$rM^@)$9$k$3$H$,$G$-$k!%(B
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1635
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1636 %\item[\rcitem{notify}{sources}] A list of sources of changesets to
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1637 % consider. This lets you limit \hgext{notify} to only sending out
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1638 % email about changes that remote users pushed into this repository
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1639 % via a server, for example. See section~\ref{sec:hook:sources} for
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1640 % the sources you can specify here.
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1641 \item[\rcitem{notify}{sources}] $BBP>]%A%'%s%8%;%C%H$N%=!<%9$N%j%9%H!%Nc$((B
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1642 $B$P!$$3$N%j%9%H$G%j%b!<%H%f!<%6$,%5!<%P7PM3$G%j%]%8%H%j$X%W%C(B
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1643 $B%7%e$7$?JQ99$K4X$7$F$N$_DLCN$r9T$&$h$&$K@)8B$9$k$3$H$,$G$-(B
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1644 $B$k!%$3$3$G;XDj$G$-$k%=!<%9$K$D$$$F$O(B\ref{sec:hook:sources}
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1645 $B@a$r;2>H$N$3$H!%(B
62
8806b2875f10 Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 54
diff changeset
1646 \end{itemize}
8806b2875f10 Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 54
diff changeset
1647
779
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1648 %If you set the \rcitem{web}{baseurl} item in the \rcsection{web}
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1649 %section, you can use it in a template; it will be available as
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1650 %\texttt{webroot}.
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1651
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1652 \rcsection{web}$B%;%/%7%g%s$N(B\rcitem{web}{baseurl}$B9`L\$r@_Dj$7$F$$$k$J$i!$(B
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1653 $B$3$l$r(B\texttt{webroot}$B$H$7$F%F%s%W%l!<%HFb$G;H$&$3$H$,$G$-$k!%(B
62
8806b2875f10 Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 54
diff changeset
1654
779
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1655 %Here is an example set of \hgext{notify} configuration information.
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1656 \hgext{notify}$B@_Dj$NNc$r<($9!%(B
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1657 %\begin{codesample2}
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1658 % [notify]
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1659 % # really send email
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1660 % test = false
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1661 % # subscriber data lives in the notify repo
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1662 % config = /home/hg/repos/notify/notify.conf
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1663 % # repos live in /home/hg/repos on server, so strip 4 "/" chars
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1664 % strip = 4
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1665 % template = X-Hg-Repo: \{webroot\}
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1666 % Subject: \{webroot\}: \{desc|firstline|strip\}
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1667 % From: \{author\}
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1668 %
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1669 % changeset \{node|short\} in \{root\}
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1670 % details: \{baseurl\}\{webroot\}?cmd=changeset;node=\{node|short\}
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1671 % description:
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1672 % \{desc|tabindent|strip\}
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1673 %
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1674 % [web]
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1675 % baseurl = http://hg.example.com/
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1676 %\end{codesample2}
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1677
62
8806b2875f10 Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 54
diff changeset
1678 \begin{codesample2}
8806b2875f10 Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 54
diff changeset
1679 [notify]
779
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1680 # $B<B:]$K%a!<%k$rAw?.$9$k$+(B
62
8806b2875f10 Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 54
diff changeset
1681 test = false
779
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1682 # $B9VFI<T%G!<%?$,DLCN%j%]%8%H%jFb$K$"$k(B
62
8806b2875f10 Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 54
diff changeset
1683 config = /home/hg/repos/notify/notify.conf
779
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1684 # $B%j%]%8%H%j72$O%5!<%P$N(B /home/hg/repos $B$K$"$k$N$G(B 4$B$D$N(B "/" $BJ8;z$r%9%H%j%C%W$9$k(B
62
8806b2875f10 Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 54
diff changeset
1685 strip = 4
285
814698eebbaf fixed a typo and formatted the notify hook configuration example nicer.
Timo Paulssen <timonator@perpetuum-immobile.de>
parents: 247
diff changeset
1686 template = X-Hg-Repo: \{webroot\}
814698eebbaf fixed a typo and formatted the notify hook configuration example nicer.
Timo Paulssen <timonator@perpetuum-immobile.de>
parents: 247
diff changeset
1687 Subject: \{webroot\}: \{desc|firstline|strip\}
814698eebbaf fixed a typo and formatted the notify hook configuration example nicer.
Timo Paulssen <timonator@perpetuum-immobile.de>
parents: 247
diff changeset
1688 From: \{author\}
814698eebbaf fixed a typo and formatted the notify hook configuration example nicer.
Timo Paulssen <timonator@perpetuum-immobile.de>
parents: 247
diff changeset
1689
814698eebbaf fixed a typo and formatted the notify hook configuration example nicer.
Timo Paulssen <timonator@perpetuum-immobile.de>
parents: 247
diff changeset
1690 changeset \{node|short\} in \{root\}
814698eebbaf fixed a typo and formatted the notify hook configuration example nicer.
Timo Paulssen <timonator@perpetuum-immobile.de>
parents: 247
diff changeset
1691 details: \{baseurl\}\{webroot\}?cmd=changeset;node=\{node|short\}
814698eebbaf fixed a typo and formatted the notify hook configuration example nicer.
Timo Paulssen <timonator@perpetuum-immobile.de>
parents: 247
diff changeset
1692 description:
814698eebbaf fixed a typo and formatted the notify hook configuration example nicer.
Timo Paulssen <timonator@perpetuum-immobile.de>
parents: 247
diff changeset
1693 \{desc|tabindent|strip\}
62
8806b2875f10 Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 54
diff changeset
1694
8806b2875f10 Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 54
diff changeset
1695 [web]
8806b2875f10 Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 54
diff changeset
1696 baseurl = http://hg.example.com/
8806b2875f10 Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 54
diff changeset
1697 \end{codesample2}
8806b2875f10 Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 54
diff changeset
1698
779
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1699 %This will produce a message that looks like the following:
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1700 $B@8@.$5$l$k%a%C%;!<%8$O<!$N$h$&$K$J$k!'(B
62
8806b2875f10 Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 54
diff changeset
1701 \begin{codesample2}
8806b2875f10 Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 54
diff changeset
1702 X-Hg-Repo: tests/slave
8806b2875f10 Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 54
diff changeset
1703 Subject: tests/slave: Handle error case when slave has no buffers
8806b2875f10 Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 54
diff changeset
1704 Date: Wed, 2 Aug 2006 15:25:46 -0700 (PDT)
8806b2875f10 Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 54
diff changeset
1705
8806b2875f10 Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 54
diff changeset
1706 changeset 3cba9bfe74b5 in /home/hg/repos/tests/slave
8806b2875f10 Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 54
diff changeset
1707 details: http://hg.example.com/tests/slave?cmd=changeset;node=3cba9bfe74b5
8806b2875f10 Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 54
diff changeset
1708 description:
8806b2875f10 Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 54
diff changeset
1709 Handle error case when slave has no buffers
8806b2875f10 Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 54
diff changeset
1710 diffs (54 lines):
8806b2875f10 Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 54
diff changeset
1711
8806b2875f10 Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 54
diff changeset
1712 diff -r 9d95df7cf2ad -r 3cba9bfe74b5 include/tests.h
8806b2875f10 Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 54
diff changeset
1713 --- a/include/tests.h Wed Aug 02 15:19:52 2006 -0700
8806b2875f10 Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 54
diff changeset
1714 +++ b/include/tests.h Wed Aug 02 15:25:26 2006 -0700
8806b2875f10 Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 54
diff changeset
1715 @@ -212,6 +212,15 @@ static __inline__ void test_headers(void *h)
8806b2875f10 Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 54
diff changeset
1716 [...snip...]
8806b2875f10 Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 54
diff changeset
1717 \end{codesample2}
8806b2875f10 Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 54
diff changeset
1718
374
32c932f185ed - fixed mq.tex a bit.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
1719 %\subsubsection{Testing and troubleshooting}
32c932f185ed - fixed mq.tex a bit.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
1720 \subsubsection{$B%F%9%H$HLdBj2r7h(B}
62
8806b2875f10 Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 54
diff changeset
1721
779
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1722 %Do not forget that by default, the \hgext{notify} extension \emph{will
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1723 % not send any mail} until you explicitly configure it to do so, by
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1724 %setting \rcitem{notify}{test} to \texttt{false}. Until you do that,
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1725 %it simply prints the message it \emph{would} send.
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1726
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1727 $B%G%U%)%k%H$G$O(B\hgext{notify}$B%(%/%9%F%s%7%g%s$O(B\emph{$B%a!<%k$rAw?.$7$J$$(B}$B$3(B
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1728 $B$H$KN10U$9$k$3$H!%<B:]$KAw?.$5$;$k$?$a$K$OL@<(E*$K(B\rcitem{notify}{test}$B$r(B
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1729 \texttt{false}$B$K@_Dj$7$J$1$l$P$J$i$J$$!%$3$N@_Dj$r$7$J$1$l$P!$Aw?.$9$k$N(B
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1730 $B$HF1$8%a%C%;!<%8$rI=<($9$k$@$1$G$"$k!%(B
44
012df94a02fe Start hook examples. First is for trailing whitespace.
Bryan O'Sullivan <bos@serpentine.com>
parents: 41
diff changeset
1731
374
32c932f185ed - fixed mq.tex a bit.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
1732 %\section{Information for writers of hooks}
32c932f185ed - fixed mq.tex a bit.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
1733 \section{$B%U%C%/:n@=<T$X$N>pJs(B}
41
d1a3394f8bcf More hook content.
Bryan O'Sullivan <bos@serpentine.com>
parents: 40
diff changeset
1734 \label{sec:hook:ref}
39
576fef93bb49 Further content for hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 38
diff changeset
1735
374
32c932f185ed - fixed mq.tex a bit.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
1736 %\subsection{In-process hook execution}
32c932f185ed - fixed mq.tex a bit.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
1737 \subsection{$B%W%m%;%9Fb%U%C%/$N<B9T(B}
39
576fef93bb49 Further content for hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 38
diff changeset
1738
779
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1739 %An in-process hook is called with arguments of the following form:
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1740 $B%W%m%;%9Fb%U%C%/$O<!$N$h$&$J7A<0$N0z?t$rH<$C$F8F$S=P$5$l$k!'(B
39
576fef93bb49 Further content for hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 38
diff changeset
1741 \begin{codesample2}
576fef93bb49 Further content for hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 38
diff changeset
1742 def myhook(ui, repo, **kwargs):
576fef93bb49 Further content for hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 38
diff changeset
1743 pass
576fef93bb49 Further content for hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 38
diff changeset
1744 \end{codesample2}
779
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1745 %The \texttt{ui} parameter is a \pymodclass{mercurial.ui}{ui} object.
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1746 %The \texttt{repo} parameter is a
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1747 %\pymodclass{mercurial.localrepo}{localrepository} object. The
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1748 %names and values of the \texttt{**kwargs} parameters depend on the
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1749 %hook being invoked, with the following common features:
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1750 \texttt{ui}$B%Q%i%a!<%?$O(B\pymodclass{mercurial.ui}{ui}$B$N%*%V%8%'%/%H$G$"$k!%(B
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1751 \texttt{repo}$B%Q%i%a!<%?$O(B
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1752 \pymodclass{mercurial.localrepo}{localrepository}$B$N%*%V%8%'%/%H$G$"$k!%(B
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1753 \texttt{**kwargs}$B%Q%i%a!<%?$NL>A0$HCM$O!$8F$S=P$5$l$k%U%C%/$K0MB8$7!$<!(B
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1754 $B$N$h$&$J6&DL$7$?FCD'$r;}$D!%(B
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1755 %\begin{itemize}
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1756 %\item If a parameter is named \texttt{node} or
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1757 % \texttt{parent\emph{N}}, it will contain a hexadecimal changeset ID.
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1758 % The empty string is used to represent ``null changeset ID'' instead
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1759 % of a string of zeroes.
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1760 %\item If a parameter is named \texttt{url}, it will contain the URL of
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1761 % a remote repository, if that can be determined.
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1762 %\item Boolean-valued parameters are represented as Python
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1763 % \texttt{bool} objects.
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1764 %\end{itemize}
39
576fef93bb49 Further content for hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 38
diff changeset
1765 \begin{itemize}
779
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1766 \item $B%Q%i%a!<%?$,(B\texttt{node}$B$^$?$O(B\texttt{parent\emph{N}}$B$HL>IU$1$i$l(B
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1767 $B$?>l9g!$(B16$B?J?t$N%A%'%s%8%;%C%H(BID$B$r;}$D!%(B ``$B%L%k%A%'%s%8%;%C%H(BID''$B$r(B
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1768 $BI=$9$?$a$K(B0$B$G$O$J$/6u$NJ8;zNs$,MQ$$$i$l$k!%(B
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1769 \item $B%Q%i%a!<%?$,(B\texttt{url}$B$HL>IU$1$i$l$?>l9g!$%j%b!<%H%j%]%8%H%j$,FC(B
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1770 $BDj$5$l$k$J$i$P$=$N(BURL$B$r;}$D!%(B
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1771 \item $B%V!<%kCM$r;}$D%Q%i%a!<%?$O(BPython$B$N(B\texttt{bool}$B%*%V%8%'%/%H$H$7$F(B
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1772 $BI=8=$5$l$k!%(B
39
576fef93bb49 Further content for hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 38
diff changeset
1773 \end{itemize}
576fef93bb49 Further content for hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 38
diff changeset
1774
779
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1775 %An in-process hook is called without a change to the process's working
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1776 %directory (unlike external hooks, which are run in the root of the
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1777 %repository). It must not change the process's working directory, or
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1778 %it will cause any calls it makes into the Mercurial API to fail.
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1779
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1780 $B%W%m%;%9Fb%U%C%/$O!$%j%]%8%H%j$N%k!<%H$G<B9T$5$l$k30It%U%C%/$H0[$J$j%W%m(B
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1781 $B%;%9$N%o!<%-%s%0%G%#%l%/%H%j$NJQ99$J$7$K8F$S=P$5$l$k!%%W%m%;%9Fb%U%C%/$O(B
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1782 $B%W%m%;%9%o!<%-%s%0%G%#%l%/%H%j$rJQ99$7$F$O$J$i$J$$!%$5$b$J$1$l(B
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1783 $B$P!$(BMercurial API$B$X$N8F$S=P$7$OA4$F<:GT$9$k!%(B
39
576fef93bb49 Further content for hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 38
diff changeset
1784
779
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1785 %If a hook returns a boolean ``false'' value, it is considered to have
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1786 %succeeded. If it returns a boolean ``true'' value or raises an
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1787 %exception, it is considered to have failed. A useful way to think of
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1788 %the calling convention is ``tell me if you fail''.
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1789
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1790 $B%U%C%/$,%V!<%kCM(B``false''$B$rJV$7$?>l9g!$%U%C%/$N<B9T$O@.8y$7$?$H8+$J$5$l(B
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1791 $B$k!%%V!<%kCM(B``true''$B$rJV$7$?>l9g$*$h$SNc30$rH/@8$5$;$?>l9g$O<:GT$7$?$H8+(B
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1792 $B$J$5$l$k!%8F$S=P$74{Ls$O(B ``$B<:GT$7$?;~$O65$($k(B''$B$H3P$($k$H$h$$!%(B
62
8806b2875f10 Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 54
diff changeset
1793
779
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1794 %Note that changeset IDs are passed into Python hooks as hexadecimal
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1795 %strings, not the binary hashes that Mercurial's APIs normally use. To
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1796 %convert a hash from hex to binary, use the
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1797 %\pymodfunc{mercurial.node}{bin} function.
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1798
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1799 Python$B%U%C%/$KEO$5$l$k%A%'%s%8%;%C%H(BID$B$O!$(BMercurial API$B$,DL>oMQ$$$k%P%$%J(B
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1800 $B%j%O%C%7%eCM$G$O$J$/(B16$B?J?tJ8;zNs$G$"$k$3$H$KCm0U!%%O%C%7%eCM$r(B16$B?J?tJ8;z(B
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
1801 $BNs$+$i%P%$%J%j$KJQ49$9$k$K$O(B\pymodfunc{mercurial.node}{bin}$B4X?t$rMQ$$$k!%(B
39
576fef93bb49 Further content for hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 38
diff changeset
1802
374
32c932f185ed - fixed mq.tex a bit.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
1803 %\subsection{External hook execution}
32c932f185ed - fixed mq.tex a bit.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
1804 \subsection{$B%U%C%/$N30It<B9T(B}
39
576fef93bb49 Further content for hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 38
diff changeset
1805
780
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
1806 %An external hook is passed to the shell of the user running Mercurial.
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
1807 %Features of that shell, such as variable substitution and command
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
1808 %redirection, are available. The hook is run in the root directory of
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
1809 %the repository (unlike in-process hooks, which are run in the same
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
1810 %directory that Mercurial was run in).
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
1811
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
1812 $B30It%U%C%/$O(BMercurial$B$r<B9T$7$F$$$k%7%'%k$G<B9T$5$l$k!%JQ?t$NCV49$d%3%^%s(B
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
1813 $B%I$N%j%@%$%l%/%H$J$I$N%7%'%k$N5!G=$,MxMQ$G$-$k!%30It%U%C%/$O!$(BMercurial$B$N(B
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
1814 $B<B9T$HF1$8%G%#%l%/%H%jFb$G<B9T$5$l$k%W%m%;%9Fb%U%C%/$H$O0[$J$j!$%j%]%8%H(B
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
1815 $B%j$N%k!<%H%G%#%l%/%H%j$G<B9T$5$l$k!%(B
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
1816
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
1817 %Hook parameters are passed to the hook as environment variables. Each
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
1818 %environment variable's name is converted in upper case and prefixed
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
1819 %with the string ``\texttt{HG\_}''. For example, if the name of a
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
1820 %parameter is ``\texttt{node}'', the name of the environment variable
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
1821 %representing that parameter will be ``\texttt{HG\_NODE}''.
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
1822
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
1823 $B%U%C%/%Q%i%a!<%?$O%U%C%/$K4D6-JS%9%H$7$FEO$5$l$k!%3F!9$N4D6-JQ?tL>$OBgJ8(B
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
1824 $B;z$KJQ49$5$l!$@\F,<-(B``\texttt{HG\_}''$B$,IU$1$i$l$k!%Nc$($P(B
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
1825 ``\texttt{node}''$B$H$$$&%Q%i%a!<%?$,;H$o$l$?$H$9$k$H!$$3$N%Q%i%a!<%?$rI=(B
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
1826 $B$94D6-JQ?tL>$O(B``\texttt{HG\_NODE}''$B$H$J$k!%(B
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
1827
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
1828 %A boolean parameter is represented as the string ``\texttt{1}'' for
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
1829 %``true'', ``\texttt{0}'' for ``false''. If an environment variable is
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
1830 %named \envar{HG\_NODE}, \envar{HG\_PARENT1} or \envar{HG\_PARENT2}, it
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
1831 %contains a changeset ID represented as a hexadecimal string. The
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
1832 %empty string is used to represent ``null changeset ID'' instead of a
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
1833 %string of zeroes. If an environment variable is named
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
1834 %\envar{HG\_URL}, it will contain the URL of a remote repository, if
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
1835 %that can be determined.
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
1836
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
1837 $B%V!<%kCM%Q%i%a!<%?$K$D$$$F$O!$??$,(B``\texttt{1}''$B!$56$,(B``\texttt{0}''$B$HI=(B
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
1838 $B8=$5$l$k!%(B\envar{HG\_NODE}$B!$(B\envar{HG\_PARENT1}$B!$(B\envar{HG\_PARENT2}$B$H$$(B
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
1839 $B$&4D6-JQ?t$,Dj5A$5$l$F$$$k$H$-!$$3$l$i$O(B16$B?J?t$NJ8;zNs$GI=$5$l$?%A%'%s%8(B
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
1840 $B%;%C%H(BID$B$r4^$`!%(B``$B%L%k%A%'%s%8%;%C%H(BID''$B$rI=8=$9$k$?$a$K%<%m$G$J$/6u$NJ8(B
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
1841 $B;zNs$,MQ$$$i$l$k!%4D6-JQ?t$,(B\envar{HG\_URL}$B$G$"$k$H$-!$%j%b!<%H%j%]%8%H%j(B
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
1842 $B$,FCDj$G$-$l$P!$$=$N(BURL$B$,F~$k!%(B
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
1843
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
1844 %If a hook exits with a status of zero, it is considered to have
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
1845 %succeeded. If it exits with a non-zero status, it is considered to
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
1846 %have failed.
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
1847
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
1848 $B%U%C%/$,%9%F!<%?%9(B0$B$G=*N;$7$?>l9g$O@.8y$H8+$J$5$l$k!%(B0$B0J30$N%9%F!<%?%9$G(B
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
1849 $B=*N;$7$?>l9g$O<B9T$,<:GT$7$?$H8+$J$5$l$k!%(B
39
576fef93bb49 Further content for hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 38
diff changeset
1850
374
32c932f185ed - fixed mq.tex a bit.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
1851 %\subsection{Finding out where changesets come from}
780
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
1852 \subsection{$B%A%'%s%8%;%C%H$N%=!<%9$rD4$Y$k(B}
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
1853
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
1854 %A hook that involves the transfer of changesets between a local
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
1855 %repository and another may be able to find out information about the
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
1856 %``far side''. Mercurial knows \emph{how} changes are being
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
1857 %transferred, and in many cases \emph{where} they are being transferred
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
1858 %to or from.
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
1859
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
1860 $B%m!<%+%k$J%j%]%8%H%j!&B>$N%j%]%8%H%j4V$N%A%'%s%8%;%C%H$NE>Aw$K4XO"$7$?%U%C(B
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
1861 $B%/$O!$1s3VCO$N>pJs$rF@$k$3$H$,$G$-$k!%(BMercurial$B$O(B\emph{$B$I$N$h$&$K(B}$BJQ99$,(B
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
1862 $BE>Aw$5$l$k$+!$$^$?B?$/$N>l9g(B\emph{$B$I$3$X(B}$B!$$"$k$$$O(B\emph{$B$I$3$+$i(B}$BE>Aw$5(B
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
1863 $B$l$k$N$+$bCN$k$3$H$,$G$-$k!%(B
62
8806b2875f10 Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 54
diff changeset
1864
374
32c932f185ed - fixed mq.tex a bit.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
1865 %\subsubsection{Sources of changesets}
780
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
1866 \subsubsection{$B%A%'%s%8%;%C%H$N%=!<%9(B}
62
8806b2875f10 Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 54
diff changeset
1867 \label{sec:hook:sources}
8806b2875f10 Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 54
diff changeset
1868
780
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
1869 %Mercurial will tell a hook what means are, or were, used to transfer
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
1870 %changesets between repositories. This is provided by Mercurial in a
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
1871 %Python parameter named \texttt{source}, or an environment variable named
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
1872 %\envar{HG\_SOURCE}.
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
1873
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
1874 Mercurial$B$O%U%C%/$K%A%'%s%8%;%C%H$NFbMF!$%j%]%8%H%j4V$NE>AwJ}K!$J$I$rDLCN(B
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
1875 $B$9$k!%(B Mercurial$B$ODLCN$N$?$a$K(B\texttt{source}$B$H$$$&(BPython$B%Q%i%a!<%?$^$?$O(B
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
1876 \envar{HG\_SOURCE}$B$H$$$&4D6-JQ?t$rMQ$$$k!%(B
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
1877
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
1878 %\begin{itemize}
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
1879 %\item[\texttt{serve}] Changesets are transferred to or from a remote
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
1880 % repository over http or ssh.
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
1881 %\item[\texttt{pull}] Changesets are being transferred via a pull from
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
1882 % one repository into another.
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
1883 %\item[\texttt{push}] Changesets are being transferred via a push from
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
1884 % one repository into another.
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
1885 %\item[\texttt{bundle}] Changesets are being transferred to or from a
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
1886 % bundle.
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
1887 %\end{itemize}
62
8806b2875f10 Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 54
diff changeset
1888
8806b2875f10 Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 54
diff changeset
1889 \begin{itemize}
780
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
1890 \item[\texttt{serve}] $B%A%'%s%8%;%C%H$O%j%b!<%H%j%]%8%H%j$+$i(Bhttp$B$^$?$O(B
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
1891 ssh$B$GE>Aw$5$l$?!%(B
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
1892 \item[\texttt{pull}] $B%A%'%s%8%;%C%H$O(B2$B$D$N%j%]%8%H%j4V$r(Bpull$B$K$h$C$FE>Aw(B
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
1893 $B$5$l$?!%(B
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
1894 \item[\texttt{push}] $B%A%'%s%8%;%C%H$O(B2$B$D$N%j%]%8%H%j4V$r(Bpush$B$K$h$C$FE>Aw(B
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
1895 $B$5$l$?!%(B
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
1896 \item[\texttt{bundle}] $B%A%'%s%8%;%C%H$O%P%s%I%k$K$h$C$FE>Aw$5$l$?!%(B
62
8806b2875f10 Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 54
diff changeset
1897 \end{itemize}
8806b2875f10 Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 54
diff changeset
1898
374
32c932f185ed - fixed mq.tex a bit.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
1899 %\subsubsection{Where changes are going---remote repository URLs}
32c932f185ed - fixed mq.tex a bit.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
1900 \subsubsection{$BJQ99$N9T$-@h(B---$B%j%b!<%H%j%]%8%H%j$N(BURL}
62
8806b2875f10 Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 54
diff changeset
1901 \label{sec:hook:url}
8806b2875f10 Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 54
diff changeset
1902
780
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
1903 %When possible, Mercurial will tell a hook the location of the ``far
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
1904 %side'' of an activity that transfers changeset data between
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
1905 %repositories. This is provided by Mercurial in a Python parameter
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
1906 %named \texttt{url}, or an environment variable named \envar{HG\_URL}.
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
1907
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
1908 Mercurial$B$O!$2DG=$G$"$k$J$i$P%j%]%8%H%j4V$N%A%'%s%8%;%C%H%G!<%?$NE>Aw$NAj(B
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
1909 $B<j$N>pJs$r%U%C%/$KDLCN$9$k!%(B Mercurial$B$O(B\texttt{url}$B$H$$$&(BPython$B%Q%i%a!<(B
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
1910 $B%?$^$?$O(B\envar{HG\_URL}$B$H$$$&4D6-JQ?t$r;H$C$FDLCN$r9T$&!%(B
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
1911
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
1912 %This information is not always known. If a hook is invoked in a
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
1913 %repository that is being served via http or ssh, Mercurial cannot tell
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
1914 %where the remote repository is, but it may know where the client is
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
1915
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
1916 %connecting from. In such cases, the URL will take one of the
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
1917 %following forms:
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
1918 %\begin{itemize}
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
1919 %\item \texttt{remote:ssh:\emph{ip-address}}---remote ssh client, at
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
1920 % the given IP address.
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
1921 %\item \texttt{remote:http:\emph{ip-address}}---remote http client, at
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
1922 % the given IP address. If the client is using SSL, this will be of
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
1923 % the form \texttt{remote:https:\emph{ip-address}}.
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
1924 %\item Empty---no information could be discovered about the remote
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
1925 % client.
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
1926 %\end{itemize}
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
1927
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
1928 $B$3$N>pJs$O$$$D$b4{CN$G$"$k!%(Bhttp$B$^$?$O(Bssh$B$G%5!<%S%9$5$l$F$$$k%j%]%8%H%j$+(B
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
1929 $B$i%U%C%/$,5/F0$5$l$?>l9g!$(BMercurial$B$O%j%b!<%H%j%]%8%H%j$,$I$3$K$"$k$N$+$r(B
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
1930 $BDLCN$9$k$3$H$O$G$-$J$$$,!$%/%i%$%"%s%H$,$I$3$+$i@\B3$7$F$$$k$N$+$OCN$k$3(B
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
1931 $B$H$,$G$-$k!%(B
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
1932
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
1933 $B$=$N>l9g!$(BURL$B$O<!$N$$$:$l$+$N7A<0$r<h$k!'(B
62
8806b2875f10 Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 54
diff changeset
1934 \begin{itemize}
780
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
1935 \item \texttt{remote:ssh:\emph{ip-address}}---$B$"$k(BIP$B%"%I%l%9>e$N%j%b!<%H(B
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
1936 ssh$B%/%i%$%"%s%H(B
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
1937 \item \texttt{remote:http:\emph{ip-address}}---$B$"$k(BIP$B%"%I%l%9>e$N(Bhttp$B%/(B
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
1938 $B%i%$%"%s%H!%$b$7%/%i%$%"%s%H$,(BSSL$B$r;HMQ$7$F$$$k>l(B
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
1939 $B9g!$(B\texttt{remote:https:\emph{ip-address}}$B$N$h$&$J7A<0$K$J$k!%(B
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
1940 \item Empty---$B%j%b!<%H%/%i%$%"%s%H$K4X$9$k>pJs$,$J$$!%(B
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
1941 \end{itemize}
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
1942
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
1943 %\begin{itemize}
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
1944 %\item \texttt{remote:ssh:\emph{ip-address}}---remote ssh client, at
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
1945 % the given IP address.
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
1946 %\item \texttt{remote:http:\emph{ip-address}}---remote http client, at
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
1947 % the given IP address. If the client is using SSL, this will be of
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
1948 % the form \texttt{remote:https:\emph{ip-address}}.
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
1949 %\item Empty---no information could be discovered about the remote
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
1950 % client.
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
1951 %\end{itemize}
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
1952
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
1953 \begin{itemize}
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
1954 \item \texttt{remote:ssh:\emph{ip-address}}---$BM?$($i$l$?(BIP$B%"%I%l%9$N%j%b!<(B
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
1955 $B%H(Bssh$B%/%i%$%"%s%H!%(B
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
1956 \item \texttt{remote:http:\emph{ip-address}}---$BM?$($i$l$?(BIP$B%"%I%l%9$N%j%b!<(B
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
1957 $B%H(Bhttp$B%/%i%$%"%s%H!%%/%i%$%"%s%H$,(BSSL$B$r;H$C$F$$$k>l9g$O(B
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
1958 \texttt{remote:https:\emph{ip-address}}$B$N7A<0$K$J$k!%(B
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
1959 \item $B6uGr(B---$B%j%b!<%H%/%i%$%"%s%H$K$D$$$F$N>pJs$OF@$i$l$J$+$C$?!%(B
62
8806b2875f10 Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 54
diff changeset
1960 \end{itemize}
8806b2875f10 Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 54
diff changeset
1961
374
32c932f185ed - fixed mq.tex a bit.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
1962 %\section{Hook reference}
32c932f185ed - fixed mq.tex a bit.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
1963 \section{$B%U%C%/;2>H(B}
64
d12a199ed472 Update hook reference.
Bryan O'Sullivan <bos@serpentine.com>
parents: 63
diff changeset
1964
374
32c932f185ed - fixed mq.tex a bit.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
1965 %\subsection{\hook{changegroup}---after remote changesets added}
32c932f185ed - fixed mq.tex a bit.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
1966 \subsection{\hook{changegroup}---$B%j%b!<%H%A%'%s%8%;%C%H$,DI2C$5$l$?8e(B}
39
576fef93bb49 Further content for hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 38
diff changeset
1967 \label{sec:hook:changegroup}
576fef93bb49 Further content for hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 38
diff changeset
1968
780
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
1969 %This hook is run after a group of pre-existing changesets has been
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
1970 %added to the repository, for example via a \hgcmd{pull} or
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
1971 %\hgcmd{unbundle}. This hook is run once per operation that added one
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
1972 %or more changesets. This is in contrast to the \hook{incoming} hook,
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
1973 %which is run once per changeset, regardless of whether the changesets
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
1974 %arrive in a group.
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
1975
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
1976 $B$3$N%U%C%/$O!$(B\hgcmd{pull}$B$^$?$O(B\hgcmd{unbundle}$B$J$I$G4{B8$N%A%'%s%8%;%C(B
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
1977 $B%H%0%k!<%W$,%j%]%8%H%j$KDI2C$5$l$?8e$K<B9T$5$l$k!%$3$N%U%C%/$O!$(B1$B$D0J>e$N(B
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
1978 $B%A%'%s%8%;%C%H$rDI2C$9$k%*%Z%l!<%7%g%s$K$D$-0lEY<B9T$5$l$k!%%0%k!<%W$K4X(B
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
1979 $B78$J$/%A%'%s%8%;%C%H(B1$B$DKh$K<B9T$5$l$k(B\hook{incoming}$B%U%C%/$H$OBP>HE*$G$"(B
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
1980 $B$k!%(B
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
1981
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
1982 %Some possible uses for this hook include kicking off an automated
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
1983 %build or test of the added changesets, updating a bug database, or
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
1984 %notifying subscribers that a repository contains new changes.
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
1985
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
1986 $B$3$N%U%C%/$r;H$C$FDI2C$5$l$?%A%'%s%8%;%C%H$KBP$9$k<+F0%S%k%I$d%F%9%H$r5/(B
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
1987 $BF0$9$k$3$H$d!$?7$?$JJQ99$r;}$D%j%]%8%H%j$N9VFI<T$KDLCN$9$k$3$H$,$G$-$k!%(B
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
1988
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
1989 %Parameters to this hook:
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
1990 %\begin{itemize}
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
1991 %\item[\texttt{node}] A changeset ID. The changeset ID of the first
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
1992 % changeset in the group that was added. All changesets between this
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
1993 % and \index{tags!\texttt{tip}}\texttt{tip}, inclusive, were added by
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
1994 % a single \hgcmd{pull}, \hgcmd{push} or \hgcmd{unbundle}.
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
1995 %\item[\texttt{source}] A string. The source of these changes. See
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
1996 % section~\ref{sec:hook:sources} for details.
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
1997 %\item[\texttt{url}] A URL. The location of the remote repository, if
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
1998 % known. See section~\ref{sec:hook:url} for more information.
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
1999 %\end{itemize}
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
2000
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
2001 $B$3$N%U%C%/$X$N%Q%i%a!<%?!'(B
39
576fef93bb49 Further content for hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 38
diff changeset
2002 \begin{itemize}
780
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
2003 \item[\texttt{node}] $B%A%'%s%8%;%C%H(BID$B!%DI2C$5$l$?%0%k!<%W$N:G=i$N%A%'%s%8(B
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
2004 $B%;%C%H$N(BID$B!%$3$N(BID$B$r4^$_(B
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
2005 \index{tags!\texttt{tip}}\texttt{tip}$B$^$G$N4V$N%A%'%s%8%;%C(B
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
2006 $B%HA4$F$O0l2s$N(B\hgcmd{pull}$B!$(B\hgcmd{push}$B$^$?$O(B
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
2007 \hgcmd{unbundle}$B$GDI2C$5$l$?!%(B
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
2008 \item[\texttt{source}] $BJ8;zNs!%$3$l$i$NJQ99$N%=!<%9!%>\:Y$K$D$$$F$O(B
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
2009 \ref{sec:hook:sources}$B$r;2>H$N$3$H!%(B
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
2010 \item[\texttt{url}] URL$B!%%j%b!<%H%j%]%8%H%j$,FCDj$G$-$k>l9g$O$=$N%"%I%l(B
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
2011 $B%9!%>\:Y$K$D$$$F$O(B\ref{sec:hook:url}$B$r;2>H$N$3$H!%(B
39
576fef93bb49 Further content for hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 38
diff changeset
2012 \end{itemize}
576fef93bb49 Further content for hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 38
diff changeset
2013
780
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
2014 %See also: \hook{incoming} (section~\ref{sec:hook:incoming}),
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
2015 %\hook{prechangegroup} (section~\ref{sec:hook:prechangegroup}),
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
2016 %\hook{pretxnchangegroup} (section~\ref{sec:hook:pretxnchangegroup})
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
2017
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
2018 $B;29M!'(B\hook{incoming} (\ref{sec:hook:incoming}$B@a(B), \hook{prechangegroup}
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
2019 (\ref{sec:hook:prechangegroup}$B@a(B), \hook{pretxnchangegroup}
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
2020 (\ref{sec:hook:pretxnchangegroup}$B@a(B)
39
576fef93bb49 Further content for hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 38
diff changeset
2021
374
32c932f185ed - fixed mq.tex a bit.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
2022 %\subsection{\hook{commit}---after a new changeset is created}
32c932f185ed - fixed mq.tex a bit.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
2023 \subsection{\hook{commit}---$B?7$7$$%A%'%s%8%;%C%H$,:n@.$5$l$?8e(B}
39
576fef93bb49 Further content for hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 38
diff changeset
2024 \label{sec:hook:commit}
576fef93bb49 Further content for hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 38
diff changeset
2025
780
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
2026 %This hook is run after a new changeset has been created.
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
2027
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
2028 $B$3$N%U%C%/$O?7$?$J%A%'%s%8%;%C%H$,:n$i$l$?8e$K8F$P$l$k!%(B
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
2029
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
2030 %Parameters to this hook:
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
2031 %\begin{itemize}
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
2032 %\item[\texttt{node}] A changeset ID. The changeset ID of the newly
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
2033 % committed changeset.
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
2034 %\item[\texttt{parent1}] A changeset ID. The changeset ID of the first
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
2035 % parent of the newly committed changeset.
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
2036 %\item[\texttt{parent2}] A changeset ID. The changeset ID of the second
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
2037 % parent of the newly committed changeset.
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
2038 %\end{itemize}
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
2039
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
2040 $B$3$N%U%C%/$X$N%Q%i%a!<%?!'(B
40
b2fe9964b21b More content for hook reference.
Bryan O'Sullivan <bos@serpentine.com>
parents: 39
diff changeset
2041 \begin{itemize}
780
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
2042 \item[\texttt{node}] $B%A%'%s%8%;%C%H(BID$B!%?7$?$K%3%_%C%H$5$l$?%A%'%s%8%;%C(B
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
2043 $B%H$N(BID$B!%(B
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
2044 \item[\texttt{parent1}] $B%A%'%s%8%;%C%H(BID$B!%?7$?$K%3%_%C%H$5$l$?%A%'%s%8%;%C(B
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
2045 $B%H$N(B1$B$DL\$N?F$N%A%'%s%8%;%C%H(BID.
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
2046 \item[\texttt{parent2}] $B%A%'%s%8%;%C%H(BID$B!%?7$?$K%3%_%C%H$5$l$?%A%'%s%8%;%C(B
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
2047 $B%H$N(B2$B$DL\$N?F$N%A%'%s%8%;%C%H(BID.
40
b2fe9964b21b More content for hook reference.
Bryan O'Sullivan <bos@serpentine.com>
parents: 39
diff changeset
2048 \end{itemize}
b2fe9964b21b More content for hook reference.
Bryan O'Sullivan <bos@serpentine.com>
parents: 39
diff changeset
2049
780
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
2050 %See also: \hook{precommit} (section~\ref{sec:hook:precommit}),
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
2051 %\hook{pretxncommit} (section~\ref{sec:hook:pretxncommit})
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
2052
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
2053 $B;29M!'(B\hook{precommit} (\ref{sec:hook:precommit}$B@a(B), \hook{pretxncommit}
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
2054 (\ref{sec:hook:pretxncommit}$B@a(B)
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
2055
40
b2fe9964b21b More content for hook reference.
Bryan O'Sullivan <bos@serpentine.com>
parents: 39
diff changeset
2056
374
32c932f185ed - fixed mq.tex a bit.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
2057 %\subsection{\hook{incoming}---after one remote changeset is added}
32c932f185ed - fixed mq.tex a bit.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
2058 \subsection{\hook{incoming}---$B%j%b!<%H%A%'%s%8%;%C%H$,DI2C$5$l$?8e(B}
40
b2fe9964b21b More content for hook reference.
Bryan O'Sullivan <bos@serpentine.com>
parents: 39
diff changeset
2059 \label{sec:hook:incoming}
b2fe9964b21b More content for hook reference.
Bryan O'Sullivan <bos@serpentine.com>
parents: 39
diff changeset
2060
780
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
2061 %This hook is run after a pre-existing changeset has been added to the
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
2062 %repository, for example via a \hgcmd{push}. If a group of changesets
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
2063 %was added in a single operation, this hook is called once for each
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
2064 %added changeset.
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
2065
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
2066 $B$3$N%U%C%/$O(B\hgcmd{push}$B%3%^%s%I$J$I$G4{B8$N%A%'%s%8%;%C%H$,%j%]%8%H%j$K(B
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
2067 $BDI2C$5$l$?8e$G<B9T$5$l$k!%%A%'%s%8%;%C%H$N%0%k!<%W$,0lEY$KDI2C$5$l$?>l(B
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
2068 $B9g!$3F!9$N%A%'%s%8%;%C%H$K$D$$$F0lEY$:$D$3$N%U%C%/$,8F$S=P$5$l$k!%(B
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
2069
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
2070 %You can use this hook for the same purposes as the \hook{changegroup}
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
2071 %hook (section~\ref{sec:hook:changegroup}); it's simply more convenient
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
2072 %sometimes to run a hook once per group of changesets, while other
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
2073 %times it's handier once per changeset.
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
2074
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
2075 $B$3$N%U%C%/$O(B\hook{changegroup}(\ref{sec:hook:changegroup}$B@a(B)$B$HF1$8L\E*$G(B
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
2076 $B;H$&$3$H$,$G$-$k!%0c$$$O(B\hook{changegroup}$B$,%A%'%s%8%;%C%H%0%k!<%WA4BN$K(B
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
2077 $BBP$7$F0lEY8F$P$l$kE@$G$"$k!%(B
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
2078
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
2079 %Parameters to this hook:
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
2080 %\begin{itemize}
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
2081 %\item[\texttt{node}] A changeset ID. The ID of the newly added
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
2082 % changeset.
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
2083 %\item[\texttt{source}] A string. The source of these changes. See
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
2084 % section~\ref{sec:hook:sources} for details.
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
2085 %\item[\texttt{url}] A URL. The location of the remote repository, if
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
2086 % known. See section~\ref{sec:hook:url} for more information.
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
2087 %\end{itemize}
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
2088
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
2089 $B$3$N%U%C%/$X$N%Q%i%a!<%?!'(B
40
b2fe9964b21b More content for hook reference.
Bryan O'Sullivan <bos@serpentine.com>
parents: 39
diff changeset
2090 \begin{itemize}
780
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
2091 \item[\texttt{node}] $B%A%'%s%8%;%C%H(BID$B!%?7$?$KDI2C$5$l$k%A%'%s%8%;%C%H$N(B
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
2092 ID$B!%(B
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
2093 \item[\texttt{source}] $BJ8;zNs!%$3$l$i$NJQ99$N%=!<%9!%>\:Y$K$D$$$F$O(B
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
2094 \ref{sec:hook:sources}$B$r;2>H$N$3$H!%(B
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
2095 \item[\texttt{url}] URL$B!%%j%b!<%H%j%]%8%H%j$,FCDj$G$-$k>l9g$K$O$=$N%"%I(B
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
2096 $B%l%9!%>\:Y$K$D$$$F$O(B\ref{sec:hook:url}$B$r;2>H$N$3$H!%(B
40
b2fe9964b21b More content for hook reference.
Bryan O'Sullivan <bos@serpentine.com>
parents: 39
diff changeset
2097 \end{itemize}
b2fe9964b21b More content for hook reference.
Bryan O'Sullivan <bos@serpentine.com>
parents: 39
diff changeset
2098
780
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
2099 %See also: \hook{changegroup} (section~\ref{sec:hook:changegroup}) \hook{prechangegroup} (section~\ref{sec:hook:prechangegroup}), \hook{pretxnchangegroup} (section~\ref{sec:hook:pretxnchangegroup})
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
2100 $B;29M!'(B\hook{changegroup} (\ref{sec:hook:changegroup}$B@a(B)
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
2101 \hook{prechangegroup} (\ref{sec:hook:prechangegroup}$B@a(B),
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
2102 \hook{pretxnchangegroup} (\ref{sec:hook:pretxnchangegroup}$B@a(B)
40
b2fe9964b21b More content for hook reference.
Bryan O'Sullivan <bos@serpentine.com>
parents: 39
diff changeset
2103
374
32c932f185ed - fixed mq.tex a bit.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
2104 %\subsection{\hook{outgoing}---after changesets are propagated}
32c932f185ed - fixed mq.tex a bit.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
2105 \subsection{\hook{outgoing}---$B%A%'%s%8%;%C%H$,GH5Z$7$?8e(B}
40
b2fe9964b21b More content for hook reference.
Bryan O'Sullivan <bos@serpentine.com>
parents: 39
diff changeset
2106 \label{sec:hook:outgoing}
b2fe9964b21b More content for hook reference.
Bryan O'Sullivan <bos@serpentine.com>
parents: 39
diff changeset
2107
780
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
2108 %This hook is run after a group of changesets has been propagated out
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
2109 %of this repository, for example by a \hgcmd{push} or \hgcmd{bundle}
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
2110 %command.
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
2111
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
2112 $B$3$N%U%C%/$O%A%'%s%8%;%C%H$N%0%k!<%W$,(B\hgcmd{push}$B$d(B\hgcmd{bundle}$B%3%^%s(B
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
2113 $B%I$J$I$K$h$C$F30It$KGH5Z$7$?8e$G<B9T$5$l$k!%(B
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
2114
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
2115 %One possible use for this hook is to notify administrators that
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
2116 %changes have been pulled.
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
2117
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
2118 $B$3$N%U%C%/$r;H$C$F4IM}<T$O(Bpull$B$5$l$?JQ99$rCN$k$3$H$,$G$-$k!%(B
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
2119
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
2120 %Parameters to this hook:
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
2121 %\begin{itemize}
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
2122 %\item[\texttt{node}] A changeset ID. The changeset ID of the first
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
2123 % changeset of the group that was sent.
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
2124 %\item[\texttt{source}] A string. The source of the of the operation
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
2125 % (see section~\ref{sec:hook:sources}). If a remote client pulled
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
2126 % changes from this repository, \texttt{source} will be
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
2127 % \texttt{serve}. If the client that obtained changes from this
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
2128 % repository was local, \texttt{source} will be \texttt{bundle},
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
2129 % \texttt{pull}, or \texttt{push}, depending on the operation the
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
2130 % client performed.
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
2131 %\item[\texttt{url}] A URL. The location of the remote repository, if
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
2132 % known. See section~\ref{sec:hook:url} for more information.
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
2133 %\end{itemize}
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
2134
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
2135 $B$3$N%U%C%/$X$N%Q%i%a!<%?!'(B
40
b2fe9964b21b More content for hook reference.
Bryan O'Sullivan <bos@serpentine.com>
parents: 39
diff changeset
2136 \begin{itemize}
780
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
2137 \item[\texttt{node}] $B%A%'%s%8%;%C%H(BID$B!%Aw?.$5$l$?%A%'%s%8%;%C%H%0%k!<%W(B
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
2138 $B$N:G=i$N%A%'%s%8%;%C%H(BID.
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
2139 \item[\texttt{source}] $BJ8;zNs!%A`:n85(B(~\ref{sec:hook:sources}$B@a$r;2>H(B)$B!%(B
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
2140 $B%j%b!<%H%/%i%$%"%s%H$,JQ99$r%j%]%8%H%j$+$i(Bpull$B$9$k$H(B
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
2141 \texttt{source}$B$,(B\texttt{serve}$B$H$J$k!%%j%]%8%H%j$+$iJQ99$r(B
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
2142 $BF~<j$7$?%/%i%$%"%s%H$,%m!<%+%k$G$"$l$P!$(B\texttt{source}$B$O%/(B
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
2143 $B%i%$%"%s%H$N9T$C$?F0:n$K1~$8$F(B
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
2144 \texttt{bundle}$B!$(B\texttt{pull}$B!$(B\texttt{push}$B$N$$$:$l$+$H$J(B
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
2145 $B$k!%(B
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
2146 \item[\texttt{url}] URL$B!%%j%b!<%H%j%]%8%H%j$,FCDj$G$-$k>l9g$O$=$N%"%I%l%9!%(B
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
2147 $B>\:Y$K$D$$$F$O(B\ref{sec:hook:url}$B@a$r;2>H$N$3$H!%(B
40
b2fe9964b21b More content for hook reference.
Bryan O'Sullivan <bos@serpentine.com>
parents: 39
diff changeset
2148 \end{itemize}
b2fe9964b21b More content for hook reference.
Bryan O'Sullivan <bos@serpentine.com>
parents: 39
diff changeset
2149
780
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
2150
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
2151 %See also: \hook{preoutgoing} (section~\ref{sec:hook:preoutgoing})
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
2152 $B;29M!'(B \hook{preoutgoing} (\ref{sec:hook:preoutgoing}$B@a(B)
40
b2fe9964b21b More content for hook reference.
Bryan O'Sullivan <bos@serpentine.com>
parents: 39
diff changeset
2153
374
32c932f185ed - fixed mq.tex a bit.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
2154 %\subsection{\hook{prechangegroup}---before starting to add remote
32c932f185ed - fixed mq.tex a bit.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
2155 %changesets}
32c932f185ed - fixed mq.tex a bit.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
2156 \subsection{\hook{prechangegroup}---$B%j%b!<%H%A%'%s%8%;%C%H$,$,DI2C$5$l$k(B
32c932f185ed - fixed mq.tex a bit.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
2157 $BA0(B}
40
b2fe9964b21b More content for hook reference.
Bryan O'Sullivan <bos@serpentine.com>
parents: 39
diff changeset
2158 \label{sec:hook:prechangegroup}
b2fe9964b21b More content for hook reference.
Bryan O'Sullivan <bos@serpentine.com>
parents: 39
diff changeset
2159
780
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
2160 %This controlling hook is run before Mercurial begins to add a group of
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
2161 %changesets from another repository.
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
2162
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
2163 $B$3$N@)8f%U%C%/$O(BMercurial$B$,0lO"$N%A%'%s%8%;%C%H$rJL$N%j%]%8%H%j$KDI2C$9(B
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
2164 $B$kA0$K<B9T$5$l$k!%(B
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
2165
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
2166 %This hook does not have any information about the changesets to be
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
2167 %added, because it is run before transmission of those changesets is
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
2168 %allowed to begin. If this hook fails, the changesets will not be
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
2169 %transmitted.
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
2170
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
2171 $B$3$N%U%C%/$ODI2C$5$l$k%A%'%s%8%;%C%H$N>pJs$O2?$b;}$?$J$$!%$J$<$J$i$3$N%U%C(B
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
2172 $B%/$O%A%'%s%8%;%C%H$NAw?.$,;O$^$kA0$K<B9T$5$l$k$+$i$@!%%U%C%/$N<B9T$,<:GT(B
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
2173 $B$7$?>l9g$O%A%'%s%8%;%C%H$OAw?.$5$l$J$$!%(B
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
2174
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
2175 %One use for this hook is to prevent external changes from being added
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
2176 %to a repository. For example, you could use this to ``freeze'' a
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
2177 %server-hosted branch temporarily or permanently so that users cannot
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
2178 %push to it, while still allowing a local administrator to modify the
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
2179 %repository.
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
2180
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
2181 $B$3$N%U%C%/$r;H$C$F!$30It$NJQ99$,%j%]%8%H%j$K$D$$$+$5$l$J$$$h$&$K$9$k$3$H(B
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
2182 $B$b$G$-$k!%Nc$($P!$$3$N%U%C%/$r%5!<%P$GDs6!$5$l$k%V%i%s%A$r0l;~E*$^$?$O1J(B
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
2183 $BB3E*$K(B``$BE`7k(B''$B$7!$%m!<%+%k$J4IM}<T$O%j%]%8%H%j$rJQ99$G$-$k$,!$%j%b!<%H(B
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
2184 $B%f!<%6$O$=$N%j%]%8%H%j$K(Bpush$B$G$-$J$$$h$&$K$G$-$k!%(B
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
2185
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
2186 %Parameters to this hook:
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
2187 $B$3$N%U%C%/$X$N%Q%i%a!<%?!'(B
62
8806b2875f10 Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 54
diff changeset
2188 \begin{itemize}
780
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
2189 \item[\texttt{source}] $BJ8;zNs!%JQ99$N%=!<%9!%>\:Y$K$D$$$F$O(B
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
2190 \ref{sec:hook:sources}$B$r;2>H!%(B
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
2191 \item[\texttt{url}] URL$B!%%j%b!<%H%j%]%8%H%j$,FCDj$5$l$k>l9g$O$=$N%"%I%l(B
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
2192 $B%9!%>\:Y$K$D$$$F$O(B\ref{sec:hook:url}$B$r;2>H!%(B
62
8806b2875f10 Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 54
diff changeset
2193 \end{itemize}
40
b2fe9964b21b More content for hook reference.
Bryan O'Sullivan <bos@serpentine.com>
parents: 39
diff changeset
2194
780
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
2195 %See also: \hook{changegroup} (section~\ref{sec:hook:changegroup}),
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
2196 %\hook{incoming} (section~\ref{sec:hook:incoming}), ,
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
2197 %\hook{pretxnchangegroup} (section~\ref{sec:hook:pretxnchangegroup})
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
2198
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
2199 $B;29M!'(B \hook{changegroup} (\ref{sec:hook:changegroup}$B@a(B)$B!$(B
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
2200 \hook{incoming} (\ref{sec:hook:incoming}$B@a(B)$B!$(B
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
2201 \hook{pretxnchangegroup} (\ref{sec:hook:pretxnchangegroup}$B@a(B)
40
b2fe9964b21b More content for hook reference.
Bryan O'Sullivan <bos@serpentine.com>
parents: 39
diff changeset
2202
374
32c932f185ed - fixed mq.tex a bit.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
2203 %\subsection{\hook{precommit}---before starting to commit a changeset}
32c932f185ed - fixed mq.tex a bit.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
2204 \subsection{\hook{precommit}---$B%A%'%s%8%;%C%H$r%3%_%C%H$9$kA0(B}
40
b2fe9964b21b More content for hook reference.
Bryan O'Sullivan <bos@serpentine.com>
parents: 39
diff changeset
2205 \label{sec:hook:precommit}
b2fe9964b21b More content for hook reference.
Bryan O'Sullivan <bos@serpentine.com>
parents: 39
diff changeset
2206
779
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2207 %This hook is run before Mercurial begins to commit a new changeset.
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2208 %It is run before Mercurial has any of the metadata for the commit,
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2209 %such as the files to be committed, the commit message, or the commit
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2210 %date.
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2211
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2212 $B$3$N%U%C%/$O(BMercurial$B$,?7$7$$%A%'%s%8%;%C%H$r%3%_%C%H$9$kA0$K<B9T$5$l$k!%(B
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2213 $B<B9T$O(BMercurial$B$,%3%_%C%H$5$l$k%U%!%$%kL>!$%3%_%C%H%a%C%;!<%8!$%3%_%C%HF|(B
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2214 $B;~$N$h$&$J%3%_%C%H$N$?$a$N%a%?%G!<%?$r;}$DA0$G$"$k!%(B
41
d1a3394f8bcf More hook content.
Bryan O'Sullivan <bos@serpentine.com>
parents: 40
diff changeset
2215
779
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2216 %One use for this hook is to disable the ability to commit new
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2217 %changesets, while still allowing incoming changesets. Another is to
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2218 %run a build or test, and only allow the commit to begin if the build
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2219 %or test succeeds.
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2220
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2221 $B$3$N%U%C%/$r;H$C$F!$30It$+$i$N%A%'%s%8%;%C%H$N<h$j9~$_$r5v2D$9$k0lJ}$G!$(B
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2222 $B?7$7$$%A%'%s%8%;%C%H$r%3%_%C%H$G$-$J$$$h$&$K$9$k$3$H$b$G$-$k!%$^$?!$%S%k(B
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2223 $B%I$d%F%9%H$r<B9T$7$?$j!$$=$l$,@.8y$7$?;~$N$_%3%_%C%H$r9T$&$h$&$K$9$k$3$H(B
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2224 $B$b$G$-$k!%(B
40
b2fe9964b21b More content for hook reference.
Bryan O'Sullivan <bos@serpentine.com>
parents: 39
diff changeset
2225
779
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2226 %Parameters to this hook:
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2227 $B$3$N%U%C%/$X$N%Q%i%a!<%?!'(B
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2228 %\begin{itemize}
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2229 %\item[\texttt{parent1}] A changeset ID. The changeset ID of the first
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2230 % parent of the working directory.
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2231 %\item[\texttt{parent2}] A changeset ID. The changeset ID of the second
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2232 % parent of the working directory.
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2233 %\end{itemize}
39
576fef93bb49 Further content for hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 38
diff changeset
2234 \begin{itemize}
779
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2235 \item[\texttt{parent1}] $B%A%'%s%8%;%C%H(BID$B!%%o!<%-%s%0%G%#%l%/%H%j$N(B1$B$DL\$N(B
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2236 $B?F$N%A%'%s%8%;%C%H(BID$B!%(B
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2237 \item[\texttt{parent2}] $B%A%'%s%8%;%C%H(BID$B!%%o!<%-%s%0%G%#%l%/%H%j$N(B2$B$DL\$N(B
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2238 $B?F$N%A%'%s%8%;%C%H(BID$B!%(B
40
b2fe9964b21b More content for hook reference.
Bryan O'Sullivan <bos@serpentine.com>
parents: 39
diff changeset
2239 \end{itemize}
779
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2240 %If the commit proceeds, the parents of the working directory will
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2241 %become the parents of the new changeset.
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2242
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2243 $B%3%_%C%H$,?J9T$9$k$H%o!<%-%s%0%G%#%l%/%H%j$N?F$O?7$7$$%A%'%s%8%;%C%H$N?F(B
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2244 $B$H$J$k!%(B
40
b2fe9964b21b More content for hook reference.
Bryan O'Sullivan <bos@serpentine.com>
parents: 39
diff changeset
2245
779
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2246 %See also: \hook{commit} (section~\ref{sec:hook:commit}),
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2247 %\hook{pretxncommit} (section~\ref{sec:hook:pretxncommit})
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2248
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2249 $B;29M!'(B\hook{commit} (\ref{sec:hook:commit}$B@a(B)$B!$(B\hook{pretxncommit}
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2250 (\ref{sec:hook:pretxncommit}$B@a(B)
40
b2fe9964b21b More content for hook reference.
Bryan O'Sullivan <bos@serpentine.com>
parents: 39
diff changeset
2251
374
32c932f185ed - fixed mq.tex a bit.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
2252 %\subsection{\hook{preoutgoing}---before starting to propagate
32c932f185ed - fixed mq.tex a bit.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
2253 %changesets}
32c932f185ed - fixed mq.tex a bit.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
2254 \subsection{\hook{preoutgoing}---$B%A%'%s%8%;%C%H$rGH5Z$5$;$kA0$K(B}
40
b2fe9964b21b More content for hook reference.
Bryan O'Sullivan <bos@serpentine.com>
parents: 39
diff changeset
2255 \label{sec:hook:preoutgoing}
b2fe9964b21b More content for hook reference.
Bryan O'Sullivan <bos@serpentine.com>
parents: 39
diff changeset
2256
779
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2257 %This hook is invoked before Mercurial knows the identities of the
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2258 %changesets to be transmitted.
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2259
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2260 $B$3$N%U%C%/$O(BMercurial$B$,Aw?.$9$k%A%'%s%8%;%C%H$r<1JL$9$kA0$K<B9T$5$l$k!%(B
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2261
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2262 %One use for this hook is to prevent changes from being transmitted to
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2263 %another repository.
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2264
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2265 $B$3$N%U%C%/$rMQ$$$F!$B>$N%j%]%8%H%j$XJQ99$rAw?.$7$J$$$h$&$K$9$k$3$H$b$G$-(B
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2266 $B$k!%(B
40
b2fe9964b21b More content for hook reference.
Bryan O'Sullivan <bos@serpentine.com>
parents: 39
diff changeset
2267
779
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2268 %Parameters to this hook:
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2269 $B$3$N%U%C%/$X$N%Q%i%a!<%?!'(B
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2270 %\begin{itemize}
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2271 %\item[\texttt{source}] A string. The source of the operation that is
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2272 % attempting to obtain changes from this repository (see
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2273 % section~\ref{sec:hook:sources}). See the documentation for the
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2274 % \texttt{source} parameter to the \hook{outgoing} hook, in
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2275 % section~\ref{sec:hook:outgoing}, for possible values of this
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2276 % parameter.
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2277 %\item[\texttt{url}] A URL. The location of the remote repository, if
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2278 % known. See section~\ref{sec:hook:url} for more information.
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2279 %\end{itemize}
40
b2fe9964b21b More content for hook reference.
Bryan O'Sullivan <bos@serpentine.com>
parents: 39
diff changeset
2280 \begin{itemize}
779
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2281 \item[\texttt{source}] $BJ8;zNs!%$3$N%j%]%8%H%j$+$iJQ99$r<hF@$7$h$&$H$9$kF0(B
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2282 $B:n$N%=!<%9!J(B\ref{sec:hook:sources}$B$r;2>H!K!%$3$N%Q%i!<%a%?$,(B
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2283 $B<h$jF@$kCM$K$D$$$F$O!$(B \ref{sec:hook:outgoing}$B@a$N(B
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2284 \hook{outgoing}$B%U%C%/$X$N(B\texttt{source}$B%Q%i%a!<%?$N9`L\$r;2(B
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2285 $B>H$N$3$H!%(B
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2286 \item[\texttt{url}] URL$B!%%j%b!<%H%j%]%8%H%j$,FCDj$G$-$k>l9g$O$=$N%"%I%l(B
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2287 $B%9!%>\:Y$K$D$$$F$O(B\ref{sec:hook:url}$B$r;2>H$N$3$H!%(B
40
b2fe9964b21b More content for hook reference.
Bryan O'Sullivan <bos@serpentine.com>
parents: 39
diff changeset
2288 \end{itemize}
b2fe9964b21b More content for hook reference.
Bryan O'Sullivan <bos@serpentine.com>
parents: 39
diff changeset
2289
779
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2290 %See also: \hook{outgoing} (section~\ref{sec:hook:outgoing})
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2291 $B;29M!'(B \hook{outgoing} (\ref{sec:hook:outgoing}$B@a(B)
40
b2fe9964b21b More content for hook reference.
Bryan O'Sullivan <bos@serpentine.com>
parents: 39
diff changeset
2292
374
32c932f185ed - fixed mq.tex a bit.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
2293 %\subsection{\hook{pretag}---before tagging a changeset}
32c932f185ed - fixed mq.tex a bit.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
2294 \subsection{\hook{pretag}---$B%A%'%s%8%;%C%H$K%?%0$r$D$1$kA0$K(B}
40
b2fe9964b21b More content for hook reference.
Bryan O'Sullivan <bos@serpentine.com>
parents: 39
diff changeset
2295 \label{sec:hook:pretag}
b2fe9964b21b More content for hook reference.
Bryan O'Sullivan <bos@serpentine.com>
parents: 39
diff changeset
2296
779
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2297 %This controlling hook is run before a tag is created. If the hook
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2298 %succeeds, creation of the tag proceeds. If the hook fails, the tag is
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2299 %not created.
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2300
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2301 $B$3$N@)8f%U%C%/$O%?%0$,:n@.$5$l$kA0$K<B9T$5$l$k!%%U%C%/$N<B9T$,@.8y$7$?>l(B
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2302 $B9g$O%?%0$,:n@.$5$l$k!%%U%C%/$N<B9T$,<:GT$7$?>l9g$O%?%0$O:n@.$5$l$J$$!%(B
41
d1a3394f8bcf More hook content.
Bryan O'Sullivan <bos@serpentine.com>
parents: 40
diff changeset
2303
779
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2304 %Parameters to this hook:
780
2a93b1d35990 finished hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 779
diff changeset
2305 $B$3$N%U%C%/$X$N%Q%i%a!<%?!'(B
779
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2306 %\begin{itemize}
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2307 %\item[\texttt{local}] A boolean. Whether the tag is local to this
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2308 % repository instance (i.e.~stored in \sfilename{.hg/localtags}) or
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2309 % managed by Mercurial (stored in \sfilename{.hgtags}).
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2310 %\item[\texttt{node}] A changeset ID. The ID of the changeset to be tagged.
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2311 %\item[\texttt{tag}] A string. The name of the tag to be created.
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2312 %\end{itemize}
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2313
40
b2fe9964b21b More content for hook reference.
Bryan O'Sullivan <bos@serpentine.com>
parents: 39
diff changeset
2314 \begin{itemize}
779
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2315 \item[\texttt{local}] $B%V!<%kCM!%?7$7$$%?%0$,%j%]%8%H%j%m!<%+%k$J$b$N(B
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2316 (\sfilename{.hg/localtags}$B$KJ]B8$5$l$k(B)$B$+(BMercurial$B$K4IM}(B
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2317 $B$5$l$k$b$N(B(\sfilename{.hgtags}$B$KJ]B8$5$l$k(B)$B$+$r<($9!%(B
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2318 \item[\texttt{node}] $B%A%'%s%8%;%C%H(BID$B!%%?%0IU$1$5$l$k%A%'%s%8%;%C%H$N(BID.
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2319 \item[\texttt{tag}] $BJ8;zNs!%@8@.$5$l$?%?%0$NL>A0!%(B
39
576fef93bb49 Further content for hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 38
diff changeset
2320 \end{itemize}
34
c0979ed1eabd Get started on hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
2321
779
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2322 %If the tag to be created is revision-controlled, the \hook{precommit}
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2323 %and \hook{pretxncommit} hooks (sections~\ref{sec:hook:commit}
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2324 %and~\ref{sec:hook:pretxncommit}) will also be run.
40
b2fe9964b21b More content for hook reference.
Bryan O'Sullivan <bos@serpentine.com>
parents: 39
diff changeset
2325
779
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2326 $B@8@.$5$l$?%?%0$,%j%S%8%g%s%3%s%H%m!<%k$5$l$F$$$k>l9g!$(B\hook{precommit}$B%U%C(B
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2327 $B%/$H(B\hook{pretxncommit}$B%U%C%/(B(\ref{sec:hook:commit}$B@a$*$h$S(B
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2328 \ref{sec:hook:pretxncommit})$B@a(B)$B$NN>J}$,<B9T$5$l$k!%(B
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2329
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2330 %See also: \hook{tag} (section~\ref{sec:hook:tag})
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2331 $B;29M!'(B \hook{tag} (\ref{sec:hook:tag}$B@a(B)
40
b2fe9964b21b More content for hook reference.
Bryan O'Sullivan <bos@serpentine.com>
parents: 39
diff changeset
2332
374
32c932f185ed - fixed mq.tex a bit.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
2333 %\subsection{\hook{pretxnchangegroup}---before completing addition of
32c932f185ed - fixed mq.tex a bit.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
2334 %remote changesets}
32c932f185ed - fixed mq.tex a bit.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
2335 \subsection{\hook{pretxnchangegroup}---$B%j%b!<%H%A%'%s%8%;%C%H$NDI2C$r40(B
32c932f185ed - fixed mq.tex a bit.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
2336 $BN;$9$kA0$K(B}
40
b2fe9964b21b More content for hook reference.
Bryan O'Sullivan <bos@serpentine.com>
parents: 39
diff changeset
2337 \label{sec:hook:pretxnchangegroup}
b2fe9964b21b More content for hook reference.
Bryan O'Sullivan <bos@serpentine.com>
parents: 39
diff changeset
2338
779
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2339 %This controlling hook is run before a transaction---that manages the
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2340 %addition of a group of new changesets from outside the
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2341 %repository---completes. If the hook succeeds, the transaction
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2342 %completes, and all of the changesets become permanent within this
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2343 %repository. If the hook fails, the transaction is rolled back, and
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2344 %the data for the changesets is erased.
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2345
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2346 $B$3$N@)8f%U%C%/$O!$30It$+$i?7$7$$%A%'%s%8%;%C%H$rDI2C$9$k%H%i%s%6%/%7%g%s(B
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2347 $B$,40N;$9$kA0$K<B9T$5$l$k!%%U%C%/$N<B9T$,@.8y$7$?>l9g!$%H%i%s%6%/%7%g%s$O(B
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2348 $B40N;$7!$A4$F$N%A%'%s%8%;%C%H$O%j%]%8%H%jFb$G1JB3E*$K$J$k!%%U%C%/$N<B9T$,(B
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2349 $B<:GT$7$?>l9g!$%H%i%s%6%/%7%g%s$O%m!<%k%P%C%/$5$l!$%A%'%s%8%;%C%H$N%G!<%?(B
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2350 $B$O>C5n$5$l$k!%(B
41
d1a3394f8bcf More hook content.
Bryan O'Sullivan <bos@serpentine.com>
parents: 40
diff changeset
2351
779
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2352 %This hook can access the metadata associated with the almost-added
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2353 %changesets, but it should not do anything permanent with this data.
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2354 %It must also not modify the working directory.
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2355
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2356 $B$3$N%U%C%/$O%H%i%s%6%/%7%g%sCf$N%A%'%s%8%;%C%H$N%a%?%G!<%?$K%"%/%;%9$9$k(B
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2357 $B$3$H$,$G$-$k$,!$$3$N%G!<%?$r;H$C$F1JB3E*$J$3$H$O0l@Z$7$F$O$J$i$J$$!%%o!<(B
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2358 $B%-%s%0%G%#%l%/%H%j$NJQ99$b$7$F$O$J$i$J$$!%(B
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2359
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2360 %While this hook is running, if other Mercurial processes access this
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2361 %repository, they will be able to see the almost-added changesets as if
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2362 %they are permanent. This may lead to race conditions if you do not
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2363 %take steps to avoid them.
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2364
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2365 $B$3$N%U%C%/$N<B9TCf!$B>$N(BMercurial$B%W%m%;%9$,%j%]%8%H%j$K%"%/%;%9$9$k$H!$%H(B
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2366 $B%i%s%6%/%7%g%sCf$N%A%'%s%8%;%C%H$r1JB3E*$J$b$N$H8+$J$92DG=@-$,$"$k!%E,@Z(B
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2367 $B$J2sHr:v$r9V$8$J$1$l$P!$$3$l$,6%9g>uBV$r0z$-5/$3$92DG=@-$,$"$k!%(B
41
d1a3394f8bcf More hook content.
Bryan O'Sullivan <bos@serpentine.com>
parents: 40
diff changeset
2368
779
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2369 %This hook can be used to automatically vet a group of changesets. If
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2370 %the hook fails, all of the changesets are ``rejected'' when the
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2371 %transaction rolls back.
41
d1a3394f8bcf More hook content.
Bryan O'Sullivan <bos@serpentine.com>
parents: 40
diff changeset
2372
779
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2373 $B$3$N%U%C%/$O0lO"$N%A%'%s%8%;%C%H$r<+F0E*$KGS=|$9$k$?$a$K;H$&$3$H$b$G$-(B
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2374 $B$k!%$3$N%U%C%/$N<B9T$,<:GT$7$?>l9g!$%H%i%s%6%/%7%g%s$,%m!<%k%P%C%/$5$l$k(B
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2375 $B;~$K%A%'%s%8%;%C%HA4BN$,%j%8%'%/%H$5$l$k!%(B
41
d1a3394f8bcf More hook content.
Bryan O'Sullivan <bos@serpentine.com>
parents: 40
diff changeset
2376
779
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2377 %Parameters to this hook:
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2378 %\begin{itemize}
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2379 %\item[\texttt{node}] A changeset ID. The changeset ID of the first
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2380 % changeset in the group that was added. All changesets between this
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2381 % and \index{tags!\texttt{tip}}\texttt{tip}, inclusive, were added by
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2382 % a single \hgcmd{pull}, \hgcmd{push} or \hgcmd{unbundle}.
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2383 %\item[\texttt{source}] A string. The source of these changes. See
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2384 % section~\ref{sec:hook:sources} for details.
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2385 %\item[\texttt{url}] A URL. The location of the remote repository, if
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2386 % known. See section~\ref{sec:hook:url} for more information.
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2387 %\end{itemize}
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2388
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2389 $B$3$N%U%C%/$X$N%Q%i%a!<%?!'(B
62
8806b2875f10 Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 54
diff changeset
2390 \begin{itemize}
779
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2391 \item[\texttt{node}] $B%A%'%s%8%;%C%H(BID$B!%DI2C$5$l$k0lO"$N%A%'%s%8%;%C%H$N(B
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2392 $B$&$A!$:G=i$N%A%'%s%8%;%C%H(BID$B!%$3$l$H(B
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2393 \index{tags!\texttt{tip}}\texttt{tip}$B$N4V$NA4$F$N%A%'%s%8%;%C(B
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2394 $B%H$,0lEY$N(B\hgcmd{pull}, \hgcmd{push} $B$^$?$O(B
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2395 \item[\texttt{source}] $BJ8;zNs!%$3$l$i$NJQ99$N%=!<%9!%>\:Y$K$D$$$F$O(B
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2396 \ref{sec:hook:sources}$B@a$r;2>H$N$3$H!%(B
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2397 \item[\texttt{url}] URL$B!%4{CN$N%j%b!<%H%j%]%8%H%j$N>l=j!%>\:Y$K$D$$$F$O(B
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2398 \ref{sec:hook:url}$B@a$r;2>H$N$3$H!%(B
62
8806b2875f10 Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 54
diff changeset
2399 \end{itemize}
40
b2fe9964b21b More content for hook reference.
Bryan O'Sullivan <bos@serpentine.com>
parents: 39
diff changeset
2400
779
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2401 %See also: \hook{changegroup} (section~\ref{sec:hook:changegroup}),
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2402 %\hook{incoming} (section~\ref{sec:hook:incoming}),
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2403 %\hook{prechangegroup} (section~\ref{sec:hook:prechangegroup})
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2404
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2405 $B;29M!'(B \hook{changegroup} (\ref{sec:hook:changegroup}$B@a(B),
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2406 \hook{incoming} (\ref{sec:hook:incoming}$B@a(B),
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2407 \hook{prechangegroup} (\ref{sec:hook:prechangegroup}$B@a(B)
40
b2fe9964b21b More content for hook reference.
Bryan O'Sullivan <bos@serpentine.com>
parents: 39
diff changeset
2408
374
32c932f185ed - fixed mq.tex a bit.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
2409 %\subsection{\hook{pretxncommit}---before completing commit of new
32c932f185ed - fixed mq.tex a bit.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
2410 %changeset}
32c932f185ed - fixed mq.tex a bit.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
2411 \subsection{\hook{pretxncommit}---$B?7$7$$%A%'%s%8%;%C%H$N%3%_%C%H$r40N;$9(B
32c932f185ed - fixed mq.tex a bit.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
2412 $B$kA0$K(B}
40
b2fe9964b21b More content for hook reference.
Bryan O'Sullivan <bos@serpentine.com>
parents: 39
diff changeset
2413 \label{sec:hook:pretxncommit}
b2fe9964b21b More content for hook reference.
Bryan O'Sullivan <bos@serpentine.com>
parents: 39
diff changeset
2414
779
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2415 %This controlling hook is run before a transaction---that manages a new
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2416 %commit---completes. If the hook succeeds, the transaction completes
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2417 %and the changeset becomes permanent within this repository. If the
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2418 %hook fails, the transaction is rolled back, and the commit data is
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2419 %erased.
41
d1a3394f8bcf More hook content.
Bryan O'Sullivan <bos@serpentine.com>
parents: 40
diff changeset
2420
779
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2421 $B$3$N@)8f%U%C%/$O?7$?$J%3%_%C%H$N$?$a$N%H%i%s%6%/%7%g%s$N40N;A0$K<B9T$5$l(B
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2422 $B$k!%$3$N%U%C%/$N<B9T$,@.8y$7$?>l9g!$%H%i%s%6%/%7%g%s$,40N;$5$l!$%A%'%s%8(B
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2423 $B%;%C%H$O%j%]%8%H%jFb$G1JB3E*$K$J$k!%%U%C%/$N<B9T$,<:GT$7$?>l9g$O%H%i%s%6(B
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2424 $B%/%7%g%s$O%m!<%k%P%C%/$5$l!$%3%_%C%H%G!<%?$O>C5n$5$l$k!%(B
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2425
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2426 %This hook can access the metadata associated with the almost-new
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2427 %changeset, but it should not do anything permanent with this data. It
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2428 %must also not modify the working directory.
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2429
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2430 $B$3$N%U%C%/$O%H%i%s%6%/%7%g%sCf$N%A%'%s%8%;%C%H$N%a%?%G!<%?$K%"%/%;%9$9$k(B
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2431 $B$3$H$,$G$-$k$,!$$3$N%G!<%?$r;H$C$F1JB3E*$J$3$H$O0l@Z$7$F$O$J$i$J$$!%%o!<(B
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2432 $B%-%s%0%G%#%l%/%H%j$NJQ99$b$7$F$O$J$i$J$$!%(B
41
d1a3394f8bcf More hook content.
Bryan O'Sullivan <bos@serpentine.com>
parents: 40
diff changeset
2433
779
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2434 %While this hook is running, if other Mercurial processes access this
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2435 %repository, they will be able to see the almost-new changeset as if it
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2436 %is permanent. This may lead to race conditions if you do not take
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2437 %steps to avoid them.
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2438
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2439 $B$3$N%U%C%/$N<B9TCf!$B>$N(BMercurial$B%W%m%;%9$,%j%]%8%H%j$K%"%/%;%9$9$k$H!$%H(B
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2440 $B%i%s%6%/%7%g%sCf$N%A%'%s%8%;%C%H$r1JB3E*$J$b$N$H8+$J$92DG=@-$,$"$k!%E,@Z(B
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2441 $B$J2sHr:v$r9V$8$J$1$l$P!$$3$l$,6%9g>uBV$r0z$-5/$3$92DG=@-$,$"$k!%(B
41
d1a3394f8bcf More hook content.
Bryan O'Sullivan <bos@serpentine.com>
parents: 40
diff changeset
2442
779
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2443 %Parameters to this hook:
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2444 %\begin{itemize}
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2445 %\item[\texttt{node}] A changeset ID. The changeset ID of the newly
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2446 % committed changeset.
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2447 %\item[\texttt{parent1}] A changeset ID. The changeset ID of the first
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2448 % parent of the newly committed changeset.
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2449 %\item[\texttt{parent2}] A changeset ID. The changeset ID of the second
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2450 % parent of the newly committed changeset.
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2451 %\end{itemize}
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2452
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2453 $B$3$N%U%C%/$X$N%Q%i%a!<%?!'(B
62
8806b2875f10 Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 54
diff changeset
2454 \begin{itemize}
779
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2455 \item[\texttt{node}] $B%A%'%s%8%;%C%H(BID$B!%?7$?$K$38+$s$H$5$l$?%A%'%s%8%;%C(B
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2456 $B%H$N(BID$B!%(B
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2457 \item[\texttt{parent1}] $B%A%'%s%8%;%C%H(BID$B!%?7$?$K%3%_%C%H$5$l$?%A%'%s%8%;%C(B
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2458 $B%H$N(B1$B$DL\$N?F$N%A%'%s%8%;%C%H(BID$B!%(B
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2459 \item[\texttt{parent2}] $B%A%'%s%8%;%C%H(BID$B!%?7$?$K%3%_%C%H$5$l$?%A%'%s%8%;%C(B
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2460 $B%H$N(B2$B$DL\$N?F$N%A%'%s%8%;%C%H(BID$B!%(B
62
8806b2875f10 Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 54
diff changeset
2461 \end{itemize}
40
b2fe9964b21b More content for hook reference.
Bryan O'Sullivan <bos@serpentine.com>
parents: 39
diff changeset
2462
779
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2463 %See also: \hook{precommit} (section~\ref{sec:hook:precommit})
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2464 $B;29M!'(B\hook{precommit} (\ref{sec:hook:precommit}$B@a(B)
40
b2fe9964b21b More content for hook reference.
Bryan O'Sullivan <bos@serpentine.com>
parents: 39
diff changeset
2465
374
32c932f185ed - fixed mq.tex a bit.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
2466 %\subsection{\hook{preupdate}---before updating or merging working
32c932f185ed - fixed mq.tex a bit.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
2467 %directory}
32c932f185ed - fixed mq.tex a bit.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
2468 \subsection{\hook{preupdate}---$B%o!<%-%s%0%G%#%l%/%H%j$N%"%C%W%G!<%H$^$?(B
32c932f185ed - fixed mq.tex a bit.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
2469 $B$O%^!<%8$NA0$K(B}
40
b2fe9964b21b More content for hook reference.
Bryan O'Sullivan <bos@serpentine.com>
parents: 39
diff changeset
2470 \label{sec:hook:preupdate}
b2fe9964b21b More content for hook reference.
Bryan O'Sullivan <bos@serpentine.com>
parents: 39
diff changeset
2471
779
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2472 %This controlling hook is run before an update or merge of the working
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2473 %directory begins. It is run only if Mercurial's normal pre-update
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2474 %checks determine that the update or merge can proceed. If the hook
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2475 %succeeds, the update or merge may proceed; if it fails, the update or
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2476 %merge does not start.
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2477
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2478 $B$3$N@)8f%U%C%/$O%o!<%-%s%0%G%#%l%/%H%j$N%"%C%W%G!<%H$^$?$O%^!<%8$,;O$^$k(B
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2479 $BA0$K<B9T$5$l$k!%(B Mercurial$B$NDL>o$N%"%C%W%G!<%HA0%A%'%C%/$,%"%C%W%G!<%H$^(B
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2480 $B$?$O%^!<%8$r<B9T$G$-$k$HH=CG$7$?>l9g$K$N$_<B9T$5$l$k!%%U%C%/$N<B9T$,@.8y(B
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2481 $B$7$?>l9g!$%"%C%W%G!<%H$^$?$O%^!<%8$,9T$o$l$k!%<:GT$7$?>l9g$O%"%C%W%G!<%H(B
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2482 $B$^$?$O%^!<%8$O3+;O$5$l$J$$!%(B
41
d1a3394f8bcf More hook content.
Bryan O'Sullivan <bos@serpentine.com>
parents: 40
diff changeset
2483
779
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2484 %Parameters to this hook:
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2485 %\begin{itemize}
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2486 %\item[\texttt{parent1}] A changeset ID. The ID of the parent that the
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2487 % working directory is to be updated to. If the working directory is
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2488 % being merged, it will not change this parent.
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2489 %\item[\texttt{parent2}] A changeset ID. Only set if the working
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2490 % directory is being merged. The ID of the revision that the working
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2491 % directory is being merged with.
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2492 %\end{itemize}
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2493
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2494 $B$3$N%U%C%/$X$N%Q%i%a!<%?!'(B
40
b2fe9964b21b More content for hook reference.
Bryan O'Sullivan <bos@serpentine.com>
parents: 39
diff changeset
2495 \begin{itemize}
779
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2496 \item[\texttt{parent1}] $B%A%'%s%8%;%C%H(BID$B!%%o!<%-%s%0%G%#%l%/%H%j$,%"%C%W(B
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2497 $B%G!<%H$5$l$k?F(BID.$B%o!<%-%s%0%G%#%l%/%H%j$,%^!<%8$5$l$k>l9g!$(B
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2498 $B?F(BID$B$OJQ99$5$l$J$$!%(B
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2499 \item[\texttt{parent2}] $B%A%'%s%8%;%C%H(BID$B!%%o!<%-%s%0%G%#%l%/%H%j$,%^!<%8(B
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2500 $B$5$l$k>l9g$N$_%;%C%H$5$l$k!%%o!<%-%s%0%G%#%l%/%H%j$,%^!<%8(B
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2501 $B$5$l$k%j%S%8%g%s(BID$B!%(B
40
b2fe9964b21b More content for hook reference.
Bryan O'Sullivan <bos@serpentine.com>
parents: 39
diff changeset
2502 \end{itemize}
b2fe9964b21b More content for hook reference.
Bryan O'Sullivan <bos@serpentine.com>
parents: 39
diff changeset
2503
779
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2504 %See also: \hook{update} (section~\ref{sec:hook:update})
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2505
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2506 $B;29M!'(B \hook{update} (\ref{sec:hook:update}$B@a(B)
40
b2fe9964b21b More content for hook reference.
Bryan O'Sullivan <bos@serpentine.com>
parents: 39
diff changeset
2507
374
32c932f185ed - fixed mq.tex a bit.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
2508 %\subsection{\hook{tag}---after tagging a changeset}
32c932f185ed - fixed mq.tex a bit.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
2509 \subsection{\hook{tag}---$B%A%'%s%8%;%C%H$K%?%0IU$1$7$?8e$K(B}
40
b2fe9964b21b More content for hook reference.
Bryan O'Sullivan <bos@serpentine.com>
parents: 39
diff changeset
2510 \label{sec:hook:tag}
b2fe9964b21b More content for hook reference.
Bryan O'Sullivan <bos@serpentine.com>
parents: 39
diff changeset
2511
779
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2512 %This hook is run after a tag has been created.
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2513 $B$3$N%U%C%/$O%?%0$,@8@.$5$l$?8e$K<B9T$5$l$k!%(B
41
d1a3394f8bcf More hook content.
Bryan O'Sullivan <bos@serpentine.com>
parents: 40
diff changeset
2514
779
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2515 %Parameters to this hook:
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2516 %\begin{itemize}
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2517 %\item[\texttt{local}] A boolean. Whether the new tag is local to this
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2518 % repository instance (i.e.~stored in \sfilename{.hg/localtags}) or
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2519 % managed by Mercurial (stored in \sfilename{.hgtags}).
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2520 %\item[\texttt{node}] A changeset ID. The ID of the changeset that was
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2521 % tagged.
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2522 %\item[\texttt{tag}] A string. The name of the tag that was created.
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2523 %\end{itemize}
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2524
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2525 $B$3$N%U%C%/$X$N%Q%i%a!<%?!'(B
62
8806b2875f10 Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 54
diff changeset
2526 \begin{itemize}
779
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2527 \item[\texttt{local}] $B%V!<%kCM!%?7$7$$%?%0$,%j%]%8%H%j%m!<%+%k$J$b$N(B
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2528 (\sfilename{.hg/localtags}$B$KJ]B8$5$l$k(B)$B$+(BMercurial$B$K4IM}(B
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2529 $B$5$l$k$b$N(B(\sfilename{.hgtags}$B$KJ]B8$5$l$k(B)$B$+$r<($9!%(B
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2530 \item[\texttt{node}] $B%A%'%s%8%;%C%H(BID$B!%%?%0IU$1$5$l$k%A%'%s%8%;%C%H$N(BID.
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2531 \item[\texttt{tag}] $BJ8;zNs!%@8@.$5$l$?%?%0$NL>A0!%(B
62
8806b2875f10 Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents: 54
diff changeset
2532 \end{itemize}
40
b2fe9964b21b More content for hook reference.
Bryan O'Sullivan <bos@serpentine.com>
parents: 39
diff changeset
2533
779
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2534 %If the created tag is revision-controlled, the \hook{commit} hook
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2535 %(section~\ref{sec:hook:commit}) is run before this hook.
40
b2fe9964b21b More content for hook reference.
Bryan O'Sullivan <bos@serpentine.com>
parents: 39
diff changeset
2536
779
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2537 $B@8@.$5$l$?%?%0$,%j%S%8%g%s%3%s%H%m!<%k$5$l$F$$$k>l9g!$(B\hook{commit}$B%U%C(B
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2538 $B%/(B(\ref{sec:hook:commit}$B@a(B)$B$O$3$N%U%C%/$NA0$K<B9T$5$l$k!%(B
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2539
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2540 %See also: \hook{pretag} (section~\ref{sec:hook:pretag})
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2541
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2542 $B;29M!'(B \hook{pretag} (\ref{sec:hook:pretag}$B@a(B)
40
b2fe9964b21b More content for hook reference.
Bryan O'Sullivan <bos@serpentine.com>
parents: 39
diff changeset
2543
374
32c932f185ed - fixed mq.tex a bit.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
2544 %\subsection{\hook{update}---after updating or merging working
32c932f185ed - fixed mq.tex a bit.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
2545 %directory}
32c932f185ed - fixed mq.tex a bit.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
2546 \subsection{\hook{update}---$B%o!<%-%s%0%G%#%l%/%H%j$r99?7$^$?$O%^!<%8$7$?(B
32c932f185ed - fixed mq.tex a bit.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
2547 $B8e$K(B}
40
b2fe9964b21b More content for hook reference.
Bryan O'Sullivan <bos@serpentine.com>
parents: 39
diff changeset
2548 \label{sec:hook:update}
b2fe9964b21b More content for hook reference.
Bryan O'Sullivan <bos@serpentine.com>
parents: 39
diff changeset
2549
779
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2550 %This hook is run after an update or merge of the working directory
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2551 %completes. Since a merge can fail (if the external \command{hgmerge}
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2552 %command fails to resolve conflicts in a file), this hook communicates
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2553 %whether the update or merge completed cleanly.
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2554
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2555 $B$3$N%U%C%/$O%o!<%-%s%0%G%#%l%/%H%j$N%"%C%W%G!<%H$^$?$O%^!<%8$,40N;$7$?8e(B
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2556 $B$K<B9T$5$l$k!%%^!<%8$O<:GT$9$k$3$H$b$"$k!J30It$N(B\command{hgmerge}$B%3%^%s%I(B
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2557 $B$O%U%!%$%kFb$N%3%s%U%j%/%H$r2r7h$G$-$J$$$3$H$,$"$k!K$N$G!$$3$N%U%C%/$O%"%C(B
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2558 $B%W%G!<%H$^$?$O%^!<%8$,@5>o$K40N;$7$?$+$I$&$+$rLd$$9g$o$;$k!%(B
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2559
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2560 %\begin{itemize}
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2561 %\item[\texttt{error}] A boolean. Indicates whether the update or
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2562 % merge completed successfully.
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2563 %\item[\texttt{parent1}] A changeset ID. The ID of the parent that the
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2564 % working directory was updated to. If the working directory was
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2565 % merged, it will not have changed this parent.
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2566 %\item[\texttt{parent2}] A changeset ID. Only set if the working
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2567 % directory was merged. The ID of the revision that the working
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2568 % directory was merged with.
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2569 %\end{itemize}
41
d1a3394f8bcf More hook content.
Bryan O'Sullivan <bos@serpentine.com>
parents: 40
diff changeset
2570
40
b2fe9964b21b More content for hook reference.
Bryan O'Sullivan <bos@serpentine.com>
parents: 39
diff changeset
2571 \begin{itemize}
779
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2572 \item[\texttt{error}] $B%V!<%kCM!%%"%C%W%G!<%H$^$?$O%^!<%8$,@5>o$K40N;$7$?(B
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2573 $B$+$I$&$+$r<($9!%(B
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2574 \item[\texttt{parent1}] $B%A%'%s%8%;%C%H(BID$B!%%o!<%-%s%0%G%#%l%/%H%j$,%"%C%W(B
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2575 $B%G!<%H$5$l$k?F(BID$B!%%o!<%-%s%0%G%#%l%/%H%j$,%^!<%8$5$l$k>l9g!$?F(B
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2576 ID$B$OJQ2=$7$J$$!%(Bxxx
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2577 \item[\texttt{parent2}] $B%A%'%s%8%;%C%H(BID$B!%%o!<%-%s%0%G%#%l%/%H%j$,%^!<%8(B
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2578 $B$5$l$k;~$N$_%;%C%H$5$l$k!%%o!<%-%s%0%G%#%l%/%H%j$,%^!<%8$5$l(B
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2579 $B$k%j%S%8%g%s(BID$B!%(B
40
b2fe9964b21b More content for hook reference.
Bryan O'Sullivan <bos@serpentine.com>
parents: 39
diff changeset
2580 \end{itemize}
b2fe9964b21b More content for hook reference.
Bryan O'Sullivan <bos@serpentine.com>
parents: 39
diff changeset
2581
779
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2582 %See also: \hook{preupdate} (section~\ref{sec:hook:preupdate})
69923723e7f9 more hook.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 384
diff changeset
2583 $B;29M(B: \hook{preupdate} (\ref{sec:hook:preupdate}$B@a(B)
40
b2fe9964b21b More content for hook reference.
Bryan O'Sullivan <bos@serpentine.com>
parents: 39
diff changeset
2584
374
32c932f185ed - fixed mq.tex a bit.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
2585 %%% Local Variables:
293
3b1291f24c0d - replaved latex-mode to yatex-mode
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 290
diff changeset
2586 %%% mode: yatex
34
c0979ed1eabd Get started on hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
2587 %%% TeX-master: "00book"
374
32c932f185ed - fixed mq.tex a bit.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
2588 %%% End: