# HG changeset patch # User Yoshiki Yazawa # Date 1235023198 -32400 # Node ID 991befd0025cd477ce5f9c7401b7059582dcccf1 # Parent 38f034c1da539e98dc7e44465883afe4a5451b9e more hook.tex diff -r 38f034c1da53 -r 991befd0025c ja/hook.tex --- a/ja/hook.tex Thu Feb 19 14:37:50 2009 +0900 +++ b/ja/hook.tex Thu Feb 19 14:59:58 2009 +0900 @@ -641,52 +641,79 @@ \subsection{フックパラメータ} \label{sec:hook:param} -Mercurial calls each hook with a set of well-defined parameters. In -Python, a parameter is passed as a keyword argument to your hook -function. For an external program, a parameter is passed as an -environment variable. +%Mercurial calls each hook with a set of well-defined parameters. In +%Python, a parameter is passed as a keyword argument to your hook +%function. For an external program, a parameter is passed as an +%environment variable. + +Mercurialは各々のフックの呼出しの際にきちんと定義されたパラメータを渡 +す.Pythonではパラメータはキーワード引数としてフック関数に渡される.外部 +プログラムには,パラメータは環境変数として渡される. -Whether your hook is written in Python or as a shell script, the -hook-specific parameter names and values will be the same. A boolean -parameter will be represented as a boolean value in Python, but as the -number 1 (for ``true'') or 0 (for ``false'') as an environment -variable for an external hook. If a hook parameter is named -\texttt{foo}, the keyword argument for a Python hook will also be -named \texttt{foo}, while the environment variable for an external -hook will be named \texttt{HG\_FOO}. +%Whether your hook is written in Python or as a shell script, the +%hook-specific parameter names and values will be the same. A boolean +%parameter will be represented as a boolean value in Python, but as the +%number 1 (for ``true'') or 0 (for ``false'') as an environment +%variable for an external hook. If a hook parameter is named +%\texttt{foo}, the keyword argument for a Python hook will also be +%named \texttt{foo}, while the environment variable for an external +%hook will be named \texttt{HG\_FOO}. + +フックがPythonで書かれているか,シェルスクリプトして書かれているかに関わ +らず,フック固有のパラメータ名と値は同じものが用いられる.ブール型パラメー +タはPythonではブール値として扱われるが,外部フックのための環境変数で +は,1(``真'')または0(``偽'')という数値として扱われる. +フックパラメータに\texttt{foo}という名前が付けられているとき,Pythonフッ +クへのキーワード引数も同じ\texttt{foo}という名前になる. +一方,外部フックのための環境変数では\texttt{HG\_FOO}という名前になる. %\subsection{Hook return values and activity control} \subsection{フックの戻り値と動作の制御} -A hook that executes successfully must exit with a status of zero if -external, or return boolean ``false'' if in-process. Failure is -indicated with a non-zero exit status from an external hook, or an -in-process hook returning boolean ``true''. If an in-process hook -raises an exception, the hook is considered to have failed. +%A hook that executes successfully must exit with a status of zero if +%external, or return boolean ``false'' if in-process. Failure is +%indicated with a non-zero exit status from an external hook, or an +%in-process hook returning boolean ``true''. If an in-process hook +%raises an exception, the hook is considered to have failed. -For a hook that controls whether an activity can proceed, zero/false -means ``allow'', while non-zero/true/exception means ``deny''. +%For a hook that controls whether an activity can proceed, zero/false +%means ``allow'', while non-zero/true/exception means ``deny''. %\subsection{Writing an external hook} \subsection{外部フックを作成する} -When you define an external hook in your \hgrc\ and the hook is run, -its value is passed to your shell, which interprets it. This means -that you can use normal shell constructs in the body of the hook. +%When you define an external hook in your \hgrc\ and the hook is run, +%its value is passed to your shell, which interprets it. This means +%that you can use normal shell constructs in the body of the hook. + +外部フックを \hgrc\ で定義し,実行する場合,フックはシェルに渡される値を +変換すため,フックの本体部分でシェルスクリプトを記述することができる. -An executable hook is always run with its current directory set to a -repository's root directory. +%An executable hook is always run with its current directory set to a +%repository's root directory. + +外部フックは常にリポジトリのルートディレクトリをカレントディレクトリとし +て実行される. + +%Each hook parameter is passed in as an environment variable; the name +%is upper-cased, and prefixed with the string ``\texttt{HG\_}''. -Each hook parameter is passed in as an environment variable; the name -is upper-cased, and prefixed with the string ``\texttt{HG\_}''. +各々のフックパラメータは環境変数として渡される.すなわち,名前は全て大文 +字になり,``\texttt{HG\_}''という接頭辞が付けられる. -With the exception of hook parameters, Mercurial does not set or -modify any environment variables when running a hook. This is useful -to remember if you are writing a site-wide hook that may be run by a -number of different users with differing environment variables set. -In multi-user situations, you should not rely on environment variables -being set to the values you have in your environment when testing the -hook. +%With the exception of hook parameters, Mercurial does not set or +%modify any environment variables when running a hook. This is useful +%to remember if you are writing a site-wide hook that may be run by a +%number of different users with differing environment variables set. +%In multi-user situations, you should not rely on environment variables +%being set to the values you have in your environment when testing the +%hook. + +フックパラメータを例外として,Mercurialはフックを実行する際に環境変数の定 +義や変更を行わない.多くのユーザが実行するサイトワイドのフックを作成する +場合,ユーザが設定している環境変数は異なることを記憶しておくべきである. +マルチユーザ環境の場合,フックを試す際にあなたが設定している環境変数に依 +存すべきではない. %\subsection{Telling Mercurial to use an in-process hook} \subsection{Mercurialにプロセス内フックを使うように指示する} diff -r 38f034c1da53 -r 991befd0025c ja/todo.txt --- a/ja/todo.txt Thu Feb 19 14:37:50 2009 +0900 +++ b/ja/todo.txt Thu Feb 19 14:59:58 2009 +0900 @@ -7,7 +7,7 @@ filenames.tex 100% hg_id.tex noneed hgext.tex 100% -hook.tex 10% +hook.tex 40% intro.tex license.tex mq-collab.tex 100%