hgbook
changeset 475:22184eb4c965
finished the translation of the section "information for writers of hooks"
updated project status
updated project status
author | Javier Rojas <jerojasro@devnull.li> |
---|---|
date | Wed Dec 31 11:31:04 2008 -0500 (2008-12-31) |
parents | 9438521abfc4 |
children | cf6b9bf14af7 |
files | es/Leame.1st es/hook.tex |
line diff
1.1 --- a/es/Leame.1st Wed Dec 31 10:18:25 2008 -0500 1.2 +++ b/es/Leame.1st Wed Dec 31 11:31:04 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 || 53% || 01/12/2008 || || 1.8 +|| hook.tex || Javier Rojas || 78% || 01/12/2008 || || 1.9 || mq.tex || Igor Támara || 100% || 06/12/2008 || 13/12/2008 || 1.10 || hgext.tex || Igor Támara || 100% || 13/12/2008 || 16/12/2008 || 1.11 || template.tex || Igor Támara || || || ||
2.1 --- a/es/hook.tex Wed Dec 31 10:18:25 2008 -0500 2.2 +++ b/es/hook.tex Wed Dec 31 11:31:04 2008 -0500 2.3 @@ -1066,122 +1066,130 @@ 2.4 a \texttt{false}. Hasta que usted haga eso, simplemente se imprimirá 2.5 el mensaje que se \emph{enviaría}. 2.6 2.7 -\section{Information for writers of hooks} 2.8 +\section{Información para escritores de ganchos} 2.9 \label{sec:hook:ref} 2.10 2.11 -\subsection{In-process hook execution} 2.12 - 2.13 -An in-process hook is called with arguments of the following form: 2.14 +\subsection{Ejecución de ganchos internos} 2.15 + 2.16 +Un gancho interno es llamado con argumentos de la siguiente forma: 2.17 \begin{codesample2} 2.18 def myhook(ui, repo, **kwargs): 2.19 pass 2.20 \end{codesample2} 2.21 -The \texttt{ui} parameter is a \pymodclass{mercurial.ui}{ui} object. 2.22 -The \texttt{repo} parameter is a 2.23 -\pymodclass{mercurial.localrepo}{localrepository} object. The 2.24 -names and values of the \texttt{**kwargs} parameters depend on the 2.25 -hook being invoked, with the following common features: 2.26 -\begin{itemize} 2.27 -\item If a parameter is named \texttt{node} or 2.28 - \texttt{parent\emph{N}}, it will contain a hexadecimal changeset ID. 2.29 - The empty string is used to represent ``null changeset ID'' instead 2.30 - of a string of zeroes. 2.31 -\item If a parameter is named \texttt{url}, it will contain the URL of 2.32 - a remote repository, if that can be determined. 2.33 -\item Boolean-valued parameters are represented as Python 2.34 - \texttt{bool} objects. 2.35 -\end{itemize} 2.36 - 2.37 -An in-process hook is called without a change to the process's working 2.38 -directory (unlike external hooks, which are run in the root of the 2.39 -repository). It must not change the process's working directory, or 2.40 -it will cause any calls it makes into the Mercurial API to fail. 2.41 - 2.42 -If a hook returns a boolean ``false'' value, it is considered to have 2.43 -succeeded. If it returns a boolean ``true'' value or raises an 2.44 -exception, it is considered to have failed. A useful way to think of 2.45 -the calling convention is ``tell me if you fail''. 2.46 - 2.47 -Note that changeset IDs are passed into Python hooks as hexadecimal 2.48 -strings, not the binary hashes that Mercurial's APIs normally use. To 2.49 -convert a hash from hex to binary, use the 2.50 -\pymodfunc{mercurial.node}{bin} function. 2.51 - 2.52 -\subsection{External hook execution} 2.53 - 2.54 -An external hook is passed to the shell of the user running Mercurial. 2.55 -Features of that shell, such as variable substitution and command 2.56 -redirection, are available. The hook is run in the root directory of 2.57 -the repository (unlike in-process hooks, which are run in the same 2.58 -directory that Mercurial was run in). 2.59 - 2.60 -Hook parameters are passed to the hook as environment variables. Each 2.61 -environment variable's name is converted in upper case and prefixed 2.62 -with the string ``\texttt{HG\_}''. For example, if the name of a 2.63 -parameter is ``\texttt{node}'', the name of the environment variable 2.64 -representing that parameter will be ``\texttt{HG\_NODE}''. 2.65 - 2.66 -A boolean parameter is represented as the string ``\texttt{1}'' for 2.67 -``true'', ``\texttt{0}'' for ``false''. If an environment variable is 2.68 -named \envar{HG\_NODE}, \envar{HG\_PARENT1} or \envar{HG\_PARENT2}, it 2.69 -contains a changeset ID represented as a hexadecimal string. The 2.70 -empty string is used to represent ``null changeset ID'' instead of a 2.71 -string of zeroes. If an environment variable is named 2.72 -\envar{HG\_URL}, it will contain the URL of a remote repository, if 2.73 -that can be determined. 2.74 - 2.75 -If a hook exits with a status of zero, it is considered to have 2.76 -succeeded. If it exits with a non-zero status, it is considered to 2.77 -have failed. 2.78 - 2.79 -\subsection{Finding out where changesets come from} 2.80 - 2.81 -A hook that involves the transfer of changesets between a local 2.82 -repository and another may be able to find out information about the 2.83 -``far side''. Mercurial knows \emph{how} changes are being 2.84 -transferred, and in many cases \emph{where} they are being transferred 2.85 -to or from. 2.86 - 2.87 -\subsubsection{Sources of changesets} 2.88 +El parámetro \texttt{ui} es un objeto \pymodclass{mercurial.ui}{ui}. 2.89 +El parámetro \texttt{repo} es un objeto 2.90 +\pymodclass{mercurial.localrepo}{localrepository}. Los nombres y 2.91 +valores de los parámetros en \texttt{**kwargs} dependen del gancho que 2.92 +se invoque, con las siguientes características en común: 2.93 +\begin{itemize} 2.94 +\item Si hay un parámetro llamado \texttt{node} o 2.95 + \texttt{parent\emph{N}}, contendrá un ID hexadecimal de un conjunto 2.96 + de cambios. La cadena vacía es usada para representar un 2.97 + ``ID de conjunto de cambios nulo'' en vez de una cadena de ceros. 2.98 +\item Si hay un parámetro llamado \texttt{url}, contendrá la URL de un 2.99 + repositorio remoto, si puede ser determinada. 2.100 +\item Los parámetros booleanos son representados como objetos 2.101 + \texttt{bool} de Python. 2.102 +\end{itemize} 2.103 + 2.104 +Un gancho interno es ejecutado sin cambiar el directorio de trabajo 2.105 +del proceso (a diferencia de los ganchos externos, que son ejecutados 2.106 +desde la raíz del repositorio). El gancho no debe cambiar el 2.107 +directorio de trabajo del proceso, porque esto haría que falle 2.108 +cualquier llamada que se haga a la API de Mercurial. 2.109 + 2.110 +Si un gancho retorna el valor booleano ``false''\footnote{Falso.}, se 2.111 +considera que éste tuvo éxito. Si retorna 2.112 +``true''\footnote{Verdadero.} o genera una excepción, se considera que 2.113 +ha fallado. Una manera útil de pensar en esta convención de llamado es 2.114 +``dígame si usted falló''. 2.115 + 2.116 +Note que los IDs de conjuntos de cambios son pasados a los ganchos de 2.117 +Python como cadenas hexadecimales, no como los hashes binarios que la 2.118 +API de Mercurial usa normalmente. Para convertir un hash de 2.119 +hexadecimal a binario, use la función \pymodfunc{mercurial.node}{bin}. 2.120 + 2.121 +\subsection{Ejecución de ganchos externos} 2.122 + 2.123 +Un gancho externo es pasado al intérprete de comandos del usuario bajo 2.124 +el cual se ejecuta Mercurial. Las características del intérprete, como 2.125 +sustitución de variables y redirección de comandos, están disponibles. 2.126 +El gancho es ejecutado desde el directorio raíz del repositorio 2.127 +(a diferencia de los ganchos internos, que se ejecutan desde el mismo 2.128 +directorio en que Mercurial fue ejecutado). 2.129 + 2.130 +Los parámetros para el gancho se pasan como variables de entorno. El 2.131 +nombre de cada variable de entorno se pasa a mayúsculas y se le añade 2.132 +el prefijo ``\texttt{HG\_}''. Por ejemplo, si el nombre de un 2.133 +parámetro es ``\texttt{node}'', el nombre de la variable de entorno 2.134 +que almacena el parámetro se llamará ``\texttt{HG\_NODE}''. 2.135 + 2.136 +Un parámetro booleano se representa con la cadena ``\texttt{1}'' para 2.137 +``true'', ``\texttt{0}'' para ``false''. Si una variable se llama 2.138 +\envar{HG\_NODE}, \envar{HG\_PARENT1} o \envar{HG\_PARENT2}, 2.139 +contendrá un ID de conjunto de cambios representado como una cadena 2.140 +hexadecimal. La cadena vacía es usada para representar un ``ID de 2.141 +conjunto de cambios nulo'' en vez de una cadena de ceros. Si una 2.142 +variable de entorno se llama \envar{HG\_URL}, contendrá la URL de un 2.143 +repositorio remoto, si puede ser determinada. 2.144 + 2.145 +Si un gancho termina con un código de salida de cero, se considera que 2.146 +tuvo éxito. Si termina con un código de salida diferente de cero, se 2.147 +considera que falló. 2.148 + 2.149 +\subsection{Averiguar de dónde vienen los conjuntos de cambios} 2.150 +%TODO los trae la cigüeña. De París. Y quedan debajo de una col. 2.151 + 2.152 +Un gancho que involucra la transferencia de conjuntos de cambios entre 2.153 +un repositorio local y otro puede ser capaz de averiguar información 2.154 +acerca de ``el otro lado''. Mercurial sabe \emph{cómo} son 2.155 +transferidos los conjuntos de cambios, y en muchos casos también desde 2.156 +o hacia donde están siendo transferidos. 2.157 + 2.158 +\subsubsection{Fuentes de conjuntos de cambios} 2.159 \label{sec:hook:sources} 2.160 2.161 -Mercurial will tell a hook what means are, or were, used to transfer 2.162 -changesets between repositories. This is provided by Mercurial in a 2.163 -Python parameter named \texttt{source}, or an environment variable named 2.164 -\envar{HG\_SOURCE}. 2.165 - 2.166 -\begin{itemize} 2.167 -\item[\texttt{serve}] Changesets are transferred to or from a remote 2.168 - repository over http or ssh. 2.169 -\item[\texttt{pull}] Changesets are being transferred via a pull from 2.170 - one repository into another. 2.171 -\item[\texttt{push}] Changesets are being transferred via a push from 2.172 - one repository into another. 2.173 -\item[\texttt{bundle}] Changesets are being transferred to or from a 2.174 - bundle. 2.175 -\end{itemize} 2.176 - 2.177 -\subsubsection{Where changes are going---remote repository URLs} 2.178 +Mercurial le indicará a un gancho cuáles son, o fueron, los medios 2.179 +usados para transferir los conjuntos de cambios entre repositorios. 2.180 +Esta información es provista por Mercurial en un parámetro Python 2.181 +llamado \texttt{source}\footnote{Fuente.}, o una variable de entorno 2.182 +llamada \envar{HG\_SOURCE}. 2.183 + 2.184 +\begin{itemize} 2.185 +\item[\texttt{serve}] Los conjuntos de cambios son transferidos desde 2.186 + o hacia un repositorio remoto a través de http o ssh. 2.187 +\item[\texttt{pull}] Los conjuntos de cambios son transferidos vía una 2.188 + operación de jalado de un repositorio a otro. 2.189 +\item[\texttt{push}] Los conjuntos de cambios son transferidos vía un 2.190 + empuje de un repositorio a otro. 2.191 +\item[\texttt{bundle}] Los conjuntos de cambios son transferidos desde 2.192 + %TODO bundle 2.193 + o hacia un bundle. 2.194 +\end{itemize} 2.195 + 2.196 +\subsubsection{A dónde van los cambios---URLs de repositorios remotos} 2.197 \label{sec:hook:url} 2.198 - 2.199 -When possible, Mercurial will tell a hook the location of the ``far 2.200 -side'' of an activity that transfers changeset data between 2.201 -repositories. This is provided by Mercurial in a Python parameter 2.202 -named \texttt{url}, or an environment variable named \envar{HG\_URL}. 2.203 - 2.204 -This information is not always known. If a hook is invoked in a 2.205 -repository that is being served via http or ssh, Mercurial cannot tell 2.206 -where the remote repository is, but it may know where the client is 2.207 -connecting from. In such cases, the URL will take one of the 2.208 -following forms: 2.209 -\begin{itemize} 2.210 -\item \texttt{remote:ssh:\emph{ip-address}}---remote ssh client, at 2.211 - the given IP address. 2.212 -\item \texttt{remote:http:\emph{ip-address}}---remote http client, at 2.213 - the given IP address. If the client is using SSL, this will be of 2.214 - the form \texttt{remote:https:\emph{ip-address}}. 2.215 -\item Empty---no information could be discovered about the remote 2.216 - client. 2.217 +%TODO al cielo? no, ésos son los perros 2.218 + 2.219 +Cuando es posible, Mercurial le indicará a los ganchos la ubicación de 2.220 +``el otro lado'' de una actividad que transfiera datos de conjuntos de 2.221 +cambios entre repositorios. Esto es provisto por Mercurial en un 2.222 +parámetro Python llamado \texttt{url}, o en una variable de entorno 2.223 +llamada \envar{HG\_URL}. 2.224 + 2.225 +No siempre esta información está disponible. Si un gancho es invocado 2.226 +un repositorio que es servido a través de http o ssh, Mercurial no 2.227 +puede averiguar dónde está el repositorio remoto, pero puede saber 2.228 +desde dónde se conecta el cliente. En esos casos, la URL tendrá una de 2.229 +las siguientes formas: 2.230 +\begin{itemize} 2.231 +\item \texttt{remote:ssh:\emph{ip-address}}---cliente ssh remoto, en 2.232 + la dirección IP dada. 2.233 +\item \texttt{remote:http:\emph{ip-address}}---cliente remoto http, en 2.234 + la dirección IP dada. Si el cliente está usando SSL, tendrá la forma 2.235 + \texttt{remote:https:\emph{ip-address}}. 2.236 +\item Vacío---no se pudo descubrir información acerca del cliente 2.237 + remoto. 2.238 \end{itemize} 2.239 2.240 \section{Hook reference}