annotate es/hgext.tex @ 550:f4904a9b4fdb

Started translating hgext
author Igor TAmara <igor@tamarapatino.org>
date Sat, 13 Dec 2008 23:55:07 -0500
parents aeda195f54a6
children 3cb3f9b418ea
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{Añadir funcionalidad con extensiones}
435
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
2 \label{chap:hgext}
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
3
550
f4904a9b4fdb Started translating hgext
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
4 A pesar de que el corazón de Mercurial es muy completo desde el punto
f4904a9b4fdb Started translating hgext
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
5 de vista de funcionalidad, carece de características rimbombantes
f4904a9b4fdb Started translating hgext
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
6 deliberadamente. Esta aproximación de preservar la simplicidad
f4904a9b4fdb Started translating hgext
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
7 mantiene el programa sencillo tanto para mantenedores como para
f4904a9b4fdb Started translating hgext
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
8 usuarios.
435
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
9
550
f4904a9b4fdb Started translating hgext
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
10 Si embargo Mercurial no le cierra las posibilidades a un conjunto
f4904a9b4fdb Started translating hgext
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
11 inflexible de órdenes: usted puede añadir características como
f4904a9b4fdb Started translating hgext
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
12 \emph{extensiones} (aveces llamadas \emph{añadidos}\ndt{plugins}). Ya
f4904a9b4fdb Started translating hgext
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
13 hemos discutido algunas de estas extensiones en capítulos anteriores:
435
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
14 \begin{itemize}
550
f4904a9b4fdb Started translating hgext
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
15 \item La sección~\ref{sec:tour-merge:fetch} cubre la extensión
f4904a9b4fdb Started translating hgext
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
16 \hgext{fetch}; que combina jalar cambios y fusionarlos con los
f4904a9b4fdb Started translating hgext
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
17 cambios locales en una sola orden: \hgxcmd{fetch}{fetch}.
f4904a9b4fdb Started translating hgext
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
18 \item En el capítulo~\ref{chap:hook}, cubrimos muchas extensiones que
f4904a9b4fdb Started translating hgext
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
19 son útiles en funcionalidades relacionadas con ganchos: Los
f4904a9b4fdb Started translating hgext
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
20 \hgext{acl} añaden listas de control de acceso; \hgext{bugzilla}
f4904a9b4fdb Started translating hgext
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
21 añade integración con el sistema de seguimiento de fallos Bugzilla; y
f4904a9b4fdb Started translating hgext
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
22 \hgext{notify} envía notificaciones por correo de nuevos cambios.
f4904a9b4fdb Started translating hgext
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
23 \item La extensión de administración de parches MQ es tan invaluable
f4904a9b4fdb Started translating hgext
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
24 que amerita dos capítulos y un apéndice por sí misma.
f4904a9b4fdb Started translating hgext
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
25 El capítulo~\ref{chap:mq} cubre lo básico; el
f4904a9b4fdb Started translating hgext
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
26 capítulo~\ref{chap:mq-collab} discute temas avanzados; y el
f4904a9b4fdb Started translating hgext
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
27 apéndice~\ref{chap:mqref} muestra en detalle cada orden.
435
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
28 \end{itemize}
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
29
550
f4904a9b4fdb Started translating hgext
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
30 En este capítulo cubriremos algunas extensiones adicionales
f4904a9b4fdb Started translating hgext
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
31 disponibles para Mercurial, y daremos un vistazo a la maquinaria que
f4904a9b4fdb Started translating hgext
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
32 necesita conocer en caso de que desee escribir una extensión.
435
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
33 \begin{itemize}
550
f4904a9b4fdb Started translating hgext
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
34 \item En la sección~\ref{sec:hgext:inotify}, discutiremos la
f4904a9b4fdb Started translating hgext
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
35 posibilidad de mejorar el desempeño \emph{en gran medida} con la extensión
f4904a9b4fdb Started translating hgext
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
36 \hgext{inotify}.
435
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
37 \end{itemize}
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
38
550
f4904a9b4fdb Started translating hgext
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
39 \section{Mejorar el desempeño con la extensión \hgext{inotify}}
435
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
40 \label{sec:hgext:inotify}
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
41
550
f4904a9b4fdb Started translating hgext
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
42 ¿Desea lograr que las operaciones más comunmente usadas de Mercurial se
f4904a9b4fdb Started translating hgext
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
43 ejecuten centenas de veces más rápido? ¡A leer!
435
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
44
550
f4904a9b4fdb Started translating hgext
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
45 Mercurial tiene gran desempeño bajo circunstancias normales. Por
f4904a9b4fdb Started translating hgext
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
46 ejemplo, cuando ejecuta la orden \hgcmd{status}, Mercurial tiene que
f4904a9b4fdb Started translating hgext
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
47 revisar casi todos los ficheros y directorios en su repositorio de
f4904a9b4fdb Started translating hgext
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
48 forma que pueda desplegar el estado de los ficheros. Muchas otras
f4904a9b4fdb Started translating hgext
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
49 órdenes tienen que hacer tal trabajo tras bambalinas; por ejemplo la
f4904a9b4fdb Started translating hgext
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
50 orden \hgcmd{diff} usa la maquinaria de estado para evitar hacer
f4904a9b4fdb Started translating hgext
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
51 operaciones de comparación costosas en ficheros que obviamente no han
f4904a9b4fdb Started translating hgext
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
52 cambiado.
435
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
53
550
f4904a9b4fdb Started translating hgext
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
54 Dado que obtener el estado de los ficheros es crucial para obtener
f4904a9b4fdb Started translating hgext
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
55 buen desempeño, los autores de Mercurial han optimizado este código en
f4904a9b4fdb Started translating hgext
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
56 la medida de lo posible. Sin embargo, no puede obviarse el hecho de
f4904a9b4fdb Started translating hgext
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
57 que cuando ejecuta \hgcmd{status}, Mercurial tendrá que hacer por lo
f4904a9b4fdb Started translating hgext
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
58 menos una costosa llamada al sistema por cada archivo administrado
f4904a9b4fdb Started translating hgext
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
59 para determinar si ha cambiado desde la última vez que se consignó.
f4904a9b4fdb Started translating hgext
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
60 Para un repositorio suficientemente grande, puede tardar bastante
f4904a9b4fdb Started translating hgext
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
61 tiempo.
435
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
62
550
f4904a9b4fdb Started translating hgext
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
63 Para mostrar en números la magnitud de este efect, creé un repositorio
f4904a9b4fdb Started translating hgext
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
64 que contenía 150.000 archivos administrador. Tardó diez segundos para
f4904a9b4fdb Started translating hgext
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
65 ejecutar \hgcmd{status}, a pesar de que \emph{ninguno} de los ficheros
f4904a9b4fdb Started translating hgext
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
66 había sido modificado.
435
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
67
550
f4904a9b4fdb Started translating hgext
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
68 Muchos sistemas operativos modernos contienen una facilidad de
f4904a9b4fdb Started translating hgext
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
69 notificación de archivos. Si un programa se registra con un servicio
f4904a9b4fdb Started translating hgext
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
70 apropiado, el sistema operativo le notificará siempre que un fichero
f4904a9b4fdb Started translating hgext
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
71 de interés haya sido creado, modificado o borrado. En sistemas Linux,
f4904a9b4fdb Started translating hgext
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
72 el componente del núcleo que lo hace se llama \texttt{inotify}.
435
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
73
550
f4904a9b4fdb Started translating hgext
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
74 La extensión \hgext{inotify} habla con el componente \texttt{inotify}
f4904a9b4fdb Started translating hgext
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
75 del núcleo para optimizar las órdenes de \hgcmd{status}. La extensión
f4904a9b4fdb Started translating hgext
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
76 tiene dos componentes. Un daemonio está en el fondo recibiendo
f4904a9b4fdb Started translating hgext
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
77 notificaciones del subsistema \texttt{inotify}. También escucha
f4904a9b4fdb Started translating hgext
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
78 conexiones de una orden regular de Mercurial. La extensión modifica
f4904a9b4fdb Started translating hgext
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
79 el comportamiento de Mercurial de tal forma que, en lugar de revisar
f4904a9b4fdb Started translating hgext
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
80 el sistema de ficheros, le pregunta al daemonio. Dado que el daemonio
f4904a9b4fdb Started translating hgext
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
81 tiene información perfecta acerca del estado del repositorio, puede
f4904a9b4fdb Started translating hgext
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
82 responder instantáneamente con el resultado, evitando la necesidad de
f4904a9b4fdb Started translating hgext
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
83 revisar cada directorio y fichero del repositorio.
435
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
84
550
f4904a9b4fdb Started translating hgext
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
85 Retomando los diez segundos que medí al ejecutar la orden
f4904a9b4fdb Started translating hgext
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
86 \hgcmd{status} de Mercurial sobre un repositorio de 150.000
f4904a9b4fdb Started translating hgext
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
87 ficheros. Con la extensión \hgext{inotify} habilitada, el tiempo se
f4904a9b4fdb Started translating hgext
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
88 disipó a 0.1~seconds, un factor \emph{cien veces} más rápido.
435
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
89
550
f4904a9b4fdb Started translating hgext
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
90 Antes de continuar, tenga en cuenta algunos detalles:
435
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
91 \begin{itemize}
550
f4904a9b4fdb Started translating hgext
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
92 \item La extensión \hgext{inotify} es específica de Linux. Porque se
f4904a9b4fdb Started translating hgext
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
93 enlaza directamente con el subsistema \texttt{inotify} del núcleo
f4904a9b4fdb Started translating hgext
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
94 Linux, no funciona en otros sistemas operativos.
f4904a9b4fdb Started translating hgext
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
95 \item Debería funcionar en cualquier distribución Linux a partir de
f4904a9b4fdb Started translating hgext
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
96 comienzos del 2005. Las distribuciones más antiguas deben tener un
f4904a9b4fdb Started translating hgext
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
97 kernel sin \texttt{inotify}, o una versión de \texttt{glibc} que no
f4904a9b4fdb Started translating hgext
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
98 tiene necesariamente el soporte para la interfaz.
f4904a9b4fdb Started translating hgext
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
99 \item No todos los sistemas de ficheros pueden usarse con la extensión
f4904a9b4fdb Started translating hgext
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
100 \hgext{inotify}. Los sistemas de ficheros tales como NFS no lo
f4904a9b4fdb Started translating hgext
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
101 soportan, por ejemplo, si está corriendo Mercurial en vaios
f4904a9b4fdb Started translating hgext
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
102 sistemas, montados todos sobre el mismo sistema de ficheros en red.
f4904a9b4fdb Started translating hgext
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
103 El sistema \texttt{inotify} del kernel no tiene forma de saber
f4904a9b4fdb Started translating hgext
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
104 acerca de los cambios hechos en otro sistema. La mayoría de
f4904a9b4fdb Started translating hgext
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
105 sistemas de ficheros locales (p.e.~ext3, XFS, ReiserFS) deberían
f4904a9b4fdb Started translating hgext
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
106 funcionar bien.
435
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
107 \end{itemize}
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
108
550
f4904a9b4fdb Started translating hgext
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
109 Hacia mayo de 2007 la extensión \hgext{inotify} no venía de forma
f4904a9b4fdb Started translating hgext
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
110 predeterminada en Mercurial\ndt{Desde el 2008 para kernels 2.6 viene
f4904a9b4fdb Started translating hgext
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
111 en Mercurial, pero no está activada de forma predeterminada}, y es
f4904a9b4fdb Started translating hgext
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
112 un poco más compleja de activar que otras extensiones. Pero la mejora
f4904a9b4fdb Started translating hgext
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
113 en el desempeño bien vale la pena!
435
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
114
550
f4904a9b4fdb Started translating hgext
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
115 La extensión venía en dos partes: un conjunto de parches al código
f4904a9b4fdb Started translating hgext
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
116 fuente de Mercurial, y una librería de interfaces de Python hacia el
f4904a9b4fdb Started translating hgext
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
117 subsistema \texttt{inotify}.
435
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
118 \begin{note}
550
f4904a9b4fdb Started translating hgext
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
119 Hay \emph{dos} librerías de enlace de Python hacia \texttt{inotify}.
f4904a9b4fdb Started translating hgext
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
120 Una de ellas se llama \texttt{pyinotify}, y en algunas
f4904a9b4fdb Started translating hgext
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
121 distribuciones de Linux se encuentra como \texttt{python-inotify}.
f4904a9b4fdb Started translating hgext
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
122 Esta es la que \emph{no} necesita, puesto que tiene muchos fallos,
f4904a9b4fdb Started translating hgext
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
123 y es ineficiente para ser práctica.
435
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
124 \end{note}
550
f4904a9b4fdb Started translating hgext
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
125 Para comenzar, es mejor tener una copia de Mercurial funcional
f4904a9b4fdb Started translating hgext
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
126 instalada:
435
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
127 \begin{note}
550
f4904a9b4fdb Started translating hgext
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
128 Si sigue las instrucciones a continuación, estará
f4904a9b4fdb Started translating hgext
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
129 \emph{reemplazando} y sobreescribiendo cualquier instalación previa
f4904a9b4fdb Started translating hgext
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
130 de Mercurial que pudiera tener, con el código de Mercurial ``más
f4904a9b4fdb Started translating hgext
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
131 reciente y peligrosa''. No diga que no se le advirtio!
435
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
132 \end{note}
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
133 \begin{enumerate}
550
f4904a9b4fdb Started translating hgext
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
134 \item Clone el repositorio de interfaz entre Python e
f4904a9b4fdb Started translating hgext
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
135 \texttt{inotify}. Ármelo e instálelo:
435
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
136 \begin{codesample4}
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
137 hg clone http://hg.kublai.com/python/inotify
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
138 cd inotify
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
139 python setup.py build --force
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
140 sudo python setup.py install --skip-build
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
141 \end{codesample4}
550
f4904a9b4fdb Started translating hgext
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
142 \item Clone el repositorio \dirname{crew} de Mercurial. Clone el
f4904a9b4fdb Started translating hgext
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
143 repositorio de parches de \hgext{inotify} de forma tal que las colas
f4904a9b4fdb Started translating hgext
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
144 de Mercurial puedan aplicar los parches sobre el repositorio \dirname{crew}.
435
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
145 \begin{codesample4}
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
146 hg clone http://hg.intevation.org/mercurial/crew
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
147 hg clone crew inotify
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
148 hg clone http://hg.kublai.com/mercurial/patches/inotify inotify/.hg/patches
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
149 \end{codesample4}
550
f4904a9b4fdb Started translating hgext
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
150 \item Asegúrese de instalar la extensión Colas de Mercurial
f4904a9b4fdb Started translating hgext
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
151 \hgext{mq} y que estén habilitadas. Si nunca ha usado MQ, lea la
f4904a9b4fdb Started translating hgext
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
152 sección~\ref{sec:mq:start} para poder comenzar rápidamente.
f4904a9b4fdb Started translating hgext
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
153 \item Vaya al repositorio de \dirname{inotify} y aplique todos los
f4904a9b4fdb Started translating hgext
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
154 parches de \hgext{inotify} con la opción \hgxopt{mq}{qpush}{-a} de
f4904a9b4fdb Started translating hgext
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
155 la orden \hgxcmd{mq}{qpush}.
435
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
156 \begin{codesample4}
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
157 cd inotify
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
158 hg qpush -a
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
159 \end{codesample4}
550
f4904a9b4fdb Started translating hgext
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
160 Si obtiene un mensaje de error de \hgxcmd{mq}{qpush}, no debería
f4904a9b4fdb Started translating hgext
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
161 continuar. Mejor pida ayuda.
f4904a9b4fdb Started translating hgext
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
162 \item Arme e instale la versión parchada de Mercurial.
435
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
163 \begin{codesample4}
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
164 python setup.py build --force
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
165 sudo python setup.py install --skip-build
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
166 \end{codesample4}
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
167 \end{enumerate}
550
f4904a9b4fdb Started translating hgext
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
168 Una vez que haya armado una versión funcional parchada de Mercurial,
f4904a9b4fdb Started translating hgext
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
169 todo lo que necesita es habilitar la extensión \hgext{inotify}
f4904a9b4fdb Started translating hgext
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
170 colocando una entrada en su \hgrc.
435
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
171 \begin{codesample2}
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
172 [extensions]
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
173 inotify =
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
174 \end{codesample2}
550
f4904a9b4fdb Started translating hgext
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
175 Cuando la extensión \hgext{inotify} esté habilitada, Mercurial
f4904a9b4fdb Started translating hgext
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
176 iniciará transparente y automáticamente el daemonio de estado la
f4904a9b4fdb Started translating hgext
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
177 primera vez que ejecute un comando que requiera estado del
f4904a9b4fdb Started translating hgext
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
178 repositorio. Ejecuta un daemoniot de estado por repositorio.
435
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
179
550
f4904a9b4fdb Started translating hgext
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
180 El daemonio de estado se inicia silenciosamente y se ejecuta en el
f4904a9b4fdb Started translating hgext
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
181 fondo. Si mira a la lista de procesos en ejecución después de
f4904a9b4fdb Started translating hgext
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
182 habilitar la extensión \hgext{inotify} y ejecuta unos pocos comandos
f4904a9b4fdb Started translating hgext
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
183 en diferentes repositorios, verá que hay algunos procesos de
f4904a9b4fdb Started translating hgext
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
184 \texttt{hg} por ahí, esperando actualizaciones del kernel y
f4904a9b4fdb Started translating hgext
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
185 solicitudes de Mercurial.
435
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
186
550
f4904a9b4fdb Started translating hgext
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
187 La primera vez que ejecuta un comando de Mercurial en un repositorio
f4904a9b4fdb Started translating hgext
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
188 cuando tiene la extensión \hgext{inotify} habilitada, correrá casi con
f4904a9b4fdb Started translating hgext
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
189 el mismo desempeño que una orden usual de Mercurial. Esto es debido a
f4904a9b4fdb Started translating hgext
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
190 que el estado del daemonio necesita aplicar una búsqueda normal sobre
f4904a9b4fdb Started translating hgext
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
191 el estado para poder tener una línea de partida frente a la cual
f4904a9b4fdb Started translating hgext
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
192 aplicar posteriormente actualizaciones del núcleo. De todas formas,
f4904a9b4fdb Started translating hgext
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
193 \emph{todo} comando posterior que haga cualquier clase de revisión del
f4904a9b4fdb Started translating hgext
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
194 estado debería ser notablemente más rápido en repositorios con incluso
f4904a9b4fdb Started translating hgext
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
195 un tamaño modesto. Aún mejor, a medida que su repositorio sea más
f4904a9b4fdb Started translating hgext
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
196 grande, mejor desempeño verá. El daemonio \hgext{inotify} hace
f4904a9b4fdb Started translating hgext
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
197 operaciones de estado de forma casi instantánea en repositorios de
f4904a9b4fdb Started translating hgext
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
198 todos los tamaños!
435
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
199
550
f4904a9b4fdb Started translating hgext
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
200 Si lo desea, puede iniciar manualmente un daemonio de estado con la orden
f4904a9b4fdb Started translating hgext
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
201 \hgxcmd{inotify}{inserve}. Esto le da un control un poco más fino
f4904a9b4fdb Started translating hgext
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
202 acerca de cómo debería ejecutarse el daemonio. Esta orden solamente
f4904a9b4fdb Started translating hgext
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
203 estará disponible cuando haya habilitado la extensión \hgext{inotify}.
435
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
204
550
f4904a9b4fdb Started translating hgext
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
205 Cuando esté usando la extensión \hgext{inotify},
f4904a9b4fdb Started translating hgext
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
206 \emph{no debería ver diferencia} en el comportamiento de Mercurial,
f4904a9b4fdb Started translating hgext
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
207 con la única excepción de que los comandos relacionados con el estado
f4904a9b4fdb Started translating hgext
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
208 deberían ejectuarse mucho más rápido que como solían hacerlo. Debería
f4904a9b4fdb Started translating hgext
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
209 esperar específicamente que las órdenes no deberían ofrecer salidas
f4904a9b4fdb Started translating hgext
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
210 distintas; ni ofrecer resultados diferentes. Si alguna de estas
f4904a9b4fdb Started translating hgext
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
211 situaciones ocurre, por favor reporte el fallo.
435
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
212
550
f4904a9b4fdb Started translating hgext
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
213 \section{Soporte flexible de diff con la extensión \hgext{extdiff}}
435
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
214 \label{sec:hgext:extdiff}
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
215
550
f4904a9b4fdb Started translating hgext
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
216 La orden predeterminada \hgcmd{diff} de Mercurial despliega diffs en
f4904a9b4fdb Started translating hgext
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
217 texto plano unificadas.
435
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
218 \interaction{extdiff.diff}
550
f4904a9b4fdb Started translating hgext
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
219 Si dese emplear una herramienta externa para desplegar las
f4904a9b4fdb Started translating hgext
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
220 modificaciones, querrá usar la extensión \hgext{extdiff}. Esta le
f4904a9b4fdb Started translating hgext
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
221 permitirá usar por ejemplo una herramienta gráfica de diff.
435
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
222
550
f4904a9b4fdb Started translating hgext
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
223 La extensión \hgext{extdiff} viene con Mercurial, y es fácil
f4904a9b4fdb Started translating hgext
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
224 configurarl. En la sección \rcsection{extensions} de su \hgrc,
f4904a9b4fdb Started translating hgext
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
225 basta con añadir una entrada de una línea para habilitar la extensión.
435
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
226 \begin{codesample2}
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
227 [extensions]
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
228 extdiff =
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
229 \end{codesample2}
550
f4904a9b4fdb Started translating hgext
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
230 Esto introduce una orden llamada \hgxcmd{extdiff}{extdiff}, que de
f4904a9b4fdb Started translating hgext
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
231 forma predeterminada usa su orden del sistema \command{diff} para
f4904a9b4fdb Started translating hgext
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
232 generar un diff unificado de la misma forma que lo hace el comando
f4904a9b4fdb Started translating hgext
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
233 predeterminado \hgcmd{diff}.
435
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
234 \interaction{extdiff.extdiff}
550
f4904a9b4fdb Started translating hgext
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
235 El resultado no será exactamente el mismo que con la orden interna
f4904a9b4fdb Started translating hgext
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
236 \hgcmd{diff}, puesto que la salida de \command{diff} varía de un
f4904a9b4fdb Started translating hgext
Igor TAmara <igor@tamarapatino.org>
parents: 539
diff changeset
237 sistema a otro, incluso pasando las mismas opciones.
435
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
238
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
239 As the ``\texttt{making snapshot}'' lines of output above imply, the
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
240 \hgxcmd{extdiff}{extdiff} command works by creating two snapshots of
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
241 your source tree. The first snapshot is of the source revision; the
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
242 second, of the target revision or working directory. The
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
243 \hgxcmd{extdiff}{extdiff} command generates these snapshots in a
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
244 temporary directory, passes the name of each directory to an external
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
245 diff viewer, then deletes the temporary directory. For efficiency, it
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
246 only snapshots the directories and files that have changed between the
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
247 two revisions.
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
248
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
249 Snapshot directory names have the same base name as your repository.
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
250 If your repository path is \dirname{/quux/bar/foo}, then \dirname{foo}
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
251 will be the name of each snapshot directory. Each snapshot directory
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
252 name has its changeset ID appended, if appropriate. If a snapshot is
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
253 of revision \texttt{a631aca1083f}, the directory will be named
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
254 \dirname{foo.a631aca1083f}. A snapshot of the working directory won't
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
255 have a changeset ID appended, so it would just be \dirname{foo} in
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
256 this example. To see what this looks like in practice, look again at
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
257 the \hgxcmd{extdiff}{extdiff} example above. Notice that the diff has
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
258 the snapshot directory names embedded in its header.
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
259
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
260 The \hgxcmd{extdiff}{extdiff} command accepts two important options.
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
261 The \hgxopt{extdiff}{extdiff}{-p} option lets you choose a program to
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
262 view differences with, instead of \command{diff}. With the
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
263 \hgxopt{extdiff}{extdiff}{-o} option, you can change the options that
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
264 \hgxcmd{extdiff}{extdiff} passes to the program (by default, these
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
265 options are ``\texttt{-Npru}'', which only make sense if you're
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
266 running \command{diff}). In other respects, the
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
267 \hgxcmd{extdiff}{extdiff} command acts similarly to the built-in
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
268 \hgcmd{diff} command: you use the same option names, syntax, and
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
269 arguments to specify the revisions you want, the files you want, and
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
270 so on.
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
271
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
272 As an example, here's how to run the normal system \command{diff}
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
273 command, getting it to generate context diffs (using the
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
274 \cmdopt{diff}{-c} option) instead of unified diffs, and five lines of
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
275 context instead of the default three (passing \texttt{5} as the
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
276 argument to the \cmdopt{diff}{-C} option).
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
277 \interaction{extdiff.extdiff-ctx}
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
278
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
279 Launching a visual diff tool is just as easy. Here's how to launch
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
280 the \command{kdiff3} viewer.
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
281 \begin{codesample2}
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
282 hg extdiff -p kdiff3 -o ''
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
283 \end{codesample2}
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
284
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
285 If your diff viewing command can't deal with directories, you can
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
286 easily work around this with a little scripting. For an example of
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
287 such scripting in action with the \hgext{mq} extension and the
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
288 \command{interdiff} command, see
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
289 section~\ref{mq-collab:tips:interdiff}.
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
290
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
291 \subsection{Defining command aliases}
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
292
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
293 It can be cumbersome to remember the options to both the
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
294 \hgxcmd{extdiff}{extdiff} command and the diff viewer you want to use,
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
295 so the \hgext{extdiff} extension lets you define \emph{new} commands
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
296 that will invoke your diff viewer with exactly the right options.
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
297
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
298 All you need to do is edit your \hgrc, and add a section named
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
299 \rcsection{extdiff}. Inside this section, you can define multiple
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
300 commands. Here's how to add a \texttt{kdiff3} command. Once you've
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
301 defined this, you can type ``\texttt{hg kdiff3}'' and the
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
302 \hgext{extdiff} extension will run \command{kdiff3} for you.
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
303 \begin{codesample2}
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
304 [extdiff]
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
305 cmd.kdiff3 =
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
306 \end{codesample2}
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
307 If you leave the right hand side of the definition empty, as above,
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
308 the \hgext{extdiff} extension uses the name of the command you defined
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
309 as the name of the external program to run. But these names don't
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
310 have to be the same. Here, we define a command named ``\texttt{hg
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
311 wibble}'', which runs \command{kdiff3}.
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
312 \begin{codesample2}
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
313 [extdiff]
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
314 cmd.wibble = kdiff3
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
315 \end{codesample2}
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
316
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
317 You can also specify the default options that you want to invoke your
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
318 diff viewing program with. The prefix to use is ``\texttt{opts.}'',
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
319 followed by the name of the command to which the options apply. This
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
320 example defines a ``\texttt{hg vimdiff}'' command that runs the
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
321 \command{vim} editor's \texttt{DirDiff} extension.
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
322 \begin{codesample2}
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
323 [extdiff]
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
324 cmd.vimdiff = vim
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
325 opts.vimdiff = -f '+next' '+execute "DirDiff" argv(0) argv(1)'
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
326 \end{codesample2}
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
327
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
328 \section{Cherrypicking changes with the \hgext{transplant} extension}
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
329 \label{sec:hgext:transplant}
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
330
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
331 Need to have a long chat with Brendan about this.
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
332
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
333 \section{Send changes via email with the \hgext{patchbomb} extension}
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
334 \label{sec:hgext:patchbomb}
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
335
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
336 Many projects have a culture of ``change review'', in which people
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
337 send their modifications to a mailing list for others to read and
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
338 comment on before they commit the final version to a shared
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
339 repository. Some projects have people who act as gatekeepers; they
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
340 apply changes from other people to a repository to which those others
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
341 don't have access.
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
342
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
343 Mercurial makes it easy to send changes over email for review or
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
344 application, via its \hgext{patchbomb} extension. The extension is so
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
345 namd because changes are formatted as patches, and it's usual to send
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
346 one changeset per email message. Sending a long series of changes by
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
347 email is thus much like ``bombing'' the recipient's inbox, hence
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
348 ``patchbomb''.
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
349
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
350 As usual, the basic configuration of the \hgext{patchbomb} extension
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
351 takes just one or two lines in your \hgrc.
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
352 \begin{codesample2}
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
353 [extensions]
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
354 patchbomb =
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
355 \end{codesample2}
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
356 Once you've enabled the extension, you will have a new command
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
357 available, named \hgxcmd{patchbomb}{email}.
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
358
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
359 The safest and best way to invoke the \hgxcmd{patchbomb}{email}
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
360 command is to \emph{always} run it first with the
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
361 \hgxopt{patchbomb}{email}{-n} option. This will show you what the
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
362 command \emph{would} send, without actually sending anything. Once
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
363 you've had a quick glance over the changes and verified that you are
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
364 sending the right ones, you can rerun the same command, with the
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
365 \hgxopt{patchbomb}{email}{-n} option removed.
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
366
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
367 The \hgxcmd{patchbomb}{email} command accepts the same kind of
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
368 revision syntax as every other Mercurial command. For example, this
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
369 command will send every revision between 7 and \texttt{tip},
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
370 inclusive.
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
371 \begin{codesample2}
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
372 hg email -n 7:tip
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
373 \end{codesample2}
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
374 You can also specify a \emph{repository} to compare with. If you
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
375 provide a repository but no revisions, the \hgxcmd{patchbomb}{email}
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
376 command will send all revisions in the local repository that are not
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
377 present in the remote repository. If you additionally specify
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
378 revisions or a branch name (the latter using the
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
379 \hgxopt{patchbomb}{email}{-b} option), this will constrain the
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
380 revisions sent.
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
381
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
382 It's perfectly safe to run the \hgxcmd{patchbomb}{email} command
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
383 without the names of the people you want to send to: if you do this,
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
384 it will just prompt you for those values interactively. (If you're
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
385 using a Linux or Unix-like system, you should have enhanced
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
386 \texttt{readline}-style editing capabilities when entering those
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
387 headers, too, which is useful.)
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
388
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
389 When you are sending just one revision, the \hgxcmd{patchbomb}{email}
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
390 command will by default use the first line of the changeset
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
391 description as the subject of the single email message it sends.
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
392
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
393 If you send multiple revisions, the \hgxcmd{patchbomb}{email} command
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
394 will usually send one message per changeset. It will preface the
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
395 series with an introductory message, in which you should describe the
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
396 purpose of the series of changes you're sending.
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
397
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
398 \subsection{Changing the behaviour of patchbombs}
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
399
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
400 Not every project has exactly the same conventions for sending changes
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
401 in email; the \hgext{patchbomb} extension tries to accommodate a
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
402 number of variations through command line options.
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
403 \begin{itemize}
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
404 \item You can write a subject for the introductory message on the
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
405 command line using the \hgxopt{patchbomb}{email}{-s} option. This
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
406 takes one argument, the text of the subject to use.
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
407 \item To change the email address from which the messages originate,
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
408 use the \hgxopt{patchbomb}{email}{-f} option. This takes one
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
409 argument, the email address to use.
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
410 \item The default behaviour is to send unified diffs (see
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
411 section~\ref{sec:mq:patch} for a description of the format), one per
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
412 message. You can send a binary bundle instead with the
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
413 \hgxopt{patchbomb}{email}{-b} option.
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
414 \item Unified diffs are normally prefaced with a metadata header. You
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
415 can omit this, and send unadorned diffs, with the
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
416 \hgxopt{patchbomb}{email}{--plain} option.
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
417 \item Diffs are normally sent ``inline'', in the same body part as the
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
418 description of a patch. This makes it easiest for the largest
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
419 number of readers to quote and respond to parts of a diff, as some
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
420 mail clients will only quote the first MIME body part in a message.
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
421 If you'd prefer to send the description and the diff in separate
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
422 body parts, use the \hgxopt{patchbomb}{email}{-a} option.
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
423 \item Instead of sending mail messages, you can write them to an
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
424 \texttt{mbox}-format mail folder using the
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
425 \hgxopt{patchbomb}{email}{-m} option. That option takes one
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
426 argument, the name of the file to write to.
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
427 \item If you would like to add a \command{diffstat}-format summary to
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
428 each patch, and one to the introductory message, use the
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
429 \hgxopt{patchbomb}{email}{-d} option. The \command{diffstat}
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
430 command displays a table containing the name of each file patched,
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
431 the number of lines affected, and a histogram showing how much each
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
432 file is modified. This gives readers a qualitative glance at how
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
433 complex a patch is.
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
434 \end{itemize}
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
435
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
436 %%% Local Variables:
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
437 %%% mode: latex
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
438 %%% TeX-master: "00book"
7e52f0cc4516 changed es/hgext.tex
jerojasro@localhost
parents: 432
diff changeset
439 %%% End: