annotate es/mq.tex @ 542:2daeda01fe98

Started mq, please do look the translation terms about push and pop on this context
author Igor TAmara <igor@tamarapatino.org>
date Sun, 07 Dec 2008 17:47:38 -0500
parents aeda195f54a6
children da4d34e0e250
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
539
aeda195f54a6 Finally finished translating collab and taking mq and hgext
Igor TAmara <igor@tamarapatino.org>
parents: 435
diff changeset
1 \chapter{Administración de cambios con Colas de Mercurial}
435
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
2 \label{chap:mq}
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
3
539
aeda195f54a6 Finally finished translating collab and taking mq and hgext
Igor TAmara <igor@tamarapatino.org>
parents: 435
diff changeset
4 \section{El problema de la administración de parches}
435
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
5 \label{sec:mq:patch-mgmt}
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
6
542
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
7 Un escenario frecuente: usted necesita instalar un paquete de software
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
8 desde las fuentes, pero encuentra un fallo que debe arreglar antes de
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
9 poder comenzar a usarlo. Hace sus cambios, y se olvida del paquete
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
10 por un tiempo, unos meses después necesita actualizar a una nueva
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
11 versión del paquete. Si la nueva versión del paquete todavía tiene el
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
12 fallo, debe extraer su arreglo del árbol de fuentes anteriores y
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
13 aplicarlo a la nueva versión. Una tarea tediosa en la cual es fácil
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
14 equivocarse.
435
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
15
542
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
16 Este es un caso simple del problema del ``manejo de parches''. Usted
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
17 tiene un árbol de fuentes del ``mantenedor principal'' que no puede
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
18 cambiar: necesita hacer algunos cambios locales sobre el árbol
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
19 principal; y desearía poder mantener tales cambios separados, de forma
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
20 tal que pueda aplicarlos a versiones más nuevas del árbol principal.
435
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
21
542
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
22 El problema de administración de parches surge en muchas situaciones.
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
23 Probablemente la más visible es cuando un usuario de un proyecto de
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
24 software de fuentes abiertas contribuye con un arreglo de un fallo o
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
25 una nueva característica a los mantenedores del proyecto en la forma
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
26 de un parche.
435
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
27
542
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
28 Aquellos que distribuyen sistemas operativos que incluyen programas
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
29 abiertos usualmente requieren hacer cambios en los paquetes que
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
30 distribuyen de tal forma que se armen apropiadamente en sus ambientes.
435
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
31
542
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
32 Cuando hay pocos cambios por mantener, es muy sencillo administrar un
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
33 solo parche con los programas estándar \command{diff} y
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
34 \command{patch}( ver la sección~\ref{sec:mq:patch} para ver cómo
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
35 emplear tales herramientas). Cuando la cantidad de cambios comienza a
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
36 crecer, tiene sentido mantener parches como ``porciones de trabajo''
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
37 individual, de forma que cada cambio contiene solamente un arreglo de
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
38 un fallo(el parche puede modificar varios archivos, pero está
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
39 ``haciendo una sola cosa''), y puede tener cierta cantidad de tales
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
40 parches para diferentes fallos y cambios locales. En esta situación,
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
41 si envía un parche que arregla un fallo a los mantenedores principales
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
42 de un paquete y ellos incluyen su arreglo en una publicación
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
43 posterior, puede deshacerse de tal parche cuando se actualice a la
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
44 nueva versión.
435
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
45
542
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
46 Mantener un solo parche frente a un árbol principal es algo tedioso y
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
47 es fácil equivocarse, pero no es difícil. Aunque, la complejidad del
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
48 problema crece rápidamente a medida que la cantidad de parches que
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
49 tiene que mantener crece. Con más que una pequeña cantidad de
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
50 cambios, entender cuáles ha aplicado se convierte de algo desordenado
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
51 a algo avasallante.
435
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
52
542
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
53 Afortunadamente Mercurial provee una extensión poderos: Colas de
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
54 Mercurial( o simplemente ``MQ''), que simplifica en gran medida el
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
55 problema de administración de parches.
435
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
56
542
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
57 \section{La prehistoria de las Colas de Mercurial}
435
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
58 \label{sec:mq:history}
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
59
542
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
60 A finales de los 90s, muchos desarrolladores del núcleo de Linux
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
61 comenzaron a mantener ``series de parches'' que modificaron el
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
62 comportamiento del núcleo de Linux. Algunos se enfocaban en
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
63 estabilidad, otros en aumentar las características, y otros un poco
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
64 más especulativos.
435
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
65
542
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
66 Los tamaños de las series de parches crecieron rápidamente. En el
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
67 2002, Andrew Morton publicó algunos guiones de línea de órdenes que
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
68 estuvo usando para automatizar la tarea de administrar su cola de
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
69 parches. Andrew usó exitósamente tales guiones para administrar
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
70 centenas( aveces millares) de parches en el núcleo de Linux.
435
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
71
542
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
72 \subsection{Trabajar parches con quilt}
435
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
73 \label{sec:mq:quilt}
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
74
542
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
75 A comienzos del 2003, Andreas Gruenbacher y Martin Quinson tomaron la
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
76 aproximación de los guiones de Andrew y publicaron una herramienta
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
77 llamada
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
78 ``patchwork quilt''~\cite{web:quilt}, o simplemente ``quilt''
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
79 (ver~\cite{gruenbacher:2005} el paper que lo describe). Dado que
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
80 quilt automatizaba sustancialmente la administración de parches, fue
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
81 adoptado en gran medida por desarrolladores de programas abiertos.
435
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
82
542
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
83 Quilt maneja una \emph{pila de parches} sobre un árbol de directorios.
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
84 Para comenzar, usted le indica a quilt que administre un árbol de
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
85 directorios, le indica qué archivos manejar; Este almacena los nombres
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
86 y los contenidos de estos archivos. Para arreglar un fallo, usted
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
87 crea un nuevo parche(con una sola orden), edita los archivos que está
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
88 arreglando y ``refresca'' el parche.
435
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
89
542
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
90 El paso de refresco hace que quilt revise el árbol de directorios;
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
91 actualiza el parche con todos los cambios que usted haya hecho. Puede
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
92 crear otro parche sobre el primero, que hará seguimiento de los
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
93 cambios requeridos para modificar el árbol desde ``el árbol con un
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
94 parch aplicado'' a un ``árbol con dos parches aplicados''.
435
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
95
542
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
96 Usted puede \emph{elegir} qué cambios desea aplicar al árbol. Si
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
97 ``pop''\ndt{saca} un parche, los cambios hechos por tal parchve
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
98 desapareceŕan del árbol de directorios. Quilt recuerda qué parches ha
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
99 sacado, para que pueda ``introducirlos''\ndt{push} posteriormente, así el
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
100 árbol de directorios se restaurará con las modificaciones que vienen
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
101 del parche. Lo más importante es que puede ejecutar la orden
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
102 ``refresh'' en cualquier momento, y el último parche será
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
103 actualizado. Esto significa que puede, en cualquier momento, cambiar
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
104 qué parches serán aplicados y qué modificaciones hacen ellos.
435
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
105
542
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
106 Quilt no tiene nada que ver con herramientas de control de versiones,
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
107 y puede trabajar bien sobre un conjunto de fuentes que viene de un
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
108 archivo comprimido y empaquetado o una copia de trabajo de Subversion.
435
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
109
542
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
110 \subsection{Pasar de trabajo con parches con Quilt hacia Colas de Mercurial}
435
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
111 \label{sec:mq:quilt-mq}
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
112
542
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
113 A mediados de 2005, Chris Mason tomó las características de quilt y
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
114 escribió una extensión que llamó Colas de Mercurial\ndt{Mercurial
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
115 Queues}, que proporcionó un comportamiento a Mercurial al estilo
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
116 quilt.
435
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
117
542
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
118 La diferencia clave entre quilt y MQ es que quilt no sabe nada acerca
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
119 del sistema de control de revisiones, mientras que MQ está
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
120 \emph{integrado} con Mercurial. Cada parche que usted introduce se
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
121 representa como un conjunto de cambios en Mercurial. Si sustrae un
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
122 parche, el conjunto de cambios desaparece.\ndt{introduce originalmente es
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
123 push y pop es sustraer en este contexto, usaremos el original en inglés
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
124 cuando encontremos que facilita la comprensión}
435
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
125
542
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
126 Dado que quilt no se preocupa por las herramientas de control de
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
127 revisiones, continúa siendo una porción de software tremendamente útil
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
128 para aquellas situaciones en las cuales no puede usar Mercurial y MQ.
435
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
129
542
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
130 \section{La gran ventaja de MQ}
435
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
131
542
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
132 No puedo sobreestimar el valor que MQ ofrece en la unificación de
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
133 parches y el control de revisiones.
435
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
134
542
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
135 La principal razón por la cual los parches han persistido en el mundo
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
136 del software libre y de fuentes abiertas--a pesar de la creciente
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
137 disponibilidad de herramientas poderosas de control de revisiones-- es
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
138 la \emph{agilidad} que ofrecen.
435
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
139
542
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
140 Las herramientas tradicionales de control de revisiones llevan un
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
141 registro permanente e irreversible de todo lo que usted hace. A pesar
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
142 de que esto tiene gran valor, también es bastante sutil. Si requiere
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
143 realizar un experimento ((((wild-eyed)))), debe ser cuidadoso en cómo
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
144 lo hace, o puede dejar trazas innecesarias--o peor aún,
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
145 desconcertantes o desestabilizantes--- de los pasos y errores en el
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
146 registro de revisiones de forma permanente.
435
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
147
542
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
148 En contraste, con la cohesión de MQ con el control de revisiones
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
149 distribuidos y los parches, resulta más sencillo aislar su trabajo.
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
150 Sus parches viven encima de la historia de revisiones normales, y
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
151 puede hacer que ellos desaparezcan o reaparezcan cuando lo desee. Si
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
152 no le gusta un parche, puede desecharlo. Si un parche no satisface
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
153 todo lo que usted desea, puede arreglarlo---tantas veces como lo
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
154 requiera, hasta que lo haya refinado lo suficiente hacia sus
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
155 expectativas.
435
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
156
542
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
157 Por ejemplo, la integración de parches con el control de revisiones
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
158 hace que el entender los parches y revisar sus efectos---y sus
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
159 interacciones con el código en el cuál están enlazados--- sea
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
160 \emph{mucho} más sencillo. Dado que todo parche que se aplique tiene
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
161 un conjunto de cambios asociado, puede usar
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
162 \hgcmdargs{log}{\emph{filename}} para ver qué conjuntos de cambios y
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
163 parches afectaron un fichero. Puede usar la orden \hgext{bisect} para
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
164 hacer una búsqueda binaria sobre todos los conjuntos de cambios y
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
165 parches aplicados para ver dónde se introdujo un fallo o dónde fue
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
166 arreglado. Puede usar la orden \hgcmd{annotate} para ver qué
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
167 conjuntos de cambios o parches modificaron una línea particular de un
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
168 archivo fuente. Y mucho más.
435
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
169
542
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
170 \section{Entender los parches}
435
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
171 \label{sec:mq:patch}
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
172
542
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
173 Dado que MQ no esconde su naturaleza parche-céntrica, es muy útil para
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
174 entender de qué se tratan los parches, y un poco acerca de las
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
175 herramientas que trabajan con ellos.
435
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
176
542
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
177 La orden de Unix tradicional \command{diff} compara dos ficheros, e
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
178 imprime una lista de diferencias de sus líneas. La orden
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
179 \command{patch} entiende esas diferencias como \emph{modificaciones}
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
180 para construir un fichero. Vea en la figura~\ref{ex:mq:diff} un
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
181 ejemplo sencillo de tales órdenes en acción.
435
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
182
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
183 \begin{figure}[ht]
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
184 \interaction{mq.dodiff.diff}
542
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
185 \caption{Uso sencillo de las órdenes \command{diff} y \command{patch}}
435
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
186 \label{ex:mq:diff}
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
187 \end{figure}
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
188
542
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
189 El tipo de fichero que \command{diff} genera (y que \command{patch}
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
190 toma como entrada) se llama un ``parche'' o un ``diff''; no hay
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
191 diferencia entre un parche y un diff. (Usaremos el término ``parche'',
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
192 dado que es el que más comunmente se usa.)
435
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
193
542
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
194 Un parche puede comenzar con un texto arbitrario; la orden \command{patch}
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
195 ignora este texto, pero MQ lo usa como el mensaje de consignación
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
196 cuando se crean conjuntos de cambios. Para encontrar el inicio del
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
197 contenido de un parche, la orden \command{patch} busca la primera
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
198 línea que comience con la cadena ``\texttt{diff~-}''.
435
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
199
542
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
200 MQ trabaja con diffs \emph{unificados} (\command{patch} acepta varios
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
201 formatos de diff adicionales, pero MQ no). Un diff unificado contiene
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
202 dos clases de encabezados. El \emph{encabezado de fichero} describe
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
203 el fichero que se está modificando; contiene el nombre del fichero a
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
204 modificar. Cuando \command{patch} ve un nuevo encabezado de fichero,
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
205 busca un fichero con ese nombre para modificarlo.
435
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
206
542
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
207 Después del encabezaado vienen varios \emph{trozos}. Cada trozo
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
208 comienza con un encabezado; que identifica el rango de líneas del
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
209 fichero que el trozo debe modificar. Después del encabezado, un trozo
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
210 comienza y termina con unas pocas líneas(usualmente tres) de texto del
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
211 fichero que no han sido modificadas; las cuales llamamos el
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
212 \emph{contexto} del trozo. Si solamente hay una pequeña cantidad de
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
213 contexto entre trozos sucesivos, \command{diff} no imprime un nuevo
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
214 encabezado para el trozo, continua integrando los trozos, con unas
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
215 líneas de contexto entre las modificaciones.
435
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
216
542
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
217 Cada línea de contexto comienza con un caracter de espacio. En el
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
218 trozo, si una línea comienza con ``\texttt{-}'' significa ``elimine
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
219 esta línea'', si la línea comienza con un ``\texttt{+}'' significa
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
220 ``inserte esta línea''. Por ejemplo, una línea que se modifica se
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
221 representa con una línea eliminada y una línea insertada.
435
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
222
542
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
223 Retomaremos aspectos más sutiles acerca de parches posteriormente(en
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
224 la sección~\ref{sec:mq:adv-patch}), pero en el momento usted ya
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
225 debería tener suficiente información para usar MQ.
435
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
226
542
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
227 \section{Comenzar a usar Colas de Mercurial}
435
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
228 \label{sec:mq:start}
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
229
542
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
230 Dado que MQ está implementado como una extensión, debe habilitarla
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
231 explícitamente antes de comenzar a usarla. (No necesita descargar
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
232 nada; MQ viene con la distribución estándar de Mercurial.) Para
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
233 habilitar MQ, edite su fichero \tildefile{.hgrc}, y añada las líneas
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
234 de la figura~\ref{ex:mq:config}.
435
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
235
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
236 \begin{figure}[ht]
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
237 \begin{codesample4}
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
238 [extensions]
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
239 hgext.mq =
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
240 \end{codesample4}
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
241 \label{ex:mq:config}
542
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
242 \caption{Líneas a añadir en \tildefile{.hgrc} para habilitar la extensión MQ}
435
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
243 \end{figure}
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
244
542
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
245 Cuando la extensión esté habilitada, aparecerán varios comandos. Para
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
246 verificar que la extensión está trabajando, puede usar \hgcmd{help}
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
247 para ver si la orden \hgxcmd{mq}{qinit} está disponible; vea un
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
248 ejemplo en la figura~\ref{ex:mq:enabled}.
435
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
249
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
250 \begin{figure}[ht]
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
251 \interaction{mq.qinit-help.help}
542
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
252 \caption{Cómo verificar que MQ está habilitado}
435
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
253 \label{ex:mq:enabled}
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
254 \end{figure}
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
255
542
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
256 Puede usar MQ en \emph{cualquier} repositorio de Mercurial, y sus
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
257 comandos solamente operarán con tal repositorio. Para comenzar, basta
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
258 con preparar el repositorio con la orden \hgxcmd{mq}{qinit}(ver la
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
259 figura~\ref{ex:mq:qinit}). Esta orden crea un directorio vacío
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
260 llamado \sdirname{.hg/patches}, donde MQ mantendrá sus metadatos. Como
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
261 otras ordenes de Mercurial, la orden \hgxcmd{mq}{qinit} no imprime
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
262 nada cuando es exitosa.
435
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
263
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
264 \begin{figure}[ht]
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
265 \interaction{mq.tutorial.qinit}
542
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
266 \caption{Preparar un repositorio para usar MQ}
435
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
267 \label{ex:mq:qinit}
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
268 \end{figure}
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
269
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
270 \begin{figure}[ht]
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
271 \interaction{mq.tutorial.qnew}
542
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
272 \caption{Crear un nuevo parche}
435
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
273 \label{ex:mq:qnew}
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
274 \end{figure}
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
275
542
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
276 \subsection{Crear un nuevo parche}
435
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
277
542
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
278 Para comenzar a trabajar en un nuevo parche use la orden
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
279 \hgxcmd{mq}{qnew}. Esta orden recibe un argumento, el nombre del
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
280 parche a crear. MQ lo usará como el nombre del fichero en el
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
281 directorio \sdirname{.hg/patches}, como puede apreciarlo en la
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
282 figura~\ref{ex:mq:qnew}.
435
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
283
542
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
284 También hay otros dos nuevos ficheros en el directorio
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
285 \sdirname{.hg/patches}: \sfilename{series} y \sfilename{status}. El
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
286 fichero \sfilename{series} lista todos los parches de los cuales MQ
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
287 tiene noticia para este repositorio, con un parche por línea.
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
288 Mercurial usa el fichero \sfilename{status} para mantener registros
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
289 interns; da seguimiento a todos los parches que MQ ha \emph{aplicado}
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
290 en el repositorio.
435
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
291
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
292 \begin{note}
542
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
293 En ciertas ocasiones usted querrá editar el fichero
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
294 \sfilename{series} a mano; por ejemplo, cambiar el orden en que se
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
295 aplican ciertos parches. A pesar de esto, es una mala idea editar
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
296 manualmente el fichero \sfilename{status}, dado que es fácil
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
297 desorientar a MQ acerca de lo que está pasando.
435
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
298 \end{note}
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
299
542
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
300 Una vez que haya creado un nuevo parche, puede editar los ficheros en
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
301 el directorio de trabajo, como lo haría usualmente. Toda las órdenes
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
302 que de a Mercurial, tales como \hgcmd{diff} y \hgcmd{annotate},
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
303 trabajarán de la misma forma como lo han hecho antes.
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
304
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
305 \subsection{Refrescar un parche}
435
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
306
542
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
307 Cuando usted llega a un punto en el cual desea guardar su trabajo, use
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
308 la orden \hgxcmd{mq}{qrefresh}(figura~\ref{ex:mq:qnew}) para
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
309 actualizar el parche en el cual está trabajando. Esta orden almacena
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
310 los cambios que haya hecho al directorio actual de trabajo en su
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
311 parche, y almacena el conjunto de cambios correspondiente que contiene
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
312 los cambios.
435
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
313
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
314 \begin{figure}[ht]
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
315 \interaction{mq.tutorial.qrefresh}
542
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
316 \caption{Refrescar un parche}
435
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
317 \label{ex:mq:qrefresh}
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
318 \end{figure}
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
319
542
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
320 Puede ejecutar la orden \hgxcmd{mq}{qrefresh} tan seguido como quiera,
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
321 y es una buena forma de ``colocar marcas'' a su trabajo. Refresque su
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
322 parche en momentos oportunos; intente un experimento; si el
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
323 experimento no funciona, Use \hgcmd{revert} sobre sus modificaciones
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
324 para volver al refresco anterior.
435
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
325
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
326 \begin{figure}[ht]
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
327 \interaction{mq.tutorial.qrefresh2}
542
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
328 \caption{Refrescar un parche muchas veces para acumular cambios}
435
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
329 \label{ex:mq:qrefresh2}
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
330 \end{figure}
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
331
542
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
332 \subsection{Aplicar un parche tras otro y dar seguimiento}
435
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
333
542
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
334 Cuando haya terminado de trabajar en un parche, o necesite trabajar en
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
335 otro, puede usar la orden \hgxcmd{mq}{qnew} para crear un nuevo
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
336 parche. Mercurial aplicará este parche sobre su parche anterior.
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
337 Para un ejemplo, ver la figura~\ref{ex:mq:qnew2}. Note que el parche
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
338 contiene los cambios en nuestro parche anterior como parte de su
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
339 contexto( lo verá más claramente en la salida de \hgcmd{annotate}).
435
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
340
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
341 \begin{figure}[ht]
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
342 \interaction{mq.tutorial.qnew2}
542
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
343 \caption{Aplicar un parche después del primero}
435
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
344 \label{ex:mq:qnew2}
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
345 \end{figure}
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
346
542
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
347 Hasta ahora, con excepción de \hgxcmd{mq}{qnew} y
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
348 \hgxcmd{mq}{qrefresh}, hemos sido cuidadosos para aplicar únicamente
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
349 órdenes usuaales de Mercurial. De todas maneras, MQ ofrece muchos
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
350 comandos que son más sencillos de usar cuando esté pensando acerca de
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
351 parches, como se puede ver en la figura~\ref{ex:mq:qseries}:
435
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
352
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
353 \begin{itemize}
542
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
354 \item La orden \hgxcmd{mq}{qseries} lista cada parche del cual MQ
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
355 tiene noticia en este repositorio, desde el más antiguo hasta el más
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
356 nuevo(El último \emph{creado}).
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
357 \item La orden \hgxcmd{mq}{qapplied} lista cada parche que MQ haya
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
358 \emph{aplicado} en este repositorio, de nuevo, desde el más antiguo
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
359 hasta el más nuevo (El aplicado más recientemente).
435
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
360 \end{itemize}
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
361
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
362 \begin{figure}[ht]
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
363 \interaction{mq.tutorial.qseries}
542
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
364 \caption{Entender la pila de parches con \hgxcmd{mq}{qseries} y
435
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
365 \hgxcmd{mq}{qapplied}}
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
366 \label{ex:mq:qseries}
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
367 \end{figure}
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
368
542
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
369 \subsection{Manipular la pila de parches}
435
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
370
542
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
371 La discusión previa indicó que debe haber una diferencia entre los
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
372 parches ``conocidos'' y ``aplicados'', y efectivamente la hay. MQ
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
373 puede manejar un parche sin que este haya sido aplicado al
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
374 repositorio.
435
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
375
542
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
376 Un parche \emph{aplicado} tiene su correspondiente conjunto de cambios
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
377 en el repositorio, y los efectos del parche y el conjunto de cambios
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
378 son visibles en el directorio de trabajo. Puede deshacer la
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
379 aplicación de un parche con la orden \hgxcmd{mq}{qpop}. MQ
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
380 \emph{sabe acerca de}, o maneja un parche sustraído, pero el parche ya
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
381 no tendrá un conjunto de cambios correspondientes en el repositorio, y
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
382 el directorio de trabajo no contendrá los cambios hechos por el
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
383 parche. La figura~\ref{fig:mq:stack} ilustra la diferencia entre
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
384 parches aplicados y seguidos.
435
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
385
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
386 \begin{figure}[ht]
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
387 \centering
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
388 \grafix{mq-stack}
542
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
389 \caption{Parches aplicados y no aplicados en la pila de parches de MQ}
435
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
390 \label{fig:mq:stack}
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
391 \end{figure}
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
392
542
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
393 Puede reaplicar un parche no aplicado o sustraído con la orden
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
394 \hgxcmd{mq}{qpush}. Esto crea un nuevo conjunto de cambios
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
395 correspondiente al parche, y los cambios del parche estarán presentes
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
396 de nuevo en el directorio de trabajo. Vea ejemplos de
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
397 \hgxcmd{mq}{qpop} y \hgxcmd{mq}{qpush} en acción en la
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
398 figura~\ref{ex:mq:qpop}. Vea que hemos sustraído uno o dos parches,
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
399 la salida de\hgxcmd{mq}{qseries} continúa igual, mientras que
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
400 \hgxcmd{mq}{qapplied} ha cambiado.
435
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
401
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
402 \begin{figure}[ht]
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
403 \interaction{mq.tutorial.qpop}
542
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
404 \caption{Modificar la pila de parches aplicados}
435
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
405 \label{ex:mq:qpop}
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
406 \end{figure}
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
407
542
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
408 \subsection{Introducir y sustraer muchos parches}
435
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
409
542
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
410 Mientras que \hgxcmd{mq}{qpush} y \hgxcmd{mq}{qpop} operan sobre un
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
411 único parche cada vez, puede introducir y sustraer varios parches de
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
412 una vez. La opción \hgxopt{mq}{qpush}{-a} de \hgxcmd{mq}{qpush}
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
413 introduce todos los cambios que no hayan sido aplicados, mientras que
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
414 la opción \hgxopt{mq}{qpop}{-a} de \hgxcmd{mq}{qpop} sustrae todos los
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
415 cambios aplicados. (Vea la sección~\ref{sec:mq:perf} más adelante
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
416 en la cual se explican otras formas de de introducir y sustraer varios
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
417 cambios.)
435
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
418
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
419 \begin{figure}[ht]
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
420 \interaction{mq.tutorial.qpush-a}
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
421 \caption{Pushing all unapplied patches}
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
422 \label{ex:mq:qpush-a}
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
423 \end{figure}
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
424
542
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
425 \subsection{Medidas de seguridad y cómo saltarlas}
435
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
426
542
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
427 Muchas órdenes MQ revisan el directorio de trabajo antes de hacer
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
428 cualquier cosa, y fallan si encuentran alguna modificación. Lo hacen
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
429 para garantizar que usted no pierda cambio alguno de los que haya
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
430 hecho, pero que no hayan sido incorporados en algún parche. La
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
431 figura~\ref{ex:mq:add} ilusta esto; la orden \hgxcmd{mq}{qnew} no
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
432 creará un nuevo parche si hay cambios notorios, causados en este caso
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
433 por aplicado la orden \hgcmd{add} a \filename{file3}.
435
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
434
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
435 \begin{figure}[ht]
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
436 \interaction{mq.tutorial.add}
542
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
437 \caption{Crear un parche a la fuerza}
435
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
438 \label{ex:mq:add}
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
439 \end{figure}
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
440
542
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
441 Las órdenes que revisan el directorio actual cuentan con una opción
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
442 ``Se lo que estoy haciendo'', que siempre está nombrada como
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
443 \option{-f}. El significado exacto de \option{-f} depende de la
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
444 orden. Por ejemplo, \hgcmdargs{qnew}{\hgxopt{mq}{qnew}{-f}}
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
445 incorporarán cualquier cambio notorio en el nuevo parche que crea pero
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
446 \hgcmdargs{qpop}{\hgxopt{mq}{qpop}{-f}} revertirá las modificaciones a
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
447 cualquier fichero que haya sido afectado por el parche que está siendo
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
448 sustraído. ¡Asegúrese de leer la documentación de la opción \option{-f}
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
449 de cada comando antes de usarla!
435
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
450
542
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
451 \subsection{Trabajar con varios parches a la vez}
435
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
452
542
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
453 La orden \hgxcmd{mq}{qrefresh} siempre refresca el \emph{último}
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
454 parche aplicado. Esto significa que usted puede suspender su trabajo
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
455 en un parche (refrescándolo), sustraerlo o introducirlo para lograr
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
456 que otro parche esté de último y trabajar en \emph{ese} parche por un
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
457 rato.
435
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
458
542
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
459 A continuación un ejemplo que ilustra cómo puede usar esta habilidad.
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
460 Digamos que está desarrollando una nueva característica en dos
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
461 parches. El primero es un cambio en la parte fundamental de su
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
462 programa, y el segundo--sobre el primero---cambia la interfaz de
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
463 usuario para usar el código que ha añadido a la parte fundamental. Si
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
464 ve que hay un fallo en la parte fundamental mientras está trabajando
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
465 en el parche de UI\ndt{Interfaz de Usuario, User Interface en inglés}, es fácil arreglar la parte fundamental.
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
466 Simplemente use \hgxcmd{mq}{qrefresh} sobre el parche de la UI para
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
467 guardar los cambios de su trabajo en progreso, y use \hgxcmd{mq}{qpop}
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
468 para sacar sustraer el parche de la parte fundamental. Arregla el
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
469 fallo sobre la parte fundamental, aplique \hgxcmd{mq}{qrefresh} sobre
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
470 el parche fundamental, y aplique \hgxcmd{mq}{qpush} sobre el parche de
2daeda01fe98 Started mq, please do look the translation terms about push and pop on this context
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
471 UI para continuar donde había quedado.
435
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
472
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
473 \section{More about patches}
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
474 \label{sec:mq:adv-patch}
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
475
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
476 MQ uses the GNU \command{patch} command to apply patches, so it's
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
477 helpful to know a few more detailed aspects of how \command{patch}
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
478 works, and about patches themselves.
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
479
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
480 \subsection{The strip count}
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
481
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
482 If you look at the file headers in a patch, you will notice that the
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
483 pathnames usually have an extra component on the front that isn't
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
484 present in the actual path name. This is a holdover from the way that
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
485 people used to generate patches (people still do this, but it's
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
486 somewhat rare with modern revision control tools).
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
487
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
488 Alice would unpack a tarball, edit her files, then decide that she
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
489 wanted to create a patch. So she'd rename her working directory,
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
490 unpack the tarball again (hence the need for the rename), and use the
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
491 \cmdopt{diff}{-r} and \cmdopt{diff}{-N} options to \command{diff} to
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
492 recursively generate a patch between the unmodified directory and the
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
493 modified one. The result would be that the name of the unmodified
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
494 directory would be at the front of the left-hand path in every file
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
495 header, and the name of the modified directory would be at the front
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
496 of the right-hand path.
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
497
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
498 Since someone receiving a patch from the Alices of the net would be
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
499 unlikely to have unmodified and modified directories with exactly the
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
500 same names, the \command{patch} command has a \cmdopt{patch}{-p}
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
501 option that indicates the number of leading path name components to
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
502 strip when trying to apply a patch. This number is called the
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
503 \emph{strip count}.
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
504
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
505 An option of ``\texttt{-p1}'' means ``use a strip count of one''. If
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
506 \command{patch} sees a file name \filename{foo/bar/baz} in a file
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
507 header, it will strip \filename{foo} and try to patch a file named
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
508 \filename{bar/baz}. (Strictly speaking, the strip count refers to the
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
509 number of \emph{path separators} (and the components that go with them
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
510 ) to strip. A strip count of one will turn \filename{foo/bar} into
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
511 \filename{bar}, but \filename{/foo/bar} (notice the extra leading
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
512 slash) into \filename{foo/bar}.)
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
513
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
514 The ``standard'' strip count for patches is one; almost all patches
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
515 contain one leading path name component that needs to be stripped.
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
516 Mercurial's \hgcmd{diff} command generates path names in this form,
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
517 and the \hgcmd{import} command and MQ expect patches to have a strip
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
518 count of one.
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
519
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
520 If you receive a patch from someone that you want to add to your patch
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
521 queue, and the patch needs a strip count other than one, you cannot
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
522 just \hgxcmd{mq}{qimport} the patch, because \hgxcmd{mq}{qimport} does not yet
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
523 have a \texttt{-p} option (see~\bug{311}). Your best bet is to
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
524 \hgxcmd{mq}{qnew} a patch of your own, then use \cmdargs{patch}{-p\emph{N}}
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
525 to apply their patch, followed by \hgcmd{addremove} to pick up any
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
526 files added or removed by the patch, followed by \hgxcmd{mq}{qrefresh}.
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
527 This complexity may become unnecessary; see~\bug{311} for details.
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
528 \subsection{Strategies for applying a patch}
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
529
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
530 When \command{patch} applies a hunk, it tries a handful of
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
531 successively less accurate strategies to try to make the hunk apply.
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
532 This falling-back technique often makes it possible to take a patch
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
533 that was generated against an old version of a file, and apply it
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
534 against a newer version of that file.
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
535
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
536 First, \command{patch} tries an exact match, where the line numbers,
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
537 the context, and the text to be modified must apply exactly. If it
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
538 cannot make an exact match, it tries to find an exact match for the
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
539 context, without honouring the line numbering information. If this
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
540 succeeds, it prints a line of output saying that the hunk was applied,
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
541 but at some \emph{offset} from the original line number.
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
542
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
543 If a context-only match fails, \command{patch} removes the first and
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
544 last lines of the context, and tries a \emph{reduced} context-only
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
545 match. If the hunk with reduced context succeeds, it prints a message
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
546 saying that it applied the hunk with a \emph{fuzz factor} (the number
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
547 after the fuzz factor indicates how many lines of context
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
548 \command{patch} had to trim before the patch applied).
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
549
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
550 When neither of these techniques works, \command{patch} prints a
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
551 message saying that the hunk in question was rejected. It saves
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
552 rejected hunks (also simply called ``rejects'') to a file with the
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
553 same name, and an added \sfilename{.rej} extension. It also saves an
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
554 unmodified copy of the file with a \sfilename{.orig} extension; the
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
555 copy of the file without any extensions will contain any changes made
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
556 by hunks that \emph{did} apply cleanly. If you have a patch that
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
557 modifies \filename{foo} with six hunks, and one of them fails to
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
558 apply, you will have: an unmodified \filename{foo.orig}, a
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
559 \filename{foo.rej} containing one hunk, and \filename{foo}, containing
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
560 the changes made by the five successful five hunks.
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
561
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
562 \subsection{Some quirks of patch representation}
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
563
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
564 There are a few useful things to know about how \command{patch} works
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
565 with files.
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
566 \begin{itemize}
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
567 \item This should already be obvious, but \command{patch} cannot
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
568 handle binary files.
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
569 \item Neither does it care about the executable bit; it creates new
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
570 files as readable, but not executable.
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
571 \item \command{patch} treats the removal of a file as a diff between
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
572 the file to be removed and the empty file. So your idea of ``I
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
573 deleted this file'' looks like ``every line of this file was
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
574 deleted'' in a patch.
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
575 \item It treats the addition of a file as a diff between the empty
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
576 file and the file to be added. So in a patch, your idea of ``I
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
577 added this file'' looks like ``every line of this file was added''.
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
578 \item It treats a renamed file as the removal of the old name, and the
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
579 addition of the new name. This means that renamed files have a big
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
580 footprint in patches. (Note also that Mercurial does not currently
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
581 try to infer when files have been renamed or copied in a patch.)
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
582 \item \command{patch} cannot represent empty files, so you cannot use
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
583 a patch to represent the notion ``I added this empty file to the
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
584 tree''.
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
585 \end{itemize}
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
586 \subsection{Beware the fuzz}
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
587
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
588 While applying a hunk at an offset, or with a fuzz factor, will often
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
589 be completely successful, these inexact techniques naturally leave
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
590 open the possibility of corrupting the patched file. The most common
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
591 cases typically involve applying a patch twice, or at an incorrect
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
592 location in the file. If \command{patch} or \hgxcmd{mq}{qpush} ever
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
593 mentions an offset or fuzz factor, you should make sure that the
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
594 modified files are correct afterwards.
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
595
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
596 It's often a good idea to refresh a patch that has applied with an
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
597 offset or fuzz factor; refreshing the patch generates new context
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
598 information that will make it apply cleanly. I say ``often,'' not
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
599 ``always,'' because sometimes refreshing a patch will make it fail to
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
600 apply against a different revision of the underlying files. In some
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
601 cases, such as when you're maintaining a patch that must sit on top of
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
602 multiple versions of a source tree, it's acceptable to have a patch
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
603 apply with some fuzz, provided you've verified the results of the
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
604 patching process in such cases.
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
605
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
606 \subsection{Handling rejection}
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
607
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
608 If \hgxcmd{mq}{qpush} fails to apply a patch, it will print an error
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
609 message and exit. If it has left \sfilename{.rej} files behind, it is
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
610 usually best to fix up the rejected hunks before you push more patches
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
611 or do any further work.
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
612
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
613 If your patch \emph{used to} apply cleanly, and no longer does because
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
614 you've changed the underlying code that your patches are based on,
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
615 Mercurial Queues can help; see section~\ref{sec:mq:merge} for details.
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
616
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
617 Unfortunately, there aren't any great techniques for dealing with
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
618 rejected hunks. Most often, you'll need to view the \sfilename{.rej}
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
619 file and edit the target file, applying the rejected hunks by hand.
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
620
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
621 If you're feeling adventurous, Neil Brown, a Linux kernel hacker,
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
622 wrote a tool called \command{wiggle}~\cite{web:wiggle}, which is more
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
623 vigorous than \command{patch} in its attempts to make a patch apply.
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
624
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
625 Another Linux kernel hacker, Chris Mason (the author of Mercurial
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
626 Queues), wrote a similar tool called
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
627 \command{mpatch}~\cite{web:mpatch}, which takes a simple approach to
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
628 automating the application of hunks rejected by \command{patch}. The
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
629 \command{mpatch} command can help with four common reasons that a hunk
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
630 may be rejected:
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
631
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
632 \begin{itemize}
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
633 \item The context in the middle of a hunk has changed.
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
634 \item A hunk is missing some context at the beginning or end.
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
635 \item A large hunk might apply better---either entirely or in
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
636 part---if it was broken up into smaller hunks.
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
637 \item A hunk removes lines with slightly different content than those
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
638 currently present in the file.
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
639 \end{itemize}
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
640
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
641 If you use \command{wiggle} or \command{mpatch}, you should be doubly
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
642 careful to check your results when you're done. In fact,
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
643 \command{mpatch} enforces this method of double-checking the tool's
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
644 output, by automatically dropping you into a merge program when it has
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
645 done its job, so that you can verify its work and finish off any
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
646 remaining merges.
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
647
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
648 \section{Getting the best performance out of MQ}
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
649 \label{sec:mq:perf}
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
650
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
651 MQ is very efficient at handling a large number of patches. I ran
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
652 some performance experiments in mid-2006 for a talk that I gave at the
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
653 2006 EuroPython conference~\cite{web:europython}. I used as my data
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
654 set the Linux 2.6.17-mm1 patch series, which consists of 1,738
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
655 patches. I applied these on top of a Linux kernel repository
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
656 containing all 27,472 revisions between Linux 2.6.12-rc2 and Linux
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
657 2.6.17.
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
658
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
659 On my old, slow laptop, I was able to
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
660 \hgcmdargs{qpush}{\hgxopt{mq}{qpush}{-a}} all 1,738 patches in 3.5 minutes,
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
661 and \hgcmdargs{qpop}{\hgxopt{mq}{qpop}{-a}} them all in 30 seconds. (On a
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
662 newer laptop, the time to push all patches dropped to two minutes.) I
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
663 could \hgxcmd{mq}{qrefresh} one of the biggest patches (which made 22,779
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
664 lines of changes to 287 files) in 6.6 seconds.
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
665
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
666 Clearly, MQ is well suited to working in large trees, but there are a
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
667 few tricks you can use to get the best performance of it.
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
668
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
669 First of all, try to ``batch'' operations together. Every time you
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
670 run \hgxcmd{mq}{qpush} or \hgxcmd{mq}{qpop}, these commands scan the working
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
671 directory once to make sure you haven't made some changes and then
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
672 forgotten to run \hgxcmd{mq}{qrefresh}. On a small tree, the time that
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
673 this scan takes is unnoticeable. However, on a medium-sized tree
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
674 (containing tens of thousands of files), it can take a second or more.
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
675
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
676 The \hgxcmd{mq}{qpush} and \hgxcmd{mq}{qpop} commands allow you to push and pop
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
677 multiple patches at a time. You can identify the ``destination
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
678 patch'' that you want to end up at. When you \hgxcmd{mq}{qpush} with a
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
679 destination specified, it will push patches until that patch is at the
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
680 top of the applied stack. When you \hgxcmd{mq}{qpop} to a destination, MQ
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
681 will pop patches until the destination patch is at the top.
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
682
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
683 You can identify a destination patch using either the name of the
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
684 patch, or by number. If you use numeric addressing, patches are
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
685 counted from zero; this means that the first patch is zero, the second
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
686 is one, and so on.
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
687
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
688 \section{Updating your patches when the underlying code changes}
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
689 \label{sec:mq:merge}
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
690
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
691 It's common to have a stack of patches on top of an underlying
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
692 repository that you don't modify directly. If you're working on
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
693 changes to third-party code, or on a feature that is taking longer to
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
694 develop than the rate of change of the code beneath, you will often
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
695 need to sync up with the underlying code, and fix up any hunks in your
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
696 patches that no longer apply. This is called \emph{rebasing} your
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
697 patch series.
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
698
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
699 The simplest way to do this is to \hgcmdargs{qpop}{\hgxopt{mq}{qpop}{-a}}
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
700 your patches, then \hgcmd{pull} changes into the underlying
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
701 repository, and finally \hgcmdargs{qpush}{\hgxopt{mq}{qpop}{-a}} your
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
702 patches again. MQ will stop pushing any time it runs across a patch
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
703 that fails to apply during conflicts, allowing you to fix your
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
704 conflicts, \hgxcmd{mq}{qrefresh} the affected patch, and continue pushing
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
705 until you have fixed your entire stack.
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
706
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
707 This approach is easy to use and works well if you don't expect
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
708 changes to the underlying code to affect how well your patches apply.
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
709 If your patch stack touches code that is modified frequently or
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
710 invasively in the underlying repository, however, fixing up rejected
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
711 hunks by hand quickly becomes tiresome.
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
712
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
713 It's possible to partially automate the rebasing process. If your
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
714 patches apply cleanly against some revision of the underlying repo, MQ
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
715 can use this information to help you to resolve conflicts between your
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
716 patches and a different revision.
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
717
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
718 The process is a little involved.
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
719 \begin{enumerate}
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
720 \item To begin, \hgcmdargs{qpush}{-a} all of your patches on top of
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
721 the revision where you know that they apply cleanly.
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
722 \item Save a backup copy of your patch directory using
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
723 \hgcmdargs{qsave}{\hgxopt{mq}{qsave}{-e} \hgxopt{mq}{qsave}{-c}}. This prints
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
724 the name of the directory that it has saved the patches in. It will
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
725 save the patches to a directory called
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
726 \sdirname{.hg/patches.\emph{N}}, where \texttt{\emph{N}} is a small
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
727 integer. It also commits a ``save changeset'' on top of your
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
728 applied patches; this is for internal book-keeping, and records the
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
729 states of the \sfilename{series} and \sfilename{status} files.
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
730 \item Use \hgcmd{pull} to bring new changes into the underlying
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
731 repository. (Don't run \hgcmdargs{pull}{-u}; see below for why.)
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
732 \item Update to the new tip revision, using
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
733 \hgcmdargs{update}{\hgopt{update}{-C}} to override the patches you
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
734 have pushed.
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
735 \item Merge all patches using \hgcmdargs{qpush}{\hgxopt{mq}{qpush}{-m}
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
736 \hgxopt{mq}{qpush}{-a}}. The \hgxopt{mq}{qpush}{-m} option to \hgxcmd{mq}{qpush}
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
737 tells MQ to perform a three-way merge if the patch fails to apply.
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
738 \end{enumerate}
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
739
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
740 During the \hgcmdargs{qpush}{\hgxopt{mq}{qpush}{-m}}, each patch in the
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
741 \sfilename{series} file is applied normally. If a patch applies with
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
742 fuzz or rejects, MQ looks at the queue you \hgxcmd{mq}{qsave}d, and
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
743 performs a three-way merge with the corresponding changeset. This
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
744 merge uses Mercurial's normal merge machinery, so it may pop up a GUI
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
745 merge tool to help you to resolve problems.
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
746
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
747 When you finish resolving the effects of a patch, MQ refreshes your
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
748 patch based on the result of the merge.
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
749
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
750 At the end of this process, your repository will have one extra head
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
751 from the old patch queue, and a copy of the old patch queue will be in
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
752 \sdirname{.hg/patches.\emph{N}}. You can remove the extra head using
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
753 \hgcmdargs{qpop}{\hgxopt{mq}{qpop}{-a} \hgxopt{mq}{qpop}{-n} patches.\emph{N}}
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
754 or \hgcmd{strip}. You can delete \sdirname{.hg/patches.\emph{N}} once
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
755 you are sure that you no longer need it as a backup.
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
756
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
757 \section{Identifying patches}
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
758
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
759 MQ commands that work with patches let you refer to a patch either by
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
760 using its name or by a number. By name is obvious enough; pass the
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
761 name \filename{foo.patch} to \hgxcmd{mq}{qpush}, for example, and it will
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
762 push patches until \filename{foo.patch} is applied.
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
763
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
764 As a shortcut, you can refer to a patch using both a name and a
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
765 numeric offset; \texttt{foo.patch-2} means ``two patches before
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
766 \texttt{foo.patch}'', while \texttt{bar.patch+4} means ``four patches
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
767 after \texttt{bar.patch}''.
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
768
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
769 Referring to a patch by index isn't much different. The first patch
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
770 printed in the output of \hgxcmd{mq}{qseries} is patch zero (yes, it's one
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
771 of those start-at-zero counting systems); the second is patch one; and
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
772 so on.
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
773
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
774 MQ also makes it easy to work with patches when you are using normal
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
775 Mercurial commands. Every command that accepts a changeset ID will
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
776 also accept the name of an applied patch. MQ augments the tags
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
777 normally in the repository with an eponymous one for each applied
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
778 patch. In addition, the special tags \index{tags!special tag
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
779 names!\texttt{qbase}}\texttt{qbase} and \index{tags!special tag
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
780 names!\texttt{qtip}}\texttt{qtip} identify the ``bottom-most'' and
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
781 topmost applied patches, respectively.
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
782
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
783 These additions to Mercurial's normal tagging capabilities make
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
784 dealing with patches even more of a breeze.
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
785 \begin{itemize}
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
786 \item Want to patchbomb a mailing list with your latest series of
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
787 changes?
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
788 \begin{codesample4}
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
789 hg email qbase:qtip
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
790 \end{codesample4}
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
791 (Don't know what ``patchbombing'' is? See
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
792 section~\ref{sec:hgext:patchbomb}.)
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
793 \item Need to see all of the patches since \texttt{foo.patch} that
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
794 have touched files in a subdirectory of your tree?
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
795 \begin{codesample4}
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
796 hg log -r foo.patch:qtip \emph{subdir}
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
797 \end{codesample4}
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
798 \end{itemize}
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
799
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
800 Because MQ makes the names of patches available to the rest of
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
801 Mercurial through its normal internal tag machinery, you don't need to
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
802 type in the entire name of a patch when you want to identify it by
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
803 name.
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
804
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
805 \begin{figure}[ht]
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
806 \interaction{mq.id.output}
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
807 \caption{Using MQ's tag features to work with patches}
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
808 \label{ex:mq:id}
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
809 \end{figure}
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
810
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
811 Another nice consequence of representing patch names as tags is that
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
812 when you run the \hgcmd{log} command, it will display a patch's name
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
813 as a tag, simply as part of its normal output. This makes it easy to
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
814 visually distinguish applied patches from underlying ``normal''
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
815 revisions. Figure~\ref{ex:mq:id} shows a few normal Mercurial
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
816 commands in use with applied patches.
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
817
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
818 \section{Useful things to know about}
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
819
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
820 There are a number of aspects of MQ usage that don't fit tidily into
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
821 sections of their own, but that are good to know. Here they are, in
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
822 one place.
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
823
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
824 \begin{itemize}
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
825 \item Normally, when you \hgxcmd{mq}{qpop} a patch and \hgxcmd{mq}{qpush} it
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
826 again, the changeset that represents the patch after the pop/push
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
827 will have a \emph{different identity} than the changeset that
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
828 represented the hash beforehand. See
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
829 section~\ref{sec:mqref:cmd:qpush} for information as to why this is.
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
830 \item It's not a good idea to \hgcmd{merge} changes from another
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
831 branch with a patch changeset, at least if you want to maintain the
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
832 ``patchiness'' of that changeset and changesets below it on the
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
833 patch stack. If you try to do this, it will appear to succeed, but
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
834 MQ will become confused.
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
835 \end{itemize}
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
836
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
837 \section{Managing patches in a repository}
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
838 \label{sec:mq:repo}
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
839
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
840 Because MQ's \sdirname{.hg/patches} directory resides outside a
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
841 Mercurial repository's working directory, the ``underlying'' Mercurial
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
842 repository knows nothing about the management or presence of patches.
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
843
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
844 This presents the interesting possibility of managing the contents of
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
845 the patch directory as a Mercurial repository in its own right. This
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
846 can be a useful way to work. For example, you can work on a patch for
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
847 a while, \hgxcmd{mq}{qrefresh} it, then \hgcmd{commit} the current state of
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
848 the patch. This lets you ``roll back'' to that version of the patch
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
849 later on.
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
850
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
851 You can then share different versions of the same patch stack among
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
852 multiple underlying repositories. I use this when I am developing a
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
853 Linux kernel feature. I have a pristine copy of my kernel sources for
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
854 each of several CPU architectures, and a cloned repository under each
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
855 that contains the patches I am working on. When I want to test a
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
856 change on a different architecture, I push my current patches to the
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
857 patch repository associated with that kernel tree, pop and push all of
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
858 my patches, and build and test that kernel.
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
859
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
860 Managing patches in a repository makes it possible for multiple
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
861 developers to work on the same patch series without colliding with
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
862 each other, all on top of an underlying source base that they may or
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
863 may not control.
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
864
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
865 \subsection{MQ support for patch repositories}
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
866
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
867 MQ helps you to work with the \sdirname{.hg/patches} directory as a
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
868 repository; when you prepare a repository for working with patches
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
869 using \hgxcmd{mq}{qinit}, you can pass the \hgxopt{mq}{qinit}{-c} option to
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
870 create the \sdirname{.hg/patches} directory as a Mercurial repository.
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
871
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
872 \begin{note}
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
873 If you forget to use the \hgxopt{mq}{qinit}{-c} option, you can simply go
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
874 into the \sdirname{.hg/patches} directory at any time and run
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
875 \hgcmd{init}. Don't forget to add an entry for the
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
876 \sfilename{status} file to the \sfilename{.hgignore} file, though
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
877
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
878 (\hgcmdargs{qinit}{\hgxopt{mq}{qinit}{-c}} does this for you
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
879 automatically); you \emph{really} don't want to manage the
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
880 \sfilename{status} file.
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
881 \end{note}
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
882
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
883 As a convenience, if MQ notices that the \dirname{.hg/patches}
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
884 directory is a repository, it will automatically \hgcmd{add} every
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
885 patch that you create and import.
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
886
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
887 MQ provides a shortcut command, \hgxcmd{mq}{qcommit}, that runs
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
888 \hgcmd{commit} in the \sdirname{.hg/patches} directory. This saves
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
889 some bothersome typing.
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
890
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
891 Finally, as a convenience to manage the patch directory, you can
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
892 define the alias \command{mq} on Unix systems. For example, on Linux
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
893 systems using the \command{bash} shell, you can include the following
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
894 snippet in your \tildefile{.bashrc}.
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
895
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
896 \begin{codesample2}
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
897 alias mq=`hg -R \$(hg root)/.hg/patches'
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
898 \end{codesample2}
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
899
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
900 You can then issue commands of the form \cmdargs{mq}{pull} from
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
901 the main repository.
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
902
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
903 \subsection{A few things to watch out for}
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
904
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
905 MQ's support for working with a repository full of patches is limited
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
906 in a few small respects.
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
907
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
908 MQ cannot automatically detect changes that you make to the patch
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
909 directory. If you \hgcmd{pull}, manually edit, or \hgcmd{update}
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
910 changes to patches or the \sfilename{series} file, you will have to
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
911 \hgcmdargs{qpop}{\hgxopt{mq}{qpop}{-a}} and then
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
912 \hgcmdargs{qpush}{\hgxopt{mq}{qpush}{-a}} in the underlying repository to
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
913 see those changes show up there. If you forget to do this, you can
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
914 confuse MQ's idea of which patches are applied.
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
915
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
916 \section{Third party tools for working with patches}
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
917 \label{sec:mq:tools}
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
918
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
919 Once you've been working with patches for a while, you'll find
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
920 yourself hungry for tools that will help you to understand and
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
921 manipulate the patches you're dealing with.
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
922
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
923 The \command{diffstat} command~\cite{web:diffstat} generates a
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
924 histogram of the modifications made to each file in a patch. It
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
925 provides a good way to ``get a sense of'' a patch---which files it
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
926 affects, and how much change it introduces to each file and as a
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
927 whole. (I find that it's a good idea to use \command{diffstat}'s
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
928 \cmdopt{diffstat}{-p} option as a matter of course, as otherwise it
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
929 will try to do clever things with prefixes of file names that
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
930 inevitably confuse at least me.)
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
931
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
932 \begin{figure}[ht]
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
933 \interaction{mq.tools.tools}
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
934 \caption{The \command{diffstat}, \command{filterdiff}, and \command{lsdiff} commands}
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
935 \label{ex:mq:tools}
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
936 \end{figure}
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
937
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
938 The \package{patchutils} package~\cite{web:patchutils} is invaluable.
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
939 It provides a set of small utilities that follow the ``Unix
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
940 philosophy;'' each does one useful thing with a patch. The
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
941 \package{patchutils} command I use most is \command{filterdiff}, which
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
942 extracts subsets from a patch file. For example, given a patch that
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
943 modifies hundreds of files across dozens of directories, a single
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
944 invocation of \command{filterdiff} can generate a smaller patch that
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
945 only touches files whose names match a particular glob pattern. See
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
946 section~\ref{mq-collab:tips:interdiff} for another example.
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
947
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
948 \section{Good ways to work with patches}
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
949
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
950 Whether you are working on a patch series to submit to a free software
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
951 or open source project, or a series that you intend to treat as a
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
952 sequence of regular changesets when you're done, you can use some
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
953 simple techniques to keep your work well organised.
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
954
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
955 Give your patches descriptive names. A good name for a patch might be
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
956 \filename{rework-device-alloc.patch}, because it will immediately give
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
957 you a hint what the purpose of the patch is. Long names shouldn't be
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
958 a problem; you won't be typing the names often, but you \emph{will} be
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
959 running commands like \hgxcmd{mq}{qapplied} and \hgxcmd{mq}{qtop} over and over.
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
960 Good naming becomes especially important when you have a number of
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
961 patches to work with, or if you are juggling a number of different
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
962 tasks and your patches only get a fraction of your attention.
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
963
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
964 Be aware of what patch you're working on. Use the \hgxcmd{mq}{qtop}
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
965 command and skim over the text of your patches frequently---for
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
966 example, using \hgcmdargs{tip}{\hgopt{tip}{-p}})---to be sure of where
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
967 you stand. I have several times worked on and \hgxcmd{mq}{qrefresh}ed a
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
968 patch other than the one I intended, and it's often tricky to migrate
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
969 changes into the right patch after making them in the wrong one.
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
970
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
971 For this reason, it is very much worth investing a little time to
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
972 learn how to use some of the third-party tools I described in
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
973 section~\ref{sec:mq:tools}, particularly \command{diffstat} and
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
974 \command{filterdiff}. The former will give you a quick idea of what
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
975 changes your patch is making, while the latter makes it easy to splice
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
976 hunks selectively out of one patch and into another.
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
977
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
978 \section{MQ cookbook}
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
979
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
980 \subsection{Manage ``trivial'' patches}
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
981
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
982 Because the overhead of dropping files into a new Mercurial repository
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
983 is so low, it makes a lot of sense to manage patches this way even if
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
984 you simply want to make a few changes to a source tarball that you
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
985 downloaded.
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
986
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
987 Begin by downloading and unpacking the source tarball,
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
988 and turning it into a Mercurial repository.
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
989 \interaction{mq.tarball.download}
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
990
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
991 Continue by creating a patch stack and making your changes.
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
992 \interaction{mq.tarball.qinit}
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
993
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
994 Let's say a few weeks or months pass, and your package author releases
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
995 a new version. First, bring their changes into the repository.
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
996 \interaction{mq.tarball.newsource}
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
997 The pipeline starting with \hgcmd{locate} above deletes all files in
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
998 the working directory, so that \hgcmd{commit}'s
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
999 \hgopt{commit}{--addremove} option can actually tell which files have
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
1000 really been removed in the newer version of the source.
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
1001
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
1002 Finally, you can apply your patches on top of the new tree.
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
1003 \interaction{mq.tarball.repush}
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
1004
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
1005 \subsection{Combining entire patches}
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
1006 \label{sec:mq:combine}
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
1007
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
1008 MQ provides a command, \hgxcmd{mq}{qfold} that lets you combine entire
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
1009 patches. This ``folds'' the patches you name, in the order you name
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
1010 them, into the topmost applied patch, and concatenates their
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
1011 descriptions onto the end of its description. The patches that you
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
1012 fold must be unapplied before you fold them.
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
1013
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
1014 The order in which you fold patches matters. If your topmost applied
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
1015 patch is \texttt{foo}, and you \hgxcmd{mq}{qfold} \texttt{bar} and
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
1016 \texttt{quux} into it, you will end up with a patch that has the same
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
1017 effect as if you applied first \texttt{foo}, then \texttt{bar},
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
1018 followed by \texttt{quux}.
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
1019
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
1020 \subsection{Merging part of one patch into another}
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
1021
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
1022 Merging \emph{part} of one patch into another is more difficult than
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
1023 combining entire patches.
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
1024
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
1025 If you want to move changes to entire files, you can use
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
1026 \command{filterdiff}'s \cmdopt{filterdiff}{-i} and
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
1027 \cmdopt{filterdiff}{-x} options to choose the modifications to snip
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
1028 out of one patch, concatenating its output onto the end of the patch
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
1029 you want to merge into. You usually won't need to modify the patch
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
1030 you've merged the changes from. Instead, MQ will report some rejected
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
1031 hunks when you \hgxcmd{mq}{qpush} it (from the hunks you moved into the
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
1032 other patch), and you can simply \hgxcmd{mq}{qrefresh} the patch to drop
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
1033 the duplicate hunks.
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
1034
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
1035 If you have a patch that has multiple hunks modifying a file, and you
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
1036 only want to move a few of those hunks, the job becomes more messy,
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
1037 but you can still partly automate it. Use \cmdargs{lsdiff}{-nvv} to
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
1038 print some metadata about the patch.
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
1039 \interaction{mq.tools.lsdiff}
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
1040
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
1041 This command prints three different kinds of number:
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
1042 \begin{itemize}
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
1043 \item (in the first column) a \emph{file number} to identify each file
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
1044 modified in the patch;
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
1045 \item (on the next line, indented) the line number within a modified
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
1046 file where a hunk starts; and
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
1047 \item (on the same line) a \emph{hunk number} to identify that hunk.
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
1048 \end{itemize}
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
1049
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
1050 You'll have to use some visual inspection, and reading of the patch,
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
1051 to identify the file and hunk numbers you'll want, but you can then
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
1052 pass them to to \command{filterdiff}'s \cmdopt{filterdiff}{--files}
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
1053 and \cmdopt{filterdiff}{--hunks} options, to select exactly the file
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
1054 and hunk you want to extract.
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
1055
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
1056 Once you have this hunk, you can concatenate it onto the end of your
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
1057 destination patch and continue with the remainder of
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
1058 section~\ref{sec:mq:combine}.
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
1059
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
1060 \section{Differences between quilt and MQ}
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
1061
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
1062 If you are already familiar with quilt, MQ provides a similar command
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
1063 set. There are a few differences in the way that it works.
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
1064
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
1065 You will already have noticed that most quilt commands have MQ
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
1066 counterparts that simply begin with a ``\texttt{q}''. The exceptions
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
1067 are quilt's \texttt{add} and \texttt{remove} commands, the
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
1068 counterparts for which are the normal Mercurial \hgcmd{add} and
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
1069 \hgcmd{remove} commands. There is no MQ equivalent of the quilt
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
1070 \texttt{edit} command.
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
1071
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
1072 %%% Local Variables:
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
1073 %%% mode: latex
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
1074 %%% TeX-master: "00book"
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
1075 %%% End: