hgbook
diff es/hook.tex @ 455:b96d80be5a60
Finished extensions translation
author | Igor Támara <igor@tamarapatino.org> |
---|---|
date | Tue Dec 16 07:02:38 2008 -0500 (2008-12-16) |
parents | 606295a87ff2 |
children | 67d34d8b6ba0 |
line diff
1.1 --- a/es/hook.tex Mon Dec 08 12:55:51 2008 -0500 1.2 +++ b/es/hook.tex Tue Dec 16 07:02:38 2008 -0500 1.3 @@ -344,40 +344,44 @@ 1.4 \label{ex:hook:pretxncommit} 1.5 \end{figure} 1.6 1.7 -The hook in example~\ref{ex:hook:pretxncommit} checks that a commit 1.8 -comment contains a bug ID. If it does, the commit can complete. If 1.9 -not, the commit is rolled back. 1.10 - 1.11 -\section{Writing your own hooks} 1.12 - 1.13 -When you are writing a hook, you might find it useful to run Mercurial 1.14 -either with the \hggopt{-v} option, or the \rcitem{ui}{verbose} config 1.15 -item set to ``true''. When you do so, Mercurial will print a message 1.16 -before it calls each hook. 1.17 - 1.18 -\subsection{Choosing how your hook should run} 1.19 +El gancho en el ejemplo~\ref{ex:hook:pretxncommit} revisa si el 1.20 +mensaje de consignación contiene el ID de algún fallo. Si lo contiene, 1.21 +la consignación puede continuar. Si no, la consignación es cancelada. 1.22 + 1.23 +\section{Escribir sus propios ganchos} 1.24 + 1.25 +Cuando usted escriba un gancho, puede encontrar útil el ejecutar 1.26 +Mercurial o bien pasándole la opción \hggopt{-v}, o con el valor de 1.27 +configuración \rcitem{ui}{verbose} fijado en ``true'' (verdadero). 1.28 +Cuando lo haga, Mercurial imprimirá un mensaje antes de llamar cada 1.29 +gancho. 1.30 + 1.31 +\subsection{Escoger cómo debe ejecutarse su gancho} 1.32 \label{sec:hook:lang} 1.33 1.34 -You can write a hook either as a normal program---typically a shell 1.35 -script---or as a Python function that is executed within the Mercurial 1.36 -process. 1.37 - 1.38 -Writing a hook as an external program has the advantage that it 1.39 -requires no knowledge of Mercurial's internals. You can call normal 1.40 -Mercurial commands to get any added information you need. The 1.41 -trade-off is that external hooks are slower than in-process hooks. 1.42 - 1.43 -An in-process Python hook has complete access to the Mercurial API, 1.44 -and does not ``shell out'' to another process, so it is inherently 1.45 -faster than an external hook. It is also easier to obtain much of the 1.46 -information that a hook requires by using the Mercurial API than by 1.47 -running Mercurial commands. 1.48 - 1.49 -If you are comfortable with Python, or require high performance, 1.50 -writing your hooks in Python may be a good choice. However, when you 1.51 -have a straightforward hook to write and you don't need to care about 1.52 -performance (probably the majority of hooks), a shell script is 1.53 -perfectly fine. 1.54 +Usted puede escribir un gancho que funcione como un programa normal 1.55 +---típicamente un guión de línea de comandos---o como una función de 1.56 +Python que se ejecuta dentro del proceso Mercurial. 1.57 + 1.58 +Escribir un gancho como un programa externo tiene la ventaja de que no 1.59 +requiere ningún conocimiento del funcionamiento interno de Mercurial. 1.60 +Usted puede ejecutar comandos Mercurial normales para obtener la 1.61 +informción extra que pueda necesitar. La contraparte de esto es que 1.62 +los ganchos externos son más lentos que los ganchos internos 1.63 +ejecutados dentro del proceso. 1.64 + 1.65 +Un gancho Python interno tiene acceso completo a la API de Mercurial, 1.66 +y no se ``externaliza'' a otro proceso, así que es inherentemente más 1.67 +rápido que un gancho externo. Adicionalmente es más fácil obtener la 1.68 +mayoría de la información que un gancho requiere a través de llamadas 1.69 +directas a la API de Mercurial que hacerlo ejecutando comandos 1.70 +Mercurial. 1.71 + 1.72 +Si se siente a gusto con Python, o requiere un alto desempeño, 1.73 +escribir sus ganchos en Python puede ser una buena elección. Sin 1.74 +embargo, cuando usted tiene un gancho bastante directo por escribir y 1.75 +no le importa el desempeño (el caso de la mayoría de los ganchos), es 1.76 +perfectamente admisible un guión de línea de comandos. 1.77 1.78 \subsection{Hook parameters} 1.79 \label{sec:hook:param}