comparison es/branch.tex @ 441:6e427210bfe0

branches chapter translation finished
author Igor TAmara <igor@tamarapatino.org>
date Sun, 19 Oct 2008 17:08:11 -0500
parents 0aa96b0ffb65
children aa01d35ac59f
comparison
equal deleted inserted replaced
440:44dd3583c605 441:6e427210bfe0
218 \interaction{branch-repo.bugfix} 218 \interaction{branch-repo.bugfix}
219 Mientras tanto, el desarrollo para la siguiente versión mayor puede 219 Mientras tanto, el desarrollo para la siguiente versión mayor puede
220 continuar asilada e incólume, en el repositorio \texttt{myproject}. 220 continuar asilada e incólume, en el repositorio \texttt{myproject}.
221 \interaction{branch-repo.new} 221 \interaction{branch-repo.new}
222 222
223 \section{Don't repeat yourself: merging across branches} 223 \section{No repita trabajo: fusión entre ramas}
224 224
225 In many cases, if you have a bug to fix on a maintenance branch, the 225 En muchos casos, cuando tiene un fallo para arreglar en una rama de
226 chances are good that the bug exists on your project's main branch 226 mantenimiento, es muy probable que el fallo esté también en la rama
227 (and possibly other maintenance branches, too). It's a rare developer 227 principal( y posiblemente en otras ramas de mantenimiento
228 who wants to fix the same bug multiple times, so let's look at a few 228 también). Solamente un desarrollador extraño desearía corregir el
229 ways that Mercurial can help you to manage these bugfixes without 229 mismo fallo muchas veces, por tanto, veremos varias alternativas con
230 duplicating your work. 230 las que Mercurial puede ayudarle a administrar tales arreglos de fallo
231 231 sin duplicar su trabajo.
232 In the simplest instance, all you need to do is pull changes from your 232
233 maintenance branch into your local clone of the target branch. 233 En el caso más sencillo, basta con jalar los cambios de la rama de
234 mantenimiento a la rama obetivo en su clon local.
234 \interaction{branch-repo.pull} 235 \interaction{branch-repo.pull}
235 You'll then need to merge the heads of the two branches, and push back 236 A continuación deberá mezclar las cabezas de las dos ramas, y publicar
236 to the main branch. 237 de nuevo a la rama principal.
237 \interaction{branch-repo.merge} 238 \interaction{branch-repo.merge}
238 239
239 \section{Naming branches within one repositorio} 240 \section{Nombrar ramas dentro de un repositorio}
240 241
241 In most instances, isolating branches in repositorios is the right 242 La aproximación correcta en casi todas las oportunidades es aislar las
242 approach. Its simplicity makes it easy to understand; and so it's 243 ramas en los repositorios. Es fácil de entender gracias a su
243 hard to make mistakes. There's a one-to-one relationship between 244 facilidad; y es difícil cometer errores. Hay una relación uno a uno
244 branches you're working in and directories on your system. This lets 245 entre las ramas y los directorios con los que está trabajando en su
245 you use normal (non-Mercurial-aware) tools to work on files within a 246 sistema. Esto le permite usar emplear herramientas usuales(para los
246 branch/repositorio. 247 nuevos a Mercurial) para trabajar con los archivos dentro de su
247 248 rama/repositorio.
248 If you're more in the ``power user'' category (\emph{and} your 249
249 collaborators are too), there is an alternative way of handling 250 Si se encuentra más en la categoría ``usuario diestro'' (\emph{y} sus
250 branches that you can consider. I've already mentioned the 251 colaboradores también), puede considerar otra alternativa para
251 human-level distinction between ``small picture'' and ``big picture'' 252 administrar las ramas. He mencionador con anterioridad la distinción a
252 branches. While Mercurial works with multiple ``small picture'' 253 nivel humano entre las ramas estilo ``cuadro pequeño'' y ``gran
253 branches in a repositorio all the time (for example after you pull 254 cuadro''. Mientras que Mercurial trabaja con muchas ramas del estilo
254 changes in, but before you merge them), it can \emph{also} work with 255 ``cuadro pequeño'' en el repositorio todo el tiempo(por ejemplo cuando
255 multiple ``big picture'' branches. 256 usted jala cambios, pero antes de fusionarlos), \emph{también} puede
256 257 trabajar con varias ramas del ``cuadro grande''.
257 The key to working this way is that Mercurial lets you assign a 258
258 persistent \emph{name} to a branch. There always exists a branch 259 El truco para trabajar de esta forma en Mercurial se logra gracias a
259 named \texttt{default}. Even before you start naming branches 260 que puede asignar un \emph{nombre} persistente a una rama. Siempre
260 yourself, you can find traces of the \texttt{default} branch if you 261 existe una rama llamada \texttt{default}. Incluso antes de que
261 look for them. 262 empiece a nombrar ramas por su cuenta, puede encontrar indicios de la
262 263 rama \texttt{default} si los busca.
263 As an example, when you run the \hgcmd{commit} command, and it pops up 264
264 your editor so that you can enter a commit message, look for a line 265 Por ejemplo, cuando invoca la orden \hgcmd{commit}, y se lanza su
265 that contains the text ``\texttt{HG: branch default}'' at the bottom. 266 editor para introducir el mensaje de la consignación, busque la línea
266 This is telling you that your commit will occur on the branch named 267 que contiene el texto ``\texttt{HG: branch default}'' al final. Le
268 está indicando que su consignación ocurrirá en la rama llamada
267 \texttt{default}. 269 \texttt{default}.
268 270
269 To start working with named branches, use the \hgcmd{branches} 271 Use la orden \hgcmd{branches} para comenzar a trabajar con ramas
270 command. This command lists the named branches already present in 272 nombradas. Esta orden mostrará las ramas presentes en su repositorio,
271 your repositorio, telling you which changeset is the tip of each. 273 indicándole en qué conjunto de cambios está cada una.
272 \interaction{branch-named.branches} 274 \interaction{branch-named.branches}
273 Since you haven't created any named branches yet, the only one that 275 Dado que todavía no ha creado ramas nombradas, la única que verá sería
274 exists is \texttt{default}. 276 \texttt{default}.
275 277
276 To find out what the ``current'' branch is, run the \hgcmd{branch} 278 Para hallar cuál es la rama ``actual'', invoque la orden
277 command, giving it no arguments. This tells you what branch the 279 \hgcmd{branch}, sin argumento alguno. Le informará en qué rama se
278 parent of the current changeset is on. 280 encuentra el padre del conjunto actual de cambios.
279 \interaction{branch-named.branch} 281 \interaction{branch-named.branch}
280 282
281 To create a new branch, run the \hgcmd{branch} command again. This 283 Para crear una nueva rama, invoque la orden \hgcmd{branch} de
282 time, give it one argument: the name of the branch you want to create. 284 nuevo. En esta oportunidad, ofrezca un argumento: el nombre de la rama
285 que desea crear.
283 \interaction{branch-named.create} 286 \interaction{branch-named.create}
284 287
285 After you've created a branch, you might wonder what effect the 288 Después de crear la rama, usted podría desear ver el efecto que tuvo
286 \hgcmd{branch} command has had. What do the \hgcmd{status} and 289 la orden \hgcmd{branch}. ¿Qué reportan las ordenes \hgcmd{status} y
287 \hgcmd{tip} commands report? 290 \hgcmd{tip} commands report?
288 \interaction{branch-named.status} 291 \interaction{branch-named.status}
289 Nothing has changed in the working directory, and there's been no new 292 Nada cambia en el directorio actual, y no se ha añadido nada a la
290 history created. As this suggests, running the \hgcmd{branch} command 293 historia. Esto sugiere que al ejecutar la orden \hgcmd{branch} no hay
291 has no permanent effect; it only tells Mercurial what branch name to 294 un efecto permanente; solamente le indica a que nombre de rama usará
292 use the \emph{next} time you commit a changeset. 295 la \emph{próxima} vez que consigne un conjunto de cambios.
293 296
294 When you commit a change, Mercurial records the name of the branch on 297 Cuando consigna un cambio, Mercurial alamacena el nombre de la rama en
295 which you committed. Once you've switched from the \texttt{default} 298 la cual consignó. Una vez que haya cambiado de la rama \texttt{default}
296 branch to another and committed, you'll see the name of the new branch 299 y haya consignado, verá que el nombre de la nueva rama se mostrará
297 show up in the output of \hgcmd{log}, \hgcmd{tip}, and other commands 300 cuando use la orden \hgcmd{log}, \hgcmd{tip}, y otras órdenes que
298 that display the same kind of output. 301 desplieguen la misma clase de información.
299 \interaction{branch-named.commit} 302 \interaction{branch-named.commit}
300 The \hgcmd{log}-like commands will print the branch name of every 303 Las órdenes del tipo \hgcmd{log} imprimirán el nombre de la rama de
301 changeset that's not on the \texttt{default} branch. As a result, if 304 cualquier conjunto de cambios que no estén en la rama
302 you never use named branches, you'll never see this information. 305 \texttt{default}. Como resultado, si nunca usa ramas nombradas, nunca
303 306 verá esta información.
304 Once you've named a branch and committed a change with that name, 307
305 every subsequent commit that descends from that change will inherit 308 Una vez que haya nombrado una rama y consignado un cambio con ese
306 the same branch name. You can change the name of a branch at any 309 nombre, todas las consignaciones subsecuentes que desciendan de ese
307 time, using the \hgcmd{branch} command. 310 cambio heredarán el mismo nombre de rama. Puede cambiar el nombre de
311 una rama en cualquier momento con la orden \hgcmd{branch}.
308 \interaction{branch-named.rebranch} 312 \interaction{branch-named.rebranch}
309 In practice, this is something you won't do very often, as branch 313 Esto es algo que no hará muy seguido en la práctica, debido que los
310 names tend to have fairly long lifetimes. (This isn't a rule, just an 314 nombres de las ramas tienden a tener vidas largas. (Esto no es una
311 observation.) 315 regla, solamente una observación.)
312 316
313 \section{Dealing with multiple named branches in a repositorio} 317 \section{Tratamiento de varias ramas nombradas en un repositorio}
314 318
315 If you have more than one named branch in a repositorio, Mercurial will 319 Si tiene más de una rama nombrada en un repositorio, Mercurial
316 remember the branch that your working directory on when you start a 320 recordará la rama en la cual está su directorio de trabajo cuando
317 command like \hgcmd{update} or \hgcmdargs{pull}{-u}. It will update 321 invoque una orden como \hgcmd{update} o \hgcmdargs{pull}{-u}. Se
318 the working directory to the tip of this branch, no matter what the 322 actualizará su directorio de trabajo actual al tip de esta rama, sin
319 ``repo-wide'' tip is. To update to a revision that's on a different 323 importar cuál sea el tip ``a lo largo del repositorio'' . Para
320 named branch, you may need to use the \hgopt{update}{-C} option to 324 actualiar a una revisión que está en una rama con distinto nombre,
321 \hgcmd{update}. 325 puede necesitar la opción \hgopt{update}{-C} de \hgcmd{update}.
322 326
323 This behaviour is a little subtle, so let's see it in action. First, 327 Este comportamiento puede ser sutil, veámoslo en acción. Primero,
324 let's remind ourselves what branch we're currently on, and what 328 recordemos en qué rama estamos trabajando, y qué ramas están en
325 branches are in our repositorio. 329 nuestro repositorio.
326 \interaction{branch-named.parents} 330 \interaction{branch-named.parents}
327 We're on the \texttt{bar} branch, but there also exists an older 331 Estamos en la rama \texttt{bar}, pero existe otra rama más antigua
328 \hgcmd{foo} branch. 332 llamada \hgcmd{foo}.
329 333
330 We can \hgcmd{update} back and forth between the tips of the 334 Podemos hacer \hgcmd{update} entre los tipos de las ramas \texttt{foo}
331 \texttt{foo} and \texttt{bar} branches without needing to use the 335 y \texttt{bar} sin necesidad de usar la opción \hgopt{update}{-C},
332 \hgopt{update}{-C} option, because this only involves going backwards 336 puesto que esto solamente implica ir linealmente hacia adelante y
333 and forwards linearly through our change history. 337 atrás en nuestra historia de cambios.
334 \interaction{branch-named.update-switchy} 338 \interaction{branch-named.update-switchy}
335 339
336 If we go back to the \texttt{foo} branch and then run \hgcmd{update}, 340 Si volvemos a la rama \texttt{foo} e invocamos la orden \hgcmd{update},
337 it will keep us on \texttt{foo}, not move us to the tip of 341 nos mantendrá en \texttt{foo}, sin movernos al tipo de \texttt{bar}.
342 \interaction{branch-named.update-nothing}
343
344 Al consignar un cambio a la rama \texttt{foo} se introducirá una nueva
345 cabeza.
346 \interaction{branch-named.foo-commit}
347
348 \section{Nombres de ramas y fusiones}
349
350 Posiblemente ha notado que las fusiones en Mercurial no son simétricas.
351 Supongamos que su repositorio tiene dos cabezas, 17 and 23. Si yo invoco
352 \hgcmd{update} a 17 y aplico \hgcmd{merge} a 23, Mercurial almacena 17
353 como el primer padre de la fusión, y 23 como el segundo. Mientras que
354 si hago \hgcmd{update} a 23 y después aplico \hgcmd{merge} con 17,
355 grabará a 23 como el primer padre, y 17 como el segundo.
356
357 Esto afecta com elige Mercurial el nombre de la rama cuando hace
358 fusión. Después de una fusión Mercurial mantendrá el nombre de la
359 rama del primer padre cuando consigne el resultado de una fusión. Si
360 el primer nombre de su padre es \texttt{foo}, y fusiona con
361 \texttt{bar}, el nombre de la rama continuará siendo \texttt{foo}
362 después de fusionar.
363
364 No es inusual que un repositorio contenga varias cabezas, cada una con
365 el mismo nombre de rama. Digamos que estoy trabajando en la rama
366 \texttt{foo}, y usted también. Consignamos cambios distintos; Yo jalo
367 sus cambios; Ahora tengo dos cabezas, cada una afirmando estar en la
368 rama \texttt{foo}. El resultado de una fusión será una única cabeza
369 en la rama \texttt{foo} como usted esperaría.
370
371 Pero si estoy trabajando en la rama \texttt{bar}, y fusiono el trabajo
372 desde la rama \texttt{foo}, el resultado permanecerá en la rama
338 \texttt{bar}. 373 \texttt{bar}.
339 \interaction{branch-named.update-nothing}
340
341 Committing a new change on the \texttt{foo} branch introduces a new
342 head.
343 \interaction{branch-named.foo-commit}
344
345 \section{Branch names and merging}
346
347 As you've probably noticed, merges in Mercurial are not symmetrical.
348 Let's say our repositorio has two heads, 17 and 23. If I
349 \hgcmd{update} to 17 and then \hgcmd{merge} with 23, Mercurial records
350 17 as the first parent of the merge, and 23 as the second. Whereas if
351 I \hgcmd{update} to 23 and then \hgcmd{merge} with 17, it records 23
352 as the first parent, and 17 as the second.
353
354 This affects Mercurial's choice of branch name when you merge. After
355 a merge, Mercurial will retain the branch name of the first parent
356 when you commit the result of the merge. If your first parent's
357 branch name is \texttt{foo}, and you merge with \texttt{bar}, the
358 branch name will still be \texttt{foo} after you merge.
359
360 It's not unusual for a repositorio to contain multiple heads, each with
361 the same branch name. Let's say I'm working on the \texttt{foo}
362 branch, and so are you. We commit different changes; I pull your
363 changes; I now have two heads, each claiming to be on the \texttt{foo}
364 branch. The result of a merge will be a single head on the
365 \texttt{foo} branch, as you might hope.
366
367 But if I'm working on the \texttt{bar} branch, and I merge work from
368 the \texttt{foo} branch, the result will remain on the \texttt{bar}
369 branch.
370 \interaction{branch-named.merge} 374 \interaction{branch-named.merge}
371 375
372 To give a more concrete example, if I'm working on the 376 En un ejemplo más concreo, si yo estoy trabajando en la rama
373 \texttt{bleeding-edge} branch, and I want to bring in the latest fixes 377 \texttt{bleeding-edge}, y deseo traer los arreglos más recientes de la
374 from the \texttt{stable} branch, Mercurial will choose the ``right'' 378 rama \texttt{estable}, Mercurial elegirá el nombre de rama ``correcto''
375 (\texttt{bleeding-edge}) branch name when I pull and merge from 379 (\texttt{bleeding-edge}) cuando yo jale una fusión desde \texttt{estable}.
376 \texttt{stable}. 380
377 381 \section{Normalmente es útil nombrar ramas}
378 \section{Branch naming is generally useful} 382
379 383 No debería considerar que las ramas nombradas son aplicables
380 You shouldn't think of named branches as applicable only to situations 384 únicamente en situaciones con muchas ramas de larga-vida cohabitando
381 where you have multiple long-lived branches cohabiting in a single 385 en un mismo repositorio. Son muy útiles incluso en los casos de
382 repositorio. They're very useful even in the one-branch-per-repositorio 386 una-rama-por-repositorio.
383 case. 387
384 388 En el caso más sencillo, dar un nombre a cada rama ofrece un registro
385 In the simplest case, giving a name to each branch gives you a 389 permanente acerca de en qué conjunto de cambios se generó la rama.
386 permanent record of which branch a changeset originated on. This 390 Esto le ofrece más contexto cuando esté tratando de seguir la
387 gives you more context when you're trying to follow the history of a 391 historia de un proyecto ramificado de larga vida.
388 long-lived branchy project. 392
389 393 Si está trabajando con repositorios compartidos, puede configurar el gancho
390 If you're working with shared repositorios, you can set up a 394 \hook{pretxnchangegroup} para que cada uno bloquee los cambios con
391 \hook{pretxnchangegroup} hook on each that will block incoming changes 395 nombres de rama ``incorrectos'' que están por adicionarse. Este
392 that have the ``wrong'' branch name. This provides a simple, but 396 provee una defensa sencilla pero efectiva para evitar que la gente
393 effective, defence against people accidentally pushing changes from a 397 accidentalmente publique cambios de una rama ``super nueva'' a la rama
394 ``bleeding edge'' branch to a ``stable'' branch. Such a hook might 398 ``estable''. Tal gancho podría verse de la siguiente forma dentro de
395 look like this inside the shared repo's \hgrc. 399 un repositorio compartido de \hgrc.
396 \begin{codesample2} 400 \begin{codesample2}
397 [hooks] 401 [hooks]
398 pretxnchangegroup.branch = hg heads --template '{branches} ' | grep mybranch 402 pretxnchangegroup.branch = hg heads --template '{branches} ' | grep mybranch
399 \end{codesample2} 403 \end{codesample2}
400 404