hgbook

changeset 442:606295a87ff2

translated a bit more of hook.tex
author jerojasro@abu.no-ip.org
date Mon Dec 08 12:55:51 2008 -0500 (2008-12-08)
parents 4e0684e824e1
children 95c7f5295b86
files es/Leame.1st es/hook.tex
line diff
     1.1 --- a/es/Leame.1st	Mon Dec 08 11:16:54 2008 -0500
     1.2 +++ b/es/Leame.1st	Mon Dec 08 12:55:51 2008 -0500
     1.3 @@ -105,7 +105,7 @@
     1.4  || intro.tex	   || Igor Támara   ||	  100%	  || 08/11/2008	||  09/11/2008 ||
     1.5  || collab.tex      || Igor Támara   ||    100%    || 10/11/2008 ||  06/12/2008 ||
     1.6  || filenames.tex   || Javier Rojas  ||     72%    || 27/11/2008 ||             ||
     1.7 -|| hook.tex        || Javier Rojas  ||     17%    || 01/12/2008 ||             ||
     1.8 +|| hook.tex        || Javier Rojas  ||     26%    || 01/12/2008 ||             ||
     1.9  || mq.tex          || Igor Támara   ||      0%    || 06/12/2008 ||             ||
    1.10  || hgext.tex       || Igor Támara   ||      0%    ||            ||             ||
    1.11  
     2.1 --- a/es/hook.tex	Mon Dec 08 11:16:54 2008 -0500
     2.2 +++ b/es/hook.tex	Mon Dec 08 12:55:51 2008 -0500
     2.3 @@ -258,82 +258,89 @@
     2.4  \section{Tutorial corto de uso de ganchos}
     2.5  \label{sec:hook:simple}
     2.6  
     2.7 -It is easy to write a Mercurial hook.  Let's start with a hook that
     2.8 -runs when you finish a \hgcmd{commit}, and simply prints the hash of
     2.9 -the changeset you just created.  The hook is called \hook{commit}.
    2.10 +Escribir un gancho para Mercurial es fácil. Empecemos con un gancho
    2.11 +que se ejecute cuando usted termine un \hgcmd{commit}, y simplemente
    2.12 +muestre el hash del conjunto de cambios que usted acaba de crear. El
    2.13 +gancho se llamará \hook{commit}.
    2.14  
    2.15  \begin{figure}[ht]
    2.16    \interaction{hook.simple.init}
    2.17 -  \caption{A simple hook that runs when a changeset is committed}
    2.18 +  \caption{Un gancho simple que se ejecuta al hacer la consignación de
    2.19 +  un conjunto de cambios}
    2.20    \label{ex:hook:init}
    2.21  \end{figure}
    2.22  
    2.23 -All hooks follow the pattern in example~\ref{ex:hook:init}.  You add
    2.24 -an entry to the \rcsection{hooks} section of your \hgrc.  On the left
    2.25 -is the name of the event to trigger on; on the right is the action to
    2.26 -take.  As you can see, you can run an arbitrary shell command in a
    2.27 -hook.  Mercurial passes extra information to the hook using
    2.28 -environment variables (look for \envar{HG\_NODE} in the example).
    2.29 -
    2.30 -\subsection{Performing multiple actions per event}
    2.31 -
    2.32 -Quite often, you will want to define more than one hook for a
    2.33 -particular kind of event, as shown in example~\ref{ex:hook:ext}.
    2.34 -Mercurial lets you do this by adding an \emph{extension} to the end of
    2.35 -a hook's name.  You extend a hook's name by giving the name of the
    2.36 -hook, followed by a full stop (the ``\texttt{.}'' character), followed
    2.37 -by some more text of your choosing.  For example, Mercurial will run
    2.38 -both \texttt{commit.foo} and \texttt{commit.bar} when the
    2.39 -\texttt{commit} event occurs.
    2.40 +Todos los ganchos siguen el patrón del ejemplo~\ref{ex:hook:init}.
    2.41 +Usted puede añadir una entrada a la sección \rcsection{hooks} de su
    2.42 +fichero \hgrc.  A la izquierda está el nombre del evento respecto al
    2.43 +cual dispararse; a la derecha está la acción a llevar a cabo. Como
    2.44 +puede ver, es posible ejecutar cualquier orden de la línea de comandos
    2.45 +en un gancho. Mercurial le pasa información extra al gancho usando
    2.46 +variables de entorno (busque \envar{HG\_NODE} en el ejemplo).
    2.47 +
    2.48 +\subsection{Llevar a cabo varias acciones por evento}
    2.49 +
    2.50 +A menudo, usted querrá definir más de un gancho para un tipo de evento
    2.51 +particular, como se muestra en el ejemplo~\ref{ex:hook:ext}. 
    2.52 +Mercurial le permite hacer esto añadiendo una \emph{extensión} al
    2.53 +final del nombre de un gancho. Usted extiende el nombre del gancho
    2.54 +%TODO Yuk, no me gusta ese "parada completa"
    2.55 +poniendo el nombre del gancho, seguido por una parada completa (el
    2.56 +caracter ``\texttt{.}''), seguido de algo más de texto de su elección.
    2.57 +Por ejemplo, Mercurial ejecutará tanto \texttt{commit.foo} como
    2.58 +\texttt{commit.bar} cuando ocurra el evento \texttt{commit}.
    2.59  
    2.60  \begin{figure}[ht]
    2.61    \interaction{hook.simple.ext}
    2.62 -  \caption{Defining a second \hook{commit} hook}
    2.63 +  \caption{Definición de un segundo gancho \hook{commit}}
    2.64    \label{ex:hook:ext}
    2.65  \end{figure}
    2.66  
    2.67 -To give a well-defined order of execution when there are multiple
    2.68 -hooks defined for an event, Mercurial sorts hooks by extension, and
    2.69 -executes the hook commands in this sorted order.  In the above
    2.70 -example, it will execute \texttt{commit.bar} before
    2.71 -\texttt{commit.foo}, and \texttt{commit} before both.
    2.72 -
    2.73 -It is a good idea to use a somewhat descriptive extension when you
    2.74 -define a new hook.  This will help you to remember what the hook was
    2.75 -for.  If the hook fails, you'll get an error message that contains the
    2.76 -hook name and extension, so using a descriptive extension could give
    2.77 -you an immediate hint as to why the hook failed (see
    2.78 -section~\ref{sec:hook:perm} for an example).
    2.79 -
    2.80 -\subsection{Controlling whether an activity can proceed}
    2.81 +Para dar un orden bien definido de ejecución cuando hay múltiples
    2.82 +ganchos definidos para un evento, Mercurial ordena los ganchos de
    2.83 +acuerdo a su extensión, y los ejecuta en dicho orden. En el ejemplo de
    2.84 +arribam \texttt{commit.bar} se ejecutará antes que
    2.85 +\texttt{commit.foo}, y \texttt{commit} se ejecutará antes de ambos.
    2.86 +
    2.87 +Es una buena idea usar una extensión descriptiva cuando usted define
    2.88 +un gancho. Esto le ayudará a recordar para qué se usa el gancho. Si el
    2.89 +gancho falla, usted recibirá un mensaje de error que contiene el
    2.90 +nombre y la extensión del gancho, así que usar una extensión
    2.91 +descriptiva le dará una pista inmediata de porqué el gancho falló (vea
    2.92 +un ejemplo en la sección~\ref{sec:hook:perm}).
    2.93 +
    2.94 +\subsection{Controlar cuándo puede llevarse a cabo una actividad}
    2.95  \label{sec:hook:perm}
    2.96  
    2.97 -In our earlier examples, we used the \hook{commit} hook, which is
    2.98 -run after a commit has completed.  This is one of several Mercurial
    2.99 -hooks that run after an activity finishes.  Such hooks have no way of
   2.100 -influencing the activity itself.
   2.101 -
   2.102 -Mercurial defines a number of events that occur before an activity
   2.103 -starts; or after it starts, but before it finishes.  Hooks that
   2.104 -trigger on these events have the added ability to choose whether the
   2.105 -activity can continue, or will abort.  
   2.106 -
   2.107 -The \hook{pretxncommit} hook runs after a commit has all but
   2.108 -completed.  In other words, the metadata representing the changeset
   2.109 -has been written out to disk, but the transaction has not yet been
   2.110 -allowed to complete.  The \hook{pretxncommit} hook has the ability to
   2.111 -decide whether the transaction can complete, or must be rolled back.
   2.112 -
   2.113 -If the \hook{pretxncommit} hook exits with a status code of zero, the
   2.114 -transaction is allowed to complete; the commit finishes; and the
   2.115 -\hook{commit} hook is run.  If the \hook{pretxncommit} hook exits with
   2.116 -a non-zero status code, the transaction is rolled back; the metadata
   2.117 -representing the changeset is erased; and the \hook{commit} hook is
   2.118 -not run.
   2.119 +En los ejemplos anteriores, usamos el gancho \hook{commit}, que es
   2.120 +ejecutado después de que se ha completado una consignación. Este es
   2.121 +uno de los varios ganchos que Mercurial ejecuta luego de que una
   2.122 +actividad termina. Tales ganchos no tienen forma de influenciar la
   2.123 +actividad como tal.
   2.124 +
   2.125 +Mercurial define un número de eventos que ocurren antes de que una
   2.126 +actividad empiece; o luego de que empiece, pero antes de que termine.
   2.127 +Los ganchos que se disparan con estos eventos tienen la capacidad
   2.128 +adicional de elegir si la actividad puede continuar, o si su ejecución
   2.129 +es abortada.
   2.130 +
   2.131 +El gancho \hook{pretxncommit} se ejecuta justo antes de que una
   2.132 +consignación se ejecute. En otras palabras, los metadatos que
   2.133 +representan el conjunto de cambios han sido escritos al disco, pero no
   2.134 +se ha terminado la transacción. El gancho \hook{pretxncommit} tiene la
   2.135 +capacidad de decidir si una transacción se completa, o debe
   2.136 +deshacerse.
   2.137 +
   2.138 +Si el gancho \hook{pretxncommit} termina con un código de salida de
   2.139 +cero, se permite que la transacción se complete; la consignación
   2.140 +termina; y el gancho \hook{commit} es ejecutado. Si el gancho
   2.141 +\hook{pretxncommit} termina con un código de salida diferente de cero,
   2.142 +la transacción es revertida; los metadatos representando el conjunto
   2.143 +de cambios son borrados; y el gancho \hook{commit} no es ejecutado.
   2.144  
   2.145  \begin{figure}[ht]
   2.146    \interaction{hook.simple.pretxncommit}
   2.147 -  \caption{Using the \hook{pretxncommit} hook to control commits}
   2.148 +  \caption{Uso del gancho \hook{pretxncommit} hook to control commits}
   2.149    \label{ex:hook:pretxncommit}
   2.150  \end{figure}
   2.151