hgbook

diff es/undo.tex @ 398:c368e324eeb2

Finished translating bisect
author Igor TAmara <igor@tamarapatino.org>
date Thu Nov 06 23:06:16 2008 -0500 (2008-11-06)
parents b8d9066abcea
children f89ee6f63ea2
line diff
     1.1 --- a/es/undo.tex	Wed Nov 05 23:04:06 2008 -0500
     1.2 +++ b/es/undo.tex	Thu Nov 06 23:06:16 2008 -0500
     1.3 @@ -577,109 +577,113 @@
     1.4  repositorio.  Puede evitar ramas enteras de historia con un solo
     1.5  sondeo.
     1.6  
     1.7 -\subsection{Using the \hgcmd{bisect} command}
     1.8 -
     1.9 -Here's an example of \hgcmd{bisect} in action.
    1.10 +\subsection{Uso de la orden \hgcmd{bisect}}
    1.11 +
    1.12 +A continuación un ejemplo de \hgcmd{bisect} en acción.
    1.13  
    1.14  \begin{note}
    1.15 -  In versions 0.9.5 and earlier of Mercurial, \hgcmd{bisect} was not a
    1.16 -  core command: it was distributed with Mercurial as an extension.
    1.17 -  This section describes the built-in command, not the old extension.
    1.18 +  En las versiones 0.9.5 y anteriores de Mercurial, \hgcmd{bisect} no
    1.19 +  era una orden incluída en la distribución principal: se ofrecía como
    1.20 +  una extensión de Mercurial. Esta sección describe la orden embebida
    1.21 +  y no la extensión anterior.
    1.22  \end{note}
    1.23  
    1.24 -Now let's create a repository, so that we can try out the
    1.25 -\hgcmd{bisect} command in isolation.
    1.26 +Creamos un repostorio para probar el comando \hgcmd{bisect} de forma
    1.27 +aislada
    1.28  \interaction{bisect.init}
    1.29 -We'll simulate a project that has a bug in it in a simple-minded way:
    1.30 -create trivial changes in a loop, and nominate one specific change
    1.31 -that will have the ``bug''.  This loop creates 35 changesets, each
    1.32 -adding a single file to the repository.  We'll represent our ``bug''
    1.33 -with a file that contains the text ``i have a gub''.
    1.34 +Simularemos de forma sencilla un proyecto con un fallo: haremos
    1.35 +cambios triviales en un ciclo, e indicaremos que un cambio específico
    1.36 +sea el ``fallo''.  Este ciclo crea 35 conjuntos de cambios, cada uno
    1.37 +añade un único archivo al repositorio. Representaremos nuestro ``fallo''
    1.38 +con un fichero que contiene el texto ``tengo un gub''.
    1.39  \interaction{bisect.commits}
    1.40  
    1.41 -The next thing that we'd like to do is figure out how to use the
    1.42 -\hgcmd{bisect} command.  We can use Mercurial's normal built-in help
    1.43 -mechanism for this.
    1.44 +A continuación observaremos cómo usar la orden \hgcmd{bisect}. Podemos
    1.45 +usar el mecanismo de ayuda embebida que trae Mercurial.
    1.46  \interaction{bisect.help}
    1.47  
    1.48 -The \hgcmd{bisect} command works in steps.  Each step proceeds as follows.
    1.49 +La orden \hgcmd{bisect} trabaja en etapas, de la siguiente forma:
    1.50  \begin{enumerate}
    1.51 -\item You run your binary test.
    1.52 +\item Usted ejecuta una prueba binaria.
    1.53    \begin{itemize}
    1.54 -  \item If the test succeeded, you tell \hgcmd{bisect} by running the
    1.55 -    \hgcmdargs{bisect}{good} command.
    1.56 -  \item If it failed, run the \hgcmdargs{bisect}{--bad} command.
    1.57 +  \item Si la prueba es exitosa, usted se lo indicará a \hgcmd{bisect}
    1.58 +    ejecutando la orden \hgcmdargs{bisect}{good}.
    1.59 +  \item Si falla, ejecutará la orden \hgcmdargs{bisect}{--bad}.
    1.60    \end{itemize}
    1.61 -\item The command uses your information to decide which changeset to
    1.62 -  test next.
    1.63 -\item It updates the working directory to that changeset, and the
    1.64 -  process begins again.
    1.65 +\item La orden usa su información para decidir qué conjuntos de
    1.66 +  cambios deben probarse a continuación.
    1.67 +\item Actualiza el directorio de trabajo a tal conjunto de cambios y
    1.68 +  el proceso se lleva a cabo de nuevo.
    1.69  \end{enumerate}
    1.70 -The process ends when \hgcmd{bisect} identifies a unique changeset
    1.71 -that marks the point where your test transitioned from ``succeeding''
    1.72 -to ``failing''.
    1.73 -
    1.74 -To start the search, we must run the \hgcmdargs{bisect}{--reset} command.
    1.75 +El proceso termina cuando \hgcmd{bisect} identifica un único conjunto
    1.76 +de cambios que marca el punto donde se encontró la transición de
    1.77 +``exitoso'' a ``fallido''.
    1.78 +
    1.79 +Para comenzar la búsqueda, es indispensable ejecutar la orden
    1.80 +\hgcmdargs{bisect}{--reset}.
    1.81  \interaction{bisect.search.init}
    1.82  
    1.83 -In our case, the binary test we use is simple: we check to see if any
    1.84 -file in the repository contains the string ``i have a gub''.  If it
    1.85 -does, this changeset contains the change that ``caused the bug''.  By
    1.86 -convention, a changeset that has the property we're searching for is
    1.87 -``bad'', while one that doesn't is ``good''.
    1.88 -
    1.89 -Most of the time, the revision to which the working directory is
    1.90 -synced (usually the tip) already exhibits the problem introduced by
    1.91 -the buggy change, so we'll mark it as ``bad''.
    1.92 +En nuestro caso, la prueba binaria es sencilla: revisamos si el
    1.93 +archivo en el repositorio contiene la cadena ``tengo un gub''.  Si la
    1.94 +tiene, este conjunto de cambios contiene aquel que ``causó el fallo''.
    1.95 +Por convención, un conjunto de cambios que tiene la propiedad que
    1.96 +estamos buscando es ``malo'', mientras que el otro que no la tiene es
    1.97 +``bueno''.
    1.98 +
    1.99 +En la mayoría de casos, la revisión del directorio actual (usualmente
   1.100 +la punta) exhibe el problema introducido por el cambio con el fallo,
   1.101 +por lo tanto la marcaremos como ``mala''.
   1.102  \interaction{bisect.search.bad-init}
   1.103  
   1.104 -Our next task is to nominate a changeset that we know \emph{doesn't}
   1.105 -have the bug; the \hgcmd{bisect} command will ``bracket'' its search
   1.106 -between the first pair of good and bad changesets.  In our case, we
   1.107 -know that revision~10 didn't have the bug.  (I'll have more words
   1.108 -about choosing the first ``good'' changeset later.)
   1.109 +Nuestra próxima tarea es nominar al conjunto de cambios que sabemos
   1.110 +\emph{no} tiene el fallo; la orden \hgcmd{bisect} ``acotará'' su
   1.111 +búsqueda entre el primer par de conjuntos de cambios buenos y malos.
   1.112 +En nuestro caso, sabemos que la revisión~10 no tenía el fallo.  (Más
   1.113 +adelante diré un poco más acerca de la elección del conjunto de
   1.114 +cambios ``bueno''.)
   1.115  \interaction{bisect.search.good-init}
   1.116  
   1.117 -Notice that this command printed some output.
   1.118 +Note que esta orden mostró algo.
   1.119  \begin{itemize}
   1.120 -\item It told us how many changesets it must consider before it can
   1.121 -  identify the one that introduced the bug, and how many tests that
   1.122 -  will require.
   1.123 -\item It updated the working directory to the next changeset to test,
   1.124 -  and told us which changeset it's testing.
   1.125 +\item Nos dijo cuántos conjuntos de cambios debe considerar antes de
   1.126 +  que pueda identifica aquel que introdujo el fallo, y cuántas pruebas
   1.127 +  se requerirán.
   1.128 +\item Actualizó el directorio de trabajo al siguiente conjunto de
   1.129 +  cambios, y nos dijo qué conjunto de cambios está evaluando.
   1.130  \end{itemize}
   1.131  
   1.132 -We now run our test in the working directory.  We use the
   1.133 -\command{grep} command to see if our ``bad'' file is present in the
   1.134 -working directory.  If it is, this revision is bad; if not, this
   1.135 -revision is good.
   1.136 +Ahora ejecutamos nuestra prueba en el directorio de trabajo. Usamos la
   1.137 +orden \command{grep} para ver si nuestro fichero ``malo'' está
   1.138 +presente en el directorio de trabajo.  Si lo está, esta revisión es
   1.139 +mala; si no esta revisión es buena.
   1.140  \interaction{bisect.search.step1}
   1.141  
   1.142 -This test looks like a perfect candidate for automation, so let's turn
   1.143 -it into a shell function.
   1.144 +Esta prueba luce como candidata perfecta para automatizarse, por lo
   1.145 +tanto la convertimos en una función de interfaz de comandos.
   1.146  \interaction{bisect.search.mytest}
   1.147 -We can now run an entire test step with a single command,
   1.148 +Ahora podemos ejecutar un paso entero de pruebas con un solo comando,
   1.149  \texttt{mytest}.
   1.150  \interaction{bisect.search.step2}
   1.151 -A few more invocations of our canned test step command, and we're
   1.152 -done.
   1.153 +Unas invocaciones más de nuestra prueba, y hemos terminado.
   1.154  \interaction{bisect.search.rest}
   1.155  
   1.156 -Even though we had~40 changesets to search through, the \hgcmd{bisect}
   1.157 -command let us find the changeset that introduced our ``bug'' with
   1.158 -only five tests.  Because the number of tests that the \hgcmd{bisect}
   1.159 -command performs grows logarithmically with the number of changesets to
   1.160 -search, the advantage that it has over the ``brute force'' search
   1.161 -approach increases with every changeset you add.
   1.162 -
   1.163 -\subsection{Cleaning up after your search}
   1.164 -
   1.165 -When you're finished using the \hgcmd{bisect} command in a
   1.166 -repository, you can use the \hgcmdargs{bisect}{reset} command to drop
   1.167 -the information it was using to drive your search.  The command
   1.168 -doesn't use much space, so it doesn't matter if you forget to run this
   1.169 -command.  However, \hgcmd{bisect} won't let you start a new search in
   1.170 -that repository until you do a \hgcmdargs{bisect}{reset}.
   1.171 +Aunque teníamos unos~40 conjuntos de cambios en los cuales buscar, la
   1.172 +orden \hgcmd{bisect} nos permitió encontrar el conjunto de cambios que
   1.173 +introdujo el ``fallo'' con sólo cinco pruebas.  Porque el número de
   1.174 +pruebas que la orden \hgcmd{bisect} ejecuta crece logarítmicamente con
   1.175 +la cantidad de conjuntos de cambios a buscar, la ventaja que esto
   1.176 +tiene frente a la  búsqueda por``fuerza bruta'' crece con cada
   1.177 +conjunto de cambios que usted adicione.
   1.178 +
   1.179 +\subsection{Limpieza después de la búsqueda}
   1.180 +
   1.181 +Cuando haya terminado de usar la orden \hgcmd{bisect} en un
   1.182 +repositorio, puede usar la orden \hgcmdargs{bisect}{reset} para
   1.183 +deshacerse de la información que se estaba usando para lograr la
   1.184 +búsqueda. Lar orden no usa mucho espacio, así que no hay problema si
   1.185 +olvida ejecutar la orden.  En todo caso, \hgcmd{bisect} no le
   1.186 +permitirá comenzar una nueva búsqueda sobre el repositorio hasta que
   1.187 +no aplique \hgcmdargs{bisect}{reset}.
   1.188  \interaction{bisect.search.reset}
   1.189  
   1.190  \section{Tips for finding bugs effectively}