# HG changeset patch # User Yoshiki Yazawa # Date 1235129054 -32400 # Node ID ef0c1fb05c8428d9b28207489658b27ce968ce90 # Parent d64d38d2a91a12f6f3cc86450acf28ee150eb0aa more hook.tex diff -r d64d38d2a91a -r ef0c1fb05c84 ja/hook.tex --- a/ja/hook.tex Thu Feb 19 20:42:55 2009 +0900 +++ b/ja/hook.tex Fri Feb 20 20:24:14 2009 +0900 @@ -964,52 +964,105 @@ %\subsubsection{Configuring the \hook{acl} hook} \subsubsection{\hook{acl}フックの設定} -In order to manage incoming changesets, the \hgext{acl} hook must be -used as a \hook{pretxnchangegroup} hook. This lets it see which files -are modified by each incoming changeset, and roll back a group of -changesets if they modify ``forbidden'' files. Example: +%In order to manage incoming changesets, the \hgext{acl} hook must be +%used as a \hook{pretxnchangegroup} hook. This lets it see which files +%are modified by each incoming changeset, and roll back a group of +%changesets if they modify ``forbidden'' files. Example: +%\begin{codesample2} +% [hooks] +% pretxnchangegroup.acl = python:hgext.acl.hook +%\end{codesample2} + +\hgext{acl}フックを,到着するチェンジセットを管理するために使うためには, +\hook{pretxnchangegroup}フックとして用いる必要がある.このフックは,各々 +のチェンジセットでどのファイルが変更されたのかをチェックし,変更禁止のファ +イルへ変更があった場合はチェンジセットをロールバックする.例: \begin{codesample2} [hooks] pretxnchangegroup.acl = python:hgext.acl.hook \end{codesample2} -The \hgext{acl} extension is configured using three sections. +%The \hgext{acl} extension is configured using three sections. + +\hgext{acl}エクステンションは3つのセクションで設定される. -The \rcsection{acl} section has only one entry, \rcitem{acl}{sources}, -which lists the sources of incoming changesets that the hook should -pay attention to. You don't normally need to configure this section. +%The \rcsection{acl} section has only one entry, \rcitem{acl}{sources}, +%which lists the sources of incoming changesets that the hook should +%pay attention to. You don't normally need to configure this section. +%\begin{itemize} +%\item[\rcitem{acl}{serve}] Control incoming changesets that are arriving +% from a remote repository over http or ssh. This is the default +% value of \rcitem{acl}{sources}, and usually the only setting you'll +% need for this configuration item. +%\item[\rcitem{acl}{pull}] Control incoming changesets that are +% arriving via a pull from a local repository. +%\item[\rcitem{acl}{push}] Control incoming changesets that are +% arriving via a push from a local repository. +%\item[\rcitem{acl}{bundle}] Control incoming changesets that are +% arriving from another repository via a bundle. +%\end{itemize} + +\rcsection{acl}セクションは,\rcitem{acl}{sources}というエントリ1つを持 +つ.このエントリでフックが監視すべき到着チェンジセット内ソース +を列挙する. \begin{itemize} -\item[\rcitem{acl}{serve}] Control incoming changesets that are arriving - from a remote repository over http or ssh. This is the default - value of \rcitem{acl}{sources}, and usually the only setting you'll - need for this configuration item. -\item[\rcitem{acl}{pull}] Control incoming changesets that are - arriving via a pull from a local repository. -\item[\rcitem{acl}{push}] Control incoming changesets that are - arriving via a push from a local repository. -\item[\rcitem{acl}{bundle}] Control incoming changesets that are - arriving from another repository via a bundle. +\item[\rcitem{acl}{serve}] リモートリポジトリからhttpまたはsshを使って到 + 着するチェンジセットを制御する.\rcitem{acl}{sources}のデフォ + ルト値で,通常はこの設定内で唯一設定する必要のある項目であ + る. +\item[\rcitem{acl}{pull}] ローカルリポジトリからpullしたチェンジセットを + 制御する. +\item[\rcitem{acl}{push}] ローカルリポジトリからpushしたチェンジセットを + 制御する. +\item[\rcitem{acl}{bundle}] 別のリポジトリからバンドルによって到着したチェ + ンジセットを制御する. \end{itemize} -The \rcsection{acl.allow} section controls the users that are allowed to -add changesets to the repository. If this section is not present, all -users that are not explicitly denied are allowed. If this section is -present, all users that are not explicitly allowed are denied (so an -empty section means that all users are denied). +%The \rcsection{acl.allow} section controls the users that are allowed to +%add changesets to the repository. If this section is not present, all +%users that are not explicitly denied are allowed. If this section is +%present, all users that are not explicitly allowed are denied (so an +%empty section means that all users are denied). -The \rcsection{acl.deny} section determines which users are denied -from adding changesets to the repository. If this section is not -present or is empty, no users are denied. +\rcsection{acl.allow}セクションはチェンジセットのリポジトリへの追加を許 +可されているユーザを設定する.このセクションが存在しない場合,明示的に拒 +否されていないすべてのユーザは許可される.このセクションが存在する場合, +明示的に許可されていないすべてのユーザは拒否される.(すなわち,空のセク +ションはすべてのユーザの拒否という意味になる.) + +%The \rcsection{acl.deny} section determines which users are denied +%from adding changesets to the repository. If this section is not +%present or is empty, no users are denied. + +\rcsection{acl.deny}セクションは,リポジトリへのチェンジセット追加を拒否 +するユーザを設定する.このセクションが存在しないか,空の場合はどのユーザ +も拒否されない. -The syntaxes for the \rcsection{acl.allow} and \rcsection{acl.deny} -sections are identical. On the left of each entry is a glob pattern -that matches files or directories, relative to the root of the -repository; on the right, a user name. +%The syntaxes for the \rcsection{acl.allow} and \rcsection{acl.deny} +%sections are identical. On the left of each entry is a glob pattern +%that matches files or directories, relative to the root of the +%repository; on the right, a user name. + +\rcsection{acl.allow}と\rcsection{acl.deny}セクションの構文は同一である. +各々のエントリの左辺はファイルまたはディレクトリにマッチするglobパターン +で,リポジトリルートからの相対パスである.右辺はユーザ名である. -In the following example, the user \texttt{docwriter} can only push -changes to the \dirname{docs} subtree of the repository, while -\texttt{intern} can push changes to any file or directory except -\dirname{source/sensitive}. +%In the following example, the user \texttt{docwriter} can only push +%changes to the \dirname{docs} subtree of the repository, while +%\texttt{intern} can push changes to any file or directory except +%\dirname{source/sensitive}. +%\begin{codesample2} +% [acl.allow] +% docs/** = docwriter +% +% [acl.deny] +% source/sensitive/** = intern +%\end{codesample2} + +以下の例では,\texttt{docwriter}というユーザは,リポジトリの +\dirname{docs}サブツリーにしかpushできない.また\texttt{intern}は +\dirname{source/sensitive}以外ならばどのディレクトリのどのファイルにも変 +更をpushすることができる. \begin{codesample2} [acl.allow] docs/** = docwriter @@ -1021,29 +1074,63 @@ %\subsubsection{Testing and troubleshooting} \subsubsection{テストと問題解決} -If you want to test the \hgext{acl} hook, run it with Mercurial's -debugging output enabled. Since you'll probably be running it on a -server where it's not convenient (or sometimes possible) to pass in -the \hggopt{--debug} option, don't forget that you can enable -debugging output in your \hgrc: +%If you want to test the \hgext{acl} hook, run it with Mercurial's + +%debugging output enabled. Since you'll probably be running it on a +%server where it's not convenient (or sometimes possible) to pass in +%the \hggopt{--debug} option, don't forget that you can enable +%debugging output in your \hgrc: +%\begin{codesample2} +% [ui] +% debug = true +%\end{codesample2} +%With this enabled, the \hgext{acl} hook will print enough information +%to let you figure out why it is allowing or forbidding pushes from +%specific users. + +\hgext{acl}フックをテストしたい場合は,Mercurialのデバッグ出力を有効にし +て実行すると良い.サーバ上で実行するのであれば、\hggopt{--debug}オプショ +ンを渡すのは不便であったり、不可能であったりすることがある。このため、デ +バッグ出力は \hgrc でえも有効にできることを記憶しておくべきである. \begin{codesample2} [ui] debug = true \end{codesample2} -With this enabled, the \hgext{acl} hook will print enough information -to let you figure out why it is allowing or forbidding pushes from -specific users. +デバッグ出力が有効の場合,\hgext{acl}フックは,特定のユーザを許可あるい +は拒否した理由を知るのに十分な情報を出力する. %\subsection{\hgext{bugzilla}---integration with Bugzilla} -\subsection{\hgext{bugzilla}---Bugzillaへの統合} +\subsection{\hgext{bugzilla}---Bugzillaとの結合} + +%The \hgext{bugzilla} extension adds a comment to a Bugzilla bug +%whenever it finds a reference to that bug ID in a commit comment. You +%can install this hook on a shared server, so that any time a remote +%user pushes changes to this server, the hook gets run. + +\hgext{bugzilla}エクステンションは,Bugzillaで管理されているバグへ,コミッ +トコメントの中でバグIDを参照している場合コメントを追加する. +このフックは共有サーバにもインストールできるので,リモートユーザが +変更をpushした場合にも動作する. -The \hgext{bugzilla} extension adds a comment to a Bugzilla bug -whenever it finds a reference to that bug ID in a commit comment. You -can install this hook on a shared server, so that any time a remote -user pushes changes to this server, the hook gets run. +%It adds a comment to the bug that looks like this (you can configure +%the contents of the comment---see below): +%\begin{codesample2} +% Changeset aad8b264143a, made by Joe User in +% the frobnitz repository, refers to this bug. +% +% For complete details, see +% http://hg.domain.com/frobnitz?cmd=changeset;node=aad8b264143a +% +% Changeset description: +% Fix bug 10483 by guarding against some NULL pointers +%\end{codesample2} +%The value of this hook is that it automates the process of updating a +%bug any time a changeset refers to it. If you configure the hook +%properly, it makes it easy for people to browse straight from a +%Bugzilla bug to a changeset that refers to that bug. -It adds a comment to the bug that looks like this (you can configure -the contents of the comment---see below): +このフックは次のようにバグへコメントを追加する.(コメントの内容は設定可 +能である.これについては下記を参照.) \begin{codesample2} Changeset aad8b264143a, made by Joe User in the frobnitz repository, refers to this bug. @@ -1054,123 +1141,219 @@ Changeset description: Fix bug 10483 by guarding against some NULL pointers \end{codesample2} -The value of this hook is that it automates the process of updating a -bug any time a changeset refers to it. If you configure the hook -properly, it makes it easy for people to browse straight from a -Bugzilla bug to a changeset that refers to that bug. +このフックは,チェンジセットがバグを参照した場合,バグの更新を自動化でき +るところに価値がある.このフックをきちんと設定すれば,Bugzillaバグを閲覧 +しているユーザが,バグから直ちに関係するチェンジセットを参照できるように +なる. -You can use the code in this hook as a starting point for some more -exotic Bugzilla integration recipes. Here are a few possibilities: +%You can use the code in this hook as a starting point for some more +%exotic Bugzilla integration recipes. Here are a few possibilities: +%\begin{itemize} +%\item Require that every changeset pushed to the server have a valid +% bug~ID in its commit comment. In this case, you'd want to configure +% the hook as a \hook{pretxncommit} hook. This would allow the hook +% to reject changes that didn't contain bug IDs. +%\item Allow incoming changesets to automatically modify the +% \emph{state} of a bug, as well as simply adding a comment. For +% example, the hook could recognise the string ``fixed bug 31337'' as +% indicating that it should update the state of bug 31337 to +% ``requires testing''. +%\end{itemize} + +このフックのコードを出発点として,別のBugzillaとの結合を行うことも可能 +である.いくつかの例を挙げる: \begin{itemize} -\item Require that every changeset pushed to the server have a valid - bug~ID in its commit comment. In this case, you'd want to configure - the hook as a \hook{pretxncommit} hook. This would allow the hook - to reject changes that didn't contain bug IDs. -\item Allow incoming changesets to automatically modify the - \emph{state} of a bug, as well as simply adding a comment. For - example, the hook could recognise the string ``fixed bug 31337'' as - indicating that it should update the state of bug 31337 to - ``requires testing''. + \item サーバにプッシュされたチェンジセットすべてにコミットコメントに有効 + なバグIDがあることを要求する.この場合,フックを + \hook{pretxncommit}フックとして設定する必要がある.これによって, + バグIDを含まない変更を拒否することができる. + \item 到着するチェンジセットに,コメント追加に加えて,バグの\emph{ステー + ト}を自動的に変更するようにできる.例えば,フックが``fixed bug + 31337''のような文字列を認識して,bug 31337のステートを``requires + testing''に変更するなどが考えられる. \end{itemize} %\subsubsection{Configuring the \hook{bugzilla} hook} \subsubsection{\hook{bugzilla}フックの設定} \label{sec:hook:bugzilla:config} -You should configure this hook in your server's \hgrc\ as an -\hook{incoming} hook, for example as follows: +%You should configure this hook in your server's \hgrc\ as an +%\hook{incoming} hook, for example as follows: +%\begin{codesample2} +% [hooks] +% incoming.bugzilla = python:hgext.bugzilla.hook +%\end{codesample2} + +このフックは次の例のようにサーバ上の\hgrc\ で\hook{incoming}フックと設定 +すべきである. \begin{codesample2} [hooks] incoming.bugzilla = python:hgext.bugzilla.hook \end{codesample2} -Because of the specialised nature of this hook, and because Bugzilla -was not written with this kind of integration in mind, configuring -this hook is a somewhat involved process. +%Because of the specialised nature of this hook, and because Bugzilla +%was not written with this kind of integration in mind, configuring +%this hook is a somewhat involved process. + +このフックの特別な性質,Bugzillaがこのような結合を念頭に書かれていないこ +とによって,このフックの設定は複雑なプロセスとなる. -Before you begin, you must install the MySQL bindings for Python on -the host(s) where you'll be running the hook. If this is not -available as a binary package for your system, you can download it -from~\cite{web:mysql-python}. +%Before you begin, you must install the MySQL bindings for Python on +%the host(s) where you'll be running the hook. If this is not +%available as a binary package for your system, you can download it +%from~\cite{web:mysql-python}. -Configuration information for this hook lives in the -\rcsection{bugzilla} section of your \hgrc. +設定を開始する前に,フックを実行するホスト上でPython用のMySQLバインディン +グをインストールする必要がある.実行環境用にバイナリパッケージが用意され +ていなければ,ソースファイルを\cite{web:mysql-python}からダウンロードする +ことができる. + +%Configuration information for this hook lives in the +%\rcsection{bugzilla} section of your \hgrc. +このフックの設定情報は,\hgrc ファイルの\rcsection{bugzilla}セクションに +ある. \begin{itemize} -\item[\rcitem{bugzilla}{version}] The version of Bugzilla installed on - the server. The database schema that Bugzilla uses changes - occasionally, so this hook has to know exactly which schema to use. - At the moment, the only version supported is \texttt{2.16}. -\item[\rcitem{bugzilla}{host}] The hostname of the MySQL server that - stores your Bugzilla data. The database must be configured to allow - connections from whatever host you are running the \hook{bugzilla} - hook on. -\item[\rcitem{bugzilla}{user}] The username with which to connect to - the MySQL server. The database must be configured to allow this - user to connect from whatever host you are running the - \hook{bugzilla} hook on. This user must be able to access and - modify Bugzilla tables. The default value of this item is - \texttt{bugs}, which is the standard name of the Bugzilla user in a - MySQL database. -\item[\rcitem{bugzilla}{password}] The MySQL password for the user you - configured above. This is stored as plain text, so you should make - sure that unauthorised users cannot read the \hgrc\ file where you - store this information. -\item[\rcitem{bugzilla}{db}] The name of the Bugzilla database on the - MySQL server. The default value of this item is \texttt{bugs}, - which is the standard name of the MySQL database where Bugzilla - stores its data. -\item[\rcitem{bugzilla}{notify}] If you want Bugzilla to send out a - notification email to subscribers after this hook has added a - comment to a bug, you will need this hook to run a command whenever - it updates the database. The command to run depends on where you - have installed Bugzilla, but it will typically look something like - this, if you have Bugzilla installed in - \dirname{/var/www/html/bugzilla}: +%\item[\rcitem{bugzilla}{version}] The version of Bugzilla installed on +% the server. The database schema that Bugzilla uses changes +% occasionally, so this hook has to know exactly which schema to use. +% At the moment, the only version supported is \texttt{2.16}. + \item[\rcitem{bugzilla}{version}] サーバへインストールされたBugzillaのバー + ジョン.Bugzillaの使用するデータベースのスキーマは時に変更 + されるため,フックはどのスキーマが使用されるのかを知る必要 + がある.現時点ではBugzilla\texttt{2.16}だけがサポートされ + ている. + +%\item[\rcitem{bugzilla}{host}] The hostname of the MySQL server that +% stores your Bugzilla data. The database must be configured to allow +% connections from whatever host you are running the \hook{bugzilla} +% hook on. + \item[\rcitem{bugzilla}{host}] Bugzillaデータを格納しているMySQLサーバの + ホストネーム.データベースは\hook{bugzilla}フックを実行す + るホストから接続可能に設定されていなければならない. + +%\item[\rcitem{bugzilla}{user}] The username with which to connect to +% the MySQL server. The database must be configured to allow this +% user to connect from whatever host you are running the +% \hook{bugzilla} hook on. This user must be able to access and +% modify Bugzilla tables. The default value of this item is +% \texttt{bugs}, which is the standard name of the Bugzilla user in a +% MySQL database. + \item[\rcitem{bugzilla}{user}] MySQLサーバに接続するユーザ名.データベー + スは\hook{bugzilla}フックを実行するホスト上からこのユーザの + 接続を許可するように設定されていなければならない.このユー + ザはBugzillaテーブルにアクセスし,変更できる権限がなければ + ならない.この項目のデフォルト値はMySQLデータベースでの + Bugzillaユーザの標準名\texttt{bugs}である. + +%\item[\rcitem{bugzilla}{password}] The MySQL password for the user you +% configured above. This is stored as plain text, so you should make +% sure that unauthorised users cannot read the \hgrc\ file where you +% store this information. + \item[\rcitem{bugzilla}{password}] 上記のユーザのMySQLパスワード.平文で + 保存されるため,権限のないユーザがこの\hgrc\ ファイルを確実 + に読めないようにしておく必要がある. + +%\item[\rcitem{bugzilla}{db}] The name of the Bugzilla database on the +% MySQL server. The default value of this item is \texttt{bugs}, +% which is the standard name of the MySQL database where Bugzilla +% stores its data. + \item[\rcitem{bugzilla}{db}] MySQLサーバ上のBugzillaデータベースの名前. + この項目のデフォルト値は\texttt{bugs}この項目のデフォルト値 + はBugzillaがデータを保存するMySQLデータベースの標準名 + \texttt{bugs}である. + +%\item[\rcitem{bugzilla}{notify}] If you want Bugzilla to send out a +% notification email to subscribers after this hook has added a +% comment to a bug, you will need this hook to run a command whenever +% it updates the database. The command to run depends on where you + +% have installed Bugzilla, but it will typically look something like +% this, if you have Bugzilla installed in +% \dirname{/var/www/html/bugzilla}: +% \begin{codesample4} +% cd /var/www/html/bugzilla && ./processmail %s nobody@nowhere.com +% \end{codesample4} +% The Bugzilla \texttt{processmail} program expects to be given a +% bug~ID (the hook replaces ``\texttt{\%s}'' with the bug~ID) and an +% email address. It also expects to be able to write to some files in +% the directory that it runs in. If Bugzilla and this hook are not +% installed on the same machine, you will need to find a way to run +% \texttt{processmail} on the server where Bugzilla is installed. +\item[\rcitem{bugzilla}{notify}] フックからバグにコメントが追加された時, + Bugzillaから講読者に通知メール + が送られるようにしたい場合は,フックがデータベースを更新し + た場合は常にコマンドが実行されるように設定しなければならな + い.実行するコマンドは,Bugzillaをどこにインストールしたかに + 依存する.Bugzillaを\dirname{/var/www/html/bugzilla}にイン + ストールした場合,典型的なコマンドは次のようになる: \begin{codesample4} cd /var/www/html/bugzilla && ./processmail %s nobody@nowhere.com \end{codesample4} - The Bugzilla \texttt{processmail} program expects to be given a - bug~ID (the hook replaces ``\texttt{\%s}'' with the bug~ID) and an - email address. It also expects to be able to write to some files in - the directory that it runs in. If Bugzilla and this hook are not - installed on the same machine, you will need to find a way to run - \texttt{processmail} on the server where Bugzilla is installed. +Bugzilla \texttt{processmail}プログラムはbug~ID (フックが +``\texttt{\%s}''をbug~IDに置換する.)とemailアドレスを取る.このプログラ +ムはまた実行されるディレクトリ内でいくつかのファイルへ書き込みを必要とす +る.Bugzillaとフックが同じマシン上にインストールされていない場合, +Bugzillaがインストールされたサーバ上で\texttt{processmail}を実行する方法 +を見つける必要がある. \end{itemize} %\subsubsection{Mapping committer names to Bugzilla user names} \subsubsection{コミット者の名前をBugzillaのユーザ名へマップする} -By default, the \hgext{bugzilla} hook tries to use the email address -of a changeset's committer as the Bugzilla user name with which to -update a bug. If this does not suit your needs, you can map committer -email addresses to Bugzilla user names using a \rcsection{usermap} -section. +%By default, the \hgext{bugzilla} hook tries to use the email address +%of a changeset's committer as the Bugzilla user name with which to +%update a bug. If this does not suit your needs, you can map committer +%email addresses to Bugzilla user names using a \rcsection{usermap} +%section. + +デフォルトでは\hgext{bugzilla}フックはバグを更新するBugzillaユーザ名とし +てチェンジセットのコミッタのemailアドレスを使おうとする. +この挙動が望ましくない場合は,\rcsection{usermap}セクションをせっていする +ことでコミッタのemailアドレスをBugzillaのユーザ名にマップすることができる. -Each item in the \rcsection{usermap} section contains an email address -on the left, and a Bugzilla user name on the right. +%Each item in the \rcsection{usermap} section contains an email address +%on the left, and a Bugzilla user name on the right. +%\begin{codesample2} +% [usermap] +% jane.user@example.com = jane +%\end{codesample2} +%You can either keep the \rcsection{usermap} data in a normal \hgrc, or +%tell the \hgext{bugzilla} hook to read the information from an +%external \filename{usermap} file. In the latter case, you can store +%\filename{usermap} data by itself in (for example) a user-modifiable +%repository. This makes it possible to let your users maintain their +%own \rcitem{bugzilla}{usermap} entries. The main \hgrc\ file might +%look like this: +%\begin{codesample2} +% # regular hgrc file refers to external usermap file +% [bugzilla] +% usermap = /home/hg/repos/userdata/bugzilla-usermap.conf +%\end{codesample2} +%While the \filename{usermap} file that it refers to might look like +%this: +%\begin{codesample2} +% # bugzilla-usermap.conf - inside a hg repository +% [usermap] +% stephanie@example.com = steph +%\end{codesample2} + +\rcsection{usermap}セクションの各々の項目は,左辺にemailアドレス,右辺に +Bugzillaユーザ名を持つ. \begin{codesample2} [usermap] jane.user@example.com = jane \end{codesample2} -You can either keep the \rcsection{usermap} data in a normal \hgrc, or -tell the \hgext{bugzilla} hook to read the information from an -external \filename{usermap} file. In the latter case, you can store -\filename{usermap} data by itself in (for example) a user-modifiable -repository. This makes it possible to let your users maintain their -own \rcitem{bugzilla}{usermap} entries. The main \hgrc\ file might -look like this: +\rcsection{usermap}データを通常の \hgrcファイルに保存することも +\hgext{bugzilla}フックに外部の\filename{usermap}ファイルを読むように指示 +することもできる.後者の場合,例えば\filename{usermap}データをユーザが変 +更可能なリポジトリに置くことも可能である.これはユーザに +\rcitem{bugzilla}{usermap}エントリの管理を任せることになる.メインの +\hgrc\ ファイルは次のようになる.: \begin{codesample2} # regular hgrc file refers to external usermap file [bugzilla] usermap = /home/hg/repos/userdata/bugzilla-usermap.conf \end{codesample2} -While the \filename{usermap} file that it refers to might look like -this: -\begin{codesample2} - # bugzilla-usermap.conf - inside a hg repository - [usermap] - stephanie@example.com = steph -\end{codesample2} %\subsubsection{Configuring the text that gets added to a bug} \subsubsection{バグに追加された文字列を設定する}