Mercurial > hgbook
comparison ja/hook.tex @ 383:ef0c1fb05c84
more hook.tex
author | Yoshiki Yazawa <yaz@honeyplanet.jp> |
---|---|
date | Fri, 20 Feb 2009 20:24:14 +0900 |
parents | d64d38d2a91a |
children | 93df8137f563 |
comparison
equal
deleted
inserted
replaced
382:d64d38d2a91a | 383:ef0c1fb05c84 |
---|---|
962 $B$9!%(B | 962 $B$9!%(B |
963 | 963 |
964 %\subsubsection{Configuring the \hook{acl} hook} | 964 %\subsubsection{Configuring the \hook{acl} hook} |
965 \subsubsection{\hook{acl}$B%U%C%/$N@_Dj(B} | 965 \subsubsection{\hook{acl}$B%U%C%/$N@_Dj(B} |
966 | 966 |
967 In order to manage incoming changesets, the \hgext{acl} hook must be | 967 %In order to manage incoming changesets, the \hgext{acl} hook must be |
968 used as a \hook{pretxnchangegroup} hook. This lets it see which files | 968 %used as a \hook{pretxnchangegroup} hook. This lets it see which files |
969 are modified by each incoming changeset, and roll back a group of | 969 %are modified by each incoming changeset, and roll back a group of |
970 changesets if they modify ``forbidden'' files. Example: | 970 %changesets if they modify ``forbidden'' files. Example: |
971 %\begin{codesample2} | |
972 % [hooks] | |
973 % pretxnchangegroup.acl = python:hgext.acl.hook | |
974 %\end{codesample2} | |
975 | |
976 \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 | |
977 \hook{pretxnchangegroup}$B%U%C%/$H$7$FMQ$$$kI,MW$,$"$k!%$3$N%U%C%/$O!$3F!9(B | |
978 $B$N%A%'%s%8%;%C%H$G$I$N%U%!%$%k$,JQ99$5$l$?$N$+$r%A%'%C%/$7!$JQ996X;_$N%U%!(B | |
979 $B%$%k$XJQ99$,$"$C$?>l9g$O%A%'%s%8%;%C%H$r%m!<%k%P%C%/$9$k!%Nc!'(B | |
971 \begin{codesample2} | 980 \begin{codesample2} |
972 [hooks] | 981 [hooks] |
973 pretxnchangegroup.acl = python:hgext.acl.hook | 982 pretxnchangegroup.acl = python:hgext.acl.hook |
974 \end{codesample2} | 983 \end{codesample2} |
975 | 984 |
976 The \hgext{acl} extension is configured using three sections. | 985 %The \hgext{acl} extension is configured using three sections. |
977 | 986 |
978 The \rcsection{acl} section has only one entry, \rcitem{acl}{sources}, | 987 \hgext{acl}$B%(%/%9%F%s%7%g%s$O(B3$B$D$N%;%/%7%g%s$G@_Dj$5$l$k!%(B |
979 which lists the sources of incoming changesets that the hook should | 988 |
980 pay attention to. You don't normally need to configure this section. | 989 %The \rcsection{acl} section has only one entry, \rcitem{acl}{sources}, |
981 \begin{itemize} | 990 %which lists the sources of incoming changesets that the hook should |
982 \item[\rcitem{acl}{serve}] Control incoming changesets that are arriving | 991 %pay attention to. You don't normally need to configure this section. |
983 from a remote repository over http or ssh. This is the default | 992 %\begin{itemize} |
984 value of \rcitem{acl}{sources}, and usually the only setting you'll | 993 %\item[\rcitem{acl}{serve}] Control incoming changesets that are arriving |
985 need for this configuration item. | 994 % from a remote repository over http or ssh. This is the default |
986 \item[\rcitem{acl}{pull}] Control incoming changesets that are | 995 % value of \rcitem{acl}{sources}, and usually the only setting you'll |
987 arriving via a pull from a local repository. | 996 % need for this configuration item. |
988 \item[\rcitem{acl}{push}] Control incoming changesets that are | 997 %\item[\rcitem{acl}{pull}] Control incoming changesets that are |
989 arriving via a push from a local repository. | 998 % arriving via a pull from a local repository. |
990 \item[\rcitem{acl}{bundle}] Control incoming changesets that are | 999 %\item[\rcitem{acl}{push}] Control incoming changesets that are |
991 arriving from another repository via a bundle. | 1000 % arriving via a push from a local repository. |
992 \end{itemize} | 1001 %\item[\rcitem{acl}{bundle}] Control incoming changesets that are |
993 | 1002 % arriving from another repository via a bundle. |
994 The \rcsection{acl.allow} section controls the users that are allowed to | 1003 %\end{itemize} |
995 add changesets to the repository. If this section is not present, all | 1004 |
996 users that are not explicitly denied are allowed. If this section is | 1005 \rcsection{acl}$B%;%/%7%g%s$O!$(B\rcitem{acl}{sources}$B$H$$$&%(%s%H%j(B1$B$D$r;}(B |
997 present, all users that are not explicitly allowed are denied (so an | 1006 $B$D!%$3$N%(%s%H%j$G%U%C%/$,4F;k$9$Y$-E~Ce%A%'%s%8%;%C%HFb%=!<%9(B |
998 empty section means that all users are denied). | 1007 $B$rNs5s$9$k!%(B |
999 | 1008 \begin{itemize} |
1000 The \rcsection{acl.deny} section determines which users are denied | 1009 \item[\rcitem{acl}{serve}] $B%j%b!<%H%j%]%8%H%j$+$i(Bhttp$B$^$?$O(Bssh$B$r;H$C$FE~(B |
1001 from adding changesets to the repository. If this section is not | 1010 $BCe$9$k%A%'%s%8%;%C%H$r@)8f$9$k!%(B\rcitem{acl}{sources}$B$N%G%U%)(B |
1002 present or is empty, no users are denied. | 1011 $B%k%HCM$G!$DL>o$O$3$N@_DjFb$GM#0l@_Dj$9$kI,MW$N$"$k9`L\$G$"(B |
1003 | 1012 $B$k!%(B |
1004 The syntaxes for the \rcsection{acl.allow} and \rcsection{acl.deny} | 1013 \item[\rcitem{acl}{pull}] $B%m!<%+%k%j%]%8%H%j$+$i(Bpull$B$7$?%A%'%s%8%;%C%H$r(B |
1005 sections are identical. On the left of each entry is a glob pattern | 1014 $B@)8f$9$k!%(B |
1006 that matches files or directories, relative to the root of the | 1015 \item[\rcitem{acl}{push}] $B%m!<%+%k%j%]%8%H%j$+$i(Bpush$B$7$?%A%'%s%8%;%C%H$r(B |
1007 repository; on the right, a user name. | 1016 $B@)8f$9$k!%(B |
1008 | 1017 \item[\rcitem{acl}{bundle}] $BJL$N%j%]%8%H%j$+$i%P%s%I%k$K$h$C$FE~Ce$7$?%A%'(B |
1009 In the following example, the user \texttt{docwriter} can only push | 1018 $B%s%8%;%C%H$r@)8f$9$k!%(B |
1010 changes to the \dirname{docs} subtree of the repository, while | 1019 \end{itemize} |
1011 \texttt{intern} can push changes to any file or directory except | 1020 |
1012 \dirname{source/sensitive}. | 1021 %The \rcsection{acl.allow} section controls the users that are allowed to |
1022 %add changesets to the repository. If this section is not present, all | |
1023 %users that are not explicitly denied are allowed. If this section is | |
1024 %present, all users that are not explicitly allowed are denied (so an | |
1025 %empty section means that all users are denied). | |
1026 | |
1027 \rcsection{acl.allow}$B%;%/%7%g%s$O%A%'%s%8%;%C%H$N%j%]%8%H%j$X$NDI2C$r5v(B | |
1028 $B2D$5$l$F$$$k%f!<%6$r@_Dj$9$k!%$3$N%;%/%7%g%s$,B8:_$7$J$$>l9g!$L@<(E*$K5q(B | |
1029 $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 | |
1030 $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 | |
1031 $B%7%g%s$O$9$Y$F$N%f!<%6$N5qH]$H$$$&0UL#$K$J$k!%!K(B | |
1032 | |
1033 %The \rcsection{acl.deny} section determines which users are denied | |
1034 %from adding changesets to the repository. If this section is not | |
1035 %present or is empty, no users are denied. | |
1036 | |
1037 \rcsection{acl.deny}$B%;%/%7%g%s$O!$%j%]%8%H%j$X$N%A%'%s%8%;%C%HDI2C$r5qH](B | |
1038 $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 | |
1039 $B$b5qH]$5$l$J$$!%(B | |
1040 | |
1041 %The syntaxes for the \rcsection{acl.allow} and \rcsection{acl.deny} | |
1042 %sections are identical. On the left of each entry is a glob pattern | |
1043 %that matches files or directories, relative to the root of the | |
1044 %repository; on the right, a user name. | |
1045 | |
1046 \rcsection{acl.allow}$B$H(B\rcsection{acl.deny}$B%;%/%7%g%s$N9=J8$OF10l$G$"$k!%(B | |
1047 $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 | |
1048 $B$G!$%j%]%8%H%j%k!<%H$+$i$NAjBP%Q%9$G$"$k!%1&JU$O%f!<%6L>$G$"$k!%(B | |
1049 | |
1050 %In the following example, the user \texttt{docwriter} can only push | |
1051 %changes to the \dirname{docs} subtree of the repository, while | |
1052 %\texttt{intern} can push changes to any file or directory except | |
1053 %\dirname{source/sensitive}. | |
1054 %\begin{codesample2} | |
1055 % [acl.allow] | |
1056 % docs/** = docwriter | |
1057 % | |
1058 % [acl.deny] | |
1059 % source/sensitive/** = intern | |
1060 %\end{codesample2} | |
1061 | |
1062 $B0J2<$NNc$G$O!$(B\texttt{docwriter}$B$H$$$&%f!<%6$O!$%j%]%8%H%j$N(B | |
1063 \dirname{docs}$B%5%V%D%j!<$K$7$+(Bpush$B$G$-$J$$!%$^$?(B\texttt{intern}$B$O(B | |
1064 \dirname{source/sensitive}$B0J30$J$i$P$I$N%G%#%l%/%H%j$N$I$N%U%!%$%k$K$bJQ(B | |
1065 $B99$r(Bpush$B$9$k$3$H$,$G$-$k!%(B | |
1013 \begin{codesample2} | 1066 \begin{codesample2} |
1014 [acl.allow] | 1067 [acl.allow] |
1015 docs/** = docwriter | 1068 docs/** = docwriter |
1016 | 1069 |
1017 [acl.deny] | 1070 [acl.deny] |
1019 \end{codesample2} | 1072 \end{codesample2} |
1020 | 1073 |
1021 %\subsubsection{Testing and troubleshooting} | 1074 %\subsubsection{Testing and troubleshooting} |
1022 \subsubsection{$B%F%9%H$HLdBj2r7h(B} | 1075 \subsubsection{$B%F%9%H$HLdBj2r7h(B} |
1023 | 1076 |
1024 If you want to test the \hgext{acl} hook, run it with Mercurial's | 1077 %If you want to test the \hgext{acl} hook, run it with Mercurial's |
1025 debugging output enabled. Since you'll probably be running it on a | 1078 |
1026 server where it's not convenient (or sometimes possible) to pass in | 1079 %debugging output enabled. Since you'll probably be running it on a |
1027 the \hggopt{--debug} option, don't forget that you can enable | 1080 %server where it's not convenient (or sometimes possible) to pass in |
1028 debugging output in your \hgrc: | 1081 %the \hggopt{--debug} option, don't forget that you can enable |
1082 %debugging output in your \hgrc: | |
1083 %\begin{codesample2} | |
1084 % [ui] | |
1085 % debug = true | |
1086 %\end{codesample2} | |
1087 %With this enabled, the \hgext{acl} hook will print enough information | |
1088 %to let you figure out why it is allowing or forbidding pushes from | |
1089 %specific users. | |
1090 | |
1091 \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 | |
1092 $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 | |
1093 $B%s$rEO$9$N$OITJX$G$"$C$?$j!"IT2DG=$G$"$C$?$j$9$k$3$H$,$"$k!#$3$N$?$a!"%G(B | |
1094 $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 | |
1029 \begin{codesample2} | 1095 \begin{codesample2} |
1030 [ui] | 1096 [ui] |
1031 debug = true | 1097 debug = true |
1032 \end{codesample2} | 1098 \end{codesample2} |
1033 With this enabled, the \hgext{acl} hook will print enough information | 1099 $B%G%P%C%0=PNO$,M-8z$N>l9g!$(B\hgext{acl}$B%U%C%/$O!$FCDj$N%f!<%6$r5v2D$"$k$$(B |
1034 to let you figure out why it is allowing or forbidding pushes from | 1100 $B$O5qH]$7$?M}M3$rCN$k$N$K==J,$J>pJs$r=PNO$9$k!%(B |
1035 specific users. | |
1036 | 1101 |
1037 %\subsection{\hgext{bugzilla}---integration with Bugzilla} | 1102 %\subsection{\hgext{bugzilla}---integration with Bugzilla} |
1038 \subsection{\hgext{bugzilla}---Bugzilla$B$X$NE}9g(B} | 1103 \subsection{\hgext{bugzilla}---Bugzilla$B$H$N7k9g(B} |
1039 | 1104 |
1040 The \hgext{bugzilla} extension adds a comment to a Bugzilla bug | 1105 %The \hgext{bugzilla} extension adds a comment to a Bugzilla bug |
1041 whenever it finds a reference to that bug ID in a commit comment. You | 1106 %whenever it finds a reference to that bug ID in a commit comment. You |
1042 can install this hook on a shared server, so that any time a remote | 1107 %can install this hook on a shared server, so that any time a remote |
1043 user pushes changes to this server, the hook gets run. | 1108 %user pushes changes to this server, the hook gets run. |
1044 | 1109 |
1045 It adds a comment to the bug that looks like this (you can configure | 1110 \hgext{bugzilla}$B%(%/%9%F%s%7%g%s$O!$(BBugzilla$B$G4IM}$5$l$F$$$k%P%0$X!$%3%_%C(B |
1046 the contents of the comment---see below): | 1111 $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 |
1112 $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 | |
1113 $BJQ99$r(Bpush$B$7$?>l9g$K$bF0:n$9$k!%(B | |
1114 | |
1115 %It adds a comment to the bug that looks like this (you can configure | |
1116 %the contents of the comment---see below): | |
1117 %\begin{codesample2} | |
1118 % Changeset aad8b264143a, made by Joe User <joe.user@domain.com> in | |
1119 % the frobnitz repository, refers to this bug. | |
1120 % | |
1121 % For complete details, see | |
1122 % http://hg.domain.com/frobnitz?cmd=changeset;node=aad8b264143a | |
1123 % | |
1124 % Changeset description: | |
1125 % Fix bug 10483 by guarding against some NULL pointers | |
1126 %\end{codesample2} | |
1127 %The value of this hook is that it automates the process of updating a | |
1128 %bug any time a changeset refers to it. If you configure the hook | |
1129 %properly, it makes it easy for people to browse straight from a | |
1130 %Bugzilla bug to a changeset that refers to that bug. | |
1131 | |
1132 $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 | |
1133 $BG=$G$"$k!%$3$l$K$D$$$F$O2<5-$r;2>H!%!K(B | |
1047 \begin{codesample2} | 1134 \begin{codesample2} |
1048 Changeset aad8b264143a, made by Joe User <joe.user@domain.com> in | 1135 Changeset aad8b264143a, made by Joe User <joe.user@domain.com> in |
1049 the frobnitz repository, refers to this bug. | 1136 the frobnitz repository, refers to this bug. |
1050 | 1137 |
1051 For complete details, see | 1138 For complete details, see |
1052 http://hg.domain.com/frobnitz?cmd=changeset;node=aad8b264143a | 1139 http://hg.domain.com/frobnitz?cmd=changeset;node=aad8b264143a |
1053 | 1140 |
1054 Changeset description: | 1141 Changeset description: |
1055 Fix bug 10483 by guarding against some NULL pointers | 1142 Fix bug 10483 by guarding against some NULL pointers |
1056 \end{codesample2} | 1143 \end{codesample2} |
1057 The value of this hook is that it automates the process of updating a | 1144 $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 |
1058 bug any time a changeset refers to it. If you configure the hook | 1145 $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 |
1059 properly, it makes it easy for people to browse straight from a | 1146 $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 |
1060 Bugzilla bug to a changeset that refers to that bug. | 1147 $B$J$k!%(B |
1061 | 1148 |
1062 You can use the code in this hook as a starting point for some more | 1149 %You can use the code in this hook as a starting point for some more |
1063 exotic Bugzilla integration recipes. Here are a few possibilities: | 1150 %exotic Bugzilla integration recipes. Here are a few possibilities: |
1064 \begin{itemize} | 1151 %\begin{itemize} |
1065 \item Require that every changeset pushed to the server have a valid | 1152 %\item Require that every changeset pushed to the server have a valid |
1066 bug~ID in its commit comment. In this case, you'd want to configure | 1153 % bug~ID in its commit comment. In this case, you'd want to configure |
1067 the hook as a \hook{pretxncommit} hook. This would allow the hook | 1154 % the hook as a \hook{pretxncommit} hook. This would allow the hook |
1068 to reject changes that didn't contain bug IDs. | 1155 % to reject changes that didn't contain bug IDs. |
1069 \item Allow incoming changesets to automatically modify the | 1156 %\item Allow incoming changesets to automatically modify the |
1070 \emph{state} of a bug, as well as simply adding a comment. For | 1157 % \emph{state} of a bug, as well as simply adding a comment. For |
1071 example, the hook could recognise the string ``fixed bug 31337'' as | 1158 % example, the hook could recognise the string ``fixed bug 31337'' as |
1072 indicating that it should update the state of bug 31337 to | 1159 % indicating that it should update the state of bug 31337 to |
1073 ``requires testing''. | 1160 % ``requires testing''. |
1161 %\end{itemize} | |
1162 | |
1163 $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 | |
1164 $B$G$"$k!%$$$/$D$+$NNc$r5s$2$k!'(B | |
1165 \begin{itemize} | |
1166 \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 | |
1167 $B$J%P%0(BID$B$,$"$k$3$H$rMW5a$9$k!%$3$N>l9g!$%U%C%/$r(B | |
1168 \hook{pretxncommit}$B%U%C%/$H$7$F@_Dj$9$kI,MW$,$"$k!%$3$l$K$h$C$F!$(B | |
1169 $B%P%0(BID$B$r4^$^$J$$JQ99$r5qH]$9$k$3$H$,$G$-$k!%(B | |
1170 \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 | |
1171 $B%H(B}$B$r<+F0E*$KJQ99$9$k$h$&$K$G$-$k!%Nc$($P!$%U%C%/$,(B``fixed bug | |
1172 31337''$B$N$h$&$JJ8;zNs$rG'<1$7$F!$(Bbug 31337$B$N%9%F!<%H$r(B``requires | |
1173 testing''$B$KJQ99$9$k$J$I$,9M$($i$l$k!%(B | |
1074 \end{itemize} | 1174 \end{itemize} |
1075 | 1175 |
1076 %\subsubsection{Configuring the \hook{bugzilla} hook} | 1176 %\subsubsection{Configuring the \hook{bugzilla} hook} |
1077 \subsubsection{\hook{bugzilla}$B%U%C%/$N@_Dj(B} | 1177 \subsubsection{\hook{bugzilla}$B%U%C%/$N@_Dj(B} |
1078 \label{sec:hook:bugzilla:config} | 1178 \label{sec:hook:bugzilla:config} |
1079 | 1179 |
1080 You should configure this hook in your server's \hgrc\ as an | 1180 %You should configure this hook in your server's \hgrc\ as an |
1081 \hook{incoming} hook, for example as follows: | 1181 %\hook{incoming} hook, for example as follows: |
1182 %\begin{codesample2} | |
1183 % [hooks] | |
1184 % incoming.bugzilla = python:hgext.bugzilla.hook | |
1185 %\end{codesample2} | |
1186 | |
1187 $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 | |
1188 $B$9$Y$-$G$"$k!%(B | |
1082 \begin{codesample2} | 1189 \begin{codesample2} |
1083 [hooks] | 1190 [hooks] |
1084 incoming.bugzilla = python:hgext.bugzilla.hook | 1191 incoming.bugzilla = python:hgext.bugzilla.hook |
1085 \end{codesample2} | 1192 \end{codesample2} |
1086 | 1193 |
1087 Because of the specialised nature of this hook, and because Bugzilla | 1194 %Because of the specialised nature of this hook, and because Bugzilla |
1088 was not written with this kind of integration in mind, configuring | 1195 %was not written with this kind of integration in mind, configuring |
1089 this hook is a somewhat involved process. | 1196 %this hook is a somewhat involved process. |
1090 | 1197 |
1091 Before you begin, you must install the MySQL bindings for Python on | 1198 $B$3$N%U%C%/$NFCJL$J@-<A!$(BBugzilla$B$,$3$N$h$&$J7k9g$rG0F,$K=q$+$l$F$$$J$$$3(B |
1092 the host(s) where you'll be running the hook. If this is not | 1199 $B$H$K$h$C$F!$$3$N%U%C%/$N@_Dj$OJ#;($J%W%m%;%9$H$J$k!%(B |
1093 available as a binary package for your system, you can download it | 1200 |
1094 from~\cite{web:mysql-python}. | 1201 %Before you begin, you must install the MySQL bindings for Python on |
1095 | 1202 %the host(s) where you'll be running the hook. If this is not |
1096 Configuration information for this hook lives in the | 1203 %available as a binary package for your system, you can download it |
1097 \rcsection{bugzilla} section of your \hgrc. | 1204 %from~\cite{web:mysql-python}. |
1098 \begin{itemize} | 1205 |
1099 \item[\rcitem{bugzilla}{version}] The version of Bugzilla installed on | 1206 $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 |
1100 the server. The database schema that Bugzilla uses changes | 1207 $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 |
1101 occasionally, so this hook has to know exactly which schema to use. | 1208 $B$F$$$J$1$l$P!$%=!<%9%U%!%$%k$r(B\cite{web:mysql-python}$B$+$i%@%&%s%m!<%I$9$k(B |
1102 At the moment, the only version supported is \texttt{2.16}. | 1209 $B$3$H$,$G$-$k!%(B |
1103 \item[\rcitem{bugzilla}{host}] The hostname of the MySQL server that | 1210 |
1104 stores your Bugzilla data. The database must be configured to allow | 1211 %Configuration information for this hook lives in the |
1105 connections from whatever host you are running the \hook{bugzilla} | 1212 %\rcsection{bugzilla} section of your \hgrc. |
1106 hook on. | 1213 $B$3$N%U%C%/$N@_Dj>pJs$O!$(B\hgrc $B%U%!%$%k$N(B\rcsection{bugzilla}$B%;%/%7%g%s$K(B |
1107 \item[\rcitem{bugzilla}{user}] The username with which to connect to | 1214 $B$"$k!%(B |
1108 the MySQL server. The database must be configured to allow this | 1215 \begin{itemize} |
1109 user to connect from whatever host you are running the | 1216 %\item[\rcitem{bugzilla}{version}] The version of Bugzilla installed on |
1110 \hook{bugzilla} hook on. This user must be able to access and | 1217 % the server. The database schema that Bugzilla uses changes |
1111 modify Bugzilla tables. The default value of this item is | 1218 % occasionally, so this hook has to know exactly which schema to use. |
1112 \texttt{bugs}, which is the standard name of the Bugzilla user in a | 1219 % At the moment, the only version supported is \texttt{2.16}. |
1113 MySQL database. | 1220 \item[\rcitem{bugzilla}{version}] $B%5!<%P$X%$%s%9%H!<%k$5$l$?(BBugzilla$B$N%P!<(B |
1114 \item[\rcitem{bugzilla}{password}] The MySQL password for the user you | 1221 $B%8%g%s!%(BBugzilla$B$N;HMQ$9$k%G!<%?%Y!<%9$N%9%-!<%^$O;~$KJQ99(B |
1115 configured above. This is stored as plain text, so you should make | 1222 $B$5$l$k$?$a!$%U%C%/$O$I$N%9%-!<%^$,;HMQ$5$l$k$N$+$rCN$kI,MW(B |
1116 sure that unauthorised users cannot read the \hgrc\ file where you | 1223 $B$,$"$k!%8=;~E@$G$O(BBugzilla\texttt{2.16}$B$@$1$,%5%]!<%H$5$l(B |
1117 store this information. | 1224 $B$F$$$k!%(B |
1118 \item[\rcitem{bugzilla}{db}] The name of the Bugzilla database on the | 1225 |
1119 MySQL server. The default value of this item is \texttt{bugs}, | 1226 %\item[\rcitem{bugzilla}{host}] The hostname of the MySQL server that |
1120 which is the standard name of the MySQL database where Bugzilla | 1227 % stores your Bugzilla data. The database must be configured to allow |
1121 stores its data. | 1228 % connections from whatever host you are running the \hook{bugzilla} |
1122 \item[\rcitem{bugzilla}{notify}] If you want Bugzilla to send out a | 1229 % hook on. |
1123 notification email to subscribers after this hook has added a | 1230 \item[\rcitem{bugzilla}{host}] Bugzilla$B%G!<%?$r3JG<$7$F$$$k(BMySQL$B%5!<%P$N(B |
1124 comment to a bug, you will need this hook to run a command whenever | 1231 $B%[%9%H%M!<%`!%%G!<%?%Y!<%9$O(B\hook{bugzilla}$B%U%C%/$r<B9T$9(B |
1125 it updates the database. The command to run depends on where you | 1232 $B$k%[%9%H$+$i@\B32DG=$K@_Dj$5$l$F$$$J$1$l$P$J$i$J$$!%(B |
1126 have installed Bugzilla, but it will typically look something like | 1233 |
1127 this, if you have Bugzilla installed in | 1234 %\item[\rcitem{bugzilla}{user}] The username with which to connect to |
1128 \dirname{/var/www/html/bugzilla}: | 1235 % the MySQL server. The database must be configured to allow this |
1236 % user to connect from whatever host you are running the | |
1237 % \hook{bugzilla} hook on. This user must be able to access and | |
1238 % modify Bugzilla tables. The default value of this item is | |
1239 % \texttt{bugs}, which is the standard name of the Bugzilla user in a | |
1240 % MySQL database. | |
1241 \item[\rcitem{bugzilla}{user}] MySQL$B%5!<%P$K@\B3$9$k%f!<%6L>!%%G!<%?%Y!<(B | |
1242 $B%9$O(B\hook{bugzilla}$B%U%C%/$r<B9T$9$k%[%9%H>e$+$i$3$N%f!<%6$N(B | |
1243 $B@\B3$r5v2D$9$k$h$&$K@_Dj$5$l$F$$$J$1$l$P$J$i$J$$!%$3$N%f!<(B | |
1244 $B%6$O(BBugzilla$B%F!<%V%k$K%"%/%;%9$7!$JQ99$G$-$k8"8B$,$J$1$l$P(B | |
1245 $B$J$i$J$$!%$3$N9`L\$N%G%U%)%k%HCM$O(BMySQL$B%G!<%?%Y!<%9$G$N(B | |
1246 Bugzilla$B%f!<%6$NI8=`L>(B\texttt{bugs}$B$G$"$k!%(B | |
1247 | |
1248 %\item[\rcitem{bugzilla}{password}] The MySQL password for the user you | |
1249 % configured above. This is stored as plain text, so you should make | |
1250 % sure that unauthorised users cannot read the \hgrc\ file where you | |
1251 % store this information. | |
1252 \item[\rcitem{bugzilla}{password}] $B>e5-$N%f!<%6$N(BMySQL$B%Q%9%o!<%I!%J?J8$G(B | |
1253 $BJ]B8$5$l$k$?$a!$8"8B$N$J$$%f!<%6$,$3$N(B\hgrc\ $B%U%!%$%k$r3N<B(B | |
1254 $B$KFI$a$J$$$h$&$K$7$F$*$/I,MW$,$"$k!%(B | |
1255 | |
1256 %\item[\rcitem{bugzilla}{db}] The name of the Bugzilla database on the | |
1257 % MySQL server. The default value of this item is \texttt{bugs}, | |
1258 % which is the standard name of the MySQL database where Bugzilla | |
1259 % stores its data. | |
1260 \item[\rcitem{bugzilla}{db}] MySQL$B%5!<%P>e$N(BBugzilla$B%G!<%?%Y!<%9$NL>A0!%(B | |
1261 $B$3$N9`L\$N%G%U%)%k%HCM$O(B\texttt{bugs}$B$3$N9`L\$N%G%U%)%k%HCM(B | |
1262 $B$O(BBugzilla$B$,%G!<%?$rJ]B8$9$k(BMySQL$B%G!<%?%Y!<%9$NI8=`L>(B | |
1263 \texttt{bugs}$B$G$"$k!%(B | |
1264 | |
1265 %\item[\rcitem{bugzilla}{notify}] If you want Bugzilla to send out a | |
1266 % notification email to subscribers after this hook has added a | |
1267 % comment to a bug, you will need this hook to run a command whenever | |
1268 % it updates the database. The command to run depends on where you | |
1269 | |
1270 % have installed Bugzilla, but it will typically look something like | |
1271 % this, if you have Bugzilla installed in | |
1272 % \dirname{/var/www/html/bugzilla}: | |
1273 % \begin{codesample4} | |
1274 % cd /var/www/html/bugzilla && ./processmail %s nobody@nowhere.com | |
1275 % \end{codesample4} | |
1276 % The Bugzilla \texttt{processmail} program expects to be given a | |
1277 % bug~ID (the hook replaces ``\texttt{\%s}'' with the bug~ID) and an | |
1278 % email address. It also expects to be able to write to some files in | |
1279 % the directory that it runs in. If Bugzilla and this hook are not | |
1280 % installed on the same machine, you will need to find a way to run | |
1281 % \texttt{processmail} on the server where Bugzilla is installed. | |
1282 \item[\rcitem{bugzilla}{notify}] $B%U%C%/$+$i%P%0$K%3%a%s%H$,DI2C$5$l$?;~!$(B | |
1283 Bugzilla$B$+$i9VFI<T$KDLCN%a!<%k(B | |
1284 $B$,Aw$i$l$k$h$&$K$7$?$$>l9g$O!$%U%C%/$,%G!<%?%Y!<%9$r99?7$7(B | |
1285 $B$?>l9g$O>o$K%3%^%s%I$,<B9T$5$l$k$h$&$K@_Dj$7$J$1$l$P$J$i$J(B | |
1286 $B$$!%<B9T$9$k%3%^%s%I$O!$(BBugzilla$B$r$I$3$K%$%s%9%H!<%k$7$?$+$K(B | |
1287 $B0MB8$9$k!%(BBugzilla$B$r(B\dirname{/var/www/html/bugzilla}$B$K%$%s(B | |
1288 $B%9%H!<%k$7$?>l9g!$E57?E*$J%3%^%s%I$O<!$N$h$&$K$J$k!'(B | |
1129 \begin{codesample4} | 1289 \begin{codesample4} |
1130 cd /var/www/html/bugzilla && ./processmail %s nobody@nowhere.com | 1290 cd /var/www/html/bugzilla && ./processmail %s nobody@nowhere.com |
1131 \end{codesample4} | 1291 \end{codesample4} |
1132 The Bugzilla \texttt{processmail} program expects to be given a | 1292 Bugzilla \texttt{processmail}$B%W%m%0%i%`$O(Bbug~ID ($B%U%C%/$,(B |
1133 bug~ID (the hook replaces ``\texttt{\%s}'' with the bug~ID) and an | 1293 ``\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 |
1134 email address. It also expects to be able to write to some files in | 1294 $B%`$O$^$?<B9T$5$l$k%G%#%l%/%H%jFb$G$$$/$D$+$N%U%!%$%k$X=q$-9~$_$rI,MW$H$9(B |
1135 the directory that it runs in. If Bugzilla and this hook are not | 1295 $B$k!%(BBugzilla$B$H%U%C%/$,F1$8%^%7%s>e$K%$%s%9%H!<%k$5$l$F$$$J$$>l9g!$(B |
1136 installed on the same machine, you will need to find a way to run | 1296 Bugzilla$B$,%$%s%9%H!<%k$5$l$?%5!<%P>e$G(B\texttt{processmail}$B$r<B9T$9$kJ}K!(B |
1137 \texttt{processmail} on the server where Bugzilla is installed. | 1297 $B$r8+$D$1$kI,MW$,$"$k!%(B |
1138 \end{itemize} | 1298 \end{itemize} |
1139 | 1299 |
1140 %\subsubsection{Mapping committer names to Bugzilla user names} | 1300 %\subsubsection{Mapping committer names to Bugzilla user names} |
1141 \subsubsection{$B%3%_%C%H<T$NL>A0$r(BBugzilla$B$N%f!<%6L>$X%^%C%W$9$k(B} | 1301 \subsubsection{$B%3%_%C%H<T$NL>A0$r(BBugzilla$B$N%f!<%6L>$X%^%C%W$9$k(B} |
1142 | 1302 |
1143 By default, the \hgext{bugzilla} hook tries to use the email address | 1303 %By default, the \hgext{bugzilla} hook tries to use the email address |
1144 of a changeset's committer as the Bugzilla user name with which to | 1304 %of a changeset's committer as the Bugzilla user name with which to |
1145 update a bug. If this does not suit your needs, you can map committer | 1305 %update a bug. If this does not suit your needs, you can map committer |
1146 email addresses to Bugzilla user names using a \rcsection{usermap} | 1306 %email addresses to Bugzilla user names using a \rcsection{usermap} |
1147 section. | 1307 %section. |
1148 | 1308 |
1149 Each item in the \rcsection{usermap} section contains an email address | 1309 $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 |
1150 on the left, and a Bugzilla user name on the right. | 1310 $B$F%A%'%s%8%;%C%H$N%3%_%C%?$N(Bemail$B%"%I%l%9$r;H$*$&$H$9$k!%(B |
1311 $B$3$N5sF0$,K>$^$7$/$J$$>l9g$O!$(B\rcsection{usermap}$B%;%/%7%g%s$r$;$C$F$$$9$k(B | |
1312 $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 | |
1313 | |
1314 %Each item in the \rcsection{usermap} section contains an email address | |
1315 %on the left, and a Bugzilla user name on the right. | |
1316 %\begin{codesample2} | |
1317 % [usermap] | |
1318 % jane.user@example.com = jane | |
1319 %\end{codesample2} | |
1320 %You can either keep the \rcsection{usermap} data in a normal \hgrc, or | |
1321 %tell the \hgext{bugzilla} hook to read the information from an | |
1322 %external \filename{usermap} file. In the latter case, you can store | |
1323 %\filename{usermap} data by itself in (for example) a user-modifiable | |
1324 %repository. This makes it possible to let your users maintain their | |
1325 %own \rcitem{bugzilla}{usermap} entries. The main \hgrc\ file might | |
1326 %look like this: | |
1327 %\begin{codesample2} | |
1328 % # regular hgrc file refers to external usermap file | |
1329 % [bugzilla] | |
1330 % usermap = /home/hg/repos/userdata/bugzilla-usermap.conf | |
1331 %\end{codesample2} | |
1332 %While the \filename{usermap} file that it refers to might look like | |
1333 %this: | |
1334 %\begin{codesample2} | |
1335 % # bugzilla-usermap.conf - inside a hg repository | |
1336 % [usermap] | |
1337 % stephanie@example.com = steph | |
1338 %\end{codesample2} | |
1339 | |
1340 \rcsection{usermap}$B%;%/%7%g%s$N3F!9$N9`L\$O!$:8JU$K(Bemail$B%"%I%l%9!$1&JU$K(B | |
1341 Bugzilla$B%f!<%6L>$r;}$D!%(B | |
1151 \begin{codesample2} | 1342 \begin{codesample2} |
1152 [usermap] | 1343 [usermap] |
1153 jane.user@example.com = jane | 1344 jane.user@example.com = jane |
1154 \end{codesample2} | 1345 \end{codesample2} |
1155 You can either keep the \rcsection{usermap} data in a normal \hgrc, or | 1346 \rcsection{usermap}$B%G!<%?$rDL>o$N(B \hgrc$B%U%!%$%k$KJ]B8$9$k$3$H$b(B |
1156 tell the \hgext{bugzilla} hook to read the information from an | 1347 \hgext{bugzilla}$B%U%C%/$K30It$N(B\filename{usermap}$B%U%!%$%k$rFI$`$h$&$K;X<((B |
1157 external \filename{usermap} file. In the latter case, you can store | 1348 $B$9$k$3$H$b$G$-$k!%8e<T$N>l9g!$Nc$($P(B\filename{usermap}$B%G!<%?$r%f!<%6$,JQ(B |
1158 \filename{usermap} data by itself in (for example) a user-modifiable | 1349 $B992DG=$J%j%]%8%H%j$KCV$/$3$H$b2DG=$G$"$k!%$3$l$O%f!<%6$K(B |
1159 repository. This makes it possible to let your users maintain their | 1350 \rcitem{bugzilla}{usermap}$B%(%s%H%j$N4IM}$rG$$;$k$3$H$K$J$k!%%a%$%s$N(B |
1160 own \rcitem{bugzilla}{usermap} entries. The main \hgrc\ file might | 1351 \hgrc\ $B%U%!%$%k$O<!$N$h$&$K$J$k!%!'(B |
1161 look like this: | |
1162 \begin{codesample2} | 1352 \begin{codesample2} |
1163 # regular hgrc file refers to external usermap file | 1353 # regular hgrc file refers to external usermap file |
1164 [bugzilla] | 1354 [bugzilla] |
1165 usermap = /home/hg/repos/userdata/bugzilla-usermap.conf | 1355 usermap = /home/hg/repos/userdata/bugzilla-usermap.conf |
1166 \end{codesample2} | |
1167 While the \filename{usermap} file that it refers to might look like | |
1168 this: | |
1169 \begin{codesample2} | |
1170 # bugzilla-usermap.conf - inside a hg repository | |
1171 [usermap] | |
1172 stephanie@example.com = steph | |
1173 \end{codesample2} | 1356 \end{codesample2} |
1174 | 1357 |
1175 %\subsubsection{Configuring the text that gets added to a bug} | 1358 %\subsubsection{Configuring the text that gets added to a bug} |
1176 \subsubsection{$B%P%0$KDI2C$5$l$?J8;zNs$r@_Dj$9$k(B} | 1359 \subsubsection{$B%P%0$KDI2C$5$l$?J8;zNs$r@_Dj$9$k(B} |
1177 | 1360 |