Mercurial > hgbook
annotate es/template.tex @ 569:012631b248de
translated some templates chapter paragraphs
author | Igor Támara <igor@tamarapatino.org> |
---|---|
date | Sun, 28 Dec 2008 00:27:39 -0500 |
parents | b05e35d641e4 |
children | 1b8b19825994 |
rev | line source |
---|---|
569
012631b248de
translated some templates chapter paragraphs
Igor Támara <igor@tamarapatino.org>
parents:
501
diff
changeset
|
1 \chapter{Personalizar los mensajes de Mercurial} |
501
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
2 \label{chap:template} |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
3 |
569
012631b248de
translated some templates chapter paragraphs
Igor Támara <igor@tamarapatino.org>
parents:
501
diff
changeset
|
4 Mercurial provee un poderoso mecanismo que permite controlar como |
012631b248de
translated some templates chapter paragraphs
Igor Támara <igor@tamarapatino.org>
parents:
501
diff
changeset
|
5 despliega la información. El mecanismo se basa en plantillas. Puede |
012631b248de
translated some templates chapter paragraphs
Igor Támara <igor@tamarapatino.org>
parents:
501
diff
changeset
|
6 usar plantillas para generar salida específica para una orden |
012631b248de
translated some templates chapter paragraphs
Igor Támara <igor@tamarapatino.org>
parents:
501
diff
changeset
|
7 particular o para especificar la visualización completa de la interfaz |
012631b248de
translated some templates chapter paragraphs
Igor Támara <igor@tamarapatino.org>
parents:
501
diff
changeset
|
8 web embebida. |
501
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
9 |
569
012631b248de
translated some templates chapter paragraphs
Igor Támara <igor@tamarapatino.org>
parents:
501
diff
changeset
|
10 \section{Usar estilos que vienen con Mercurial} |
501
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
11 \label{sec:style} |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
12 |
569
012631b248de
translated some templates chapter paragraphs
Igor Támara <igor@tamarapatino.org>
parents:
501
diff
changeset
|
13 Hay ciertos estilos listos que vienen con Mercurial. Un estilo es |
012631b248de
translated some templates chapter paragraphs
Igor Támara <igor@tamarapatino.org>
parents:
501
diff
changeset
|
14 simplemente una plantilla predeterminada que alguien escribió e |
012631b248de
translated some templates chapter paragraphs
Igor Támara <igor@tamarapatino.org>
parents:
501
diff
changeset
|
15 instaló en un sitio en el cual Mercurial puede encontrarla. |
501
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
16 |
569
012631b248de
translated some templates chapter paragraphs
Igor Támara <igor@tamarapatino.org>
parents:
501
diff
changeset
|
17 Antes de dar un vistazo a los estilos que trae Mercurial, revisemos su |
012631b248de
translated some templates chapter paragraphs
Igor Támara <igor@tamarapatino.org>
parents:
501
diff
changeset
|
18 salida usual. |
501
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
19 |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
20 \interaction{template.simple.normal} |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
21 |
569
012631b248de
translated some templates chapter paragraphs
Igor Támara <igor@tamarapatino.org>
parents:
501
diff
changeset
|
22 Es en cierta medida informativa, pero ocupa mucho espacio---cinco |
012631b248de
translated some templates chapter paragraphs
Igor Támara <igor@tamarapatino.org>
parents:
501
diff
changeset
|
23 líneas de salida por cada conjunto de cambios. El estilo |
012631b248de
translated some templates chapter paragraphs
Igor Támara <igor@tamarapatino.org>
parents:
501
diff
changeset
|
24 \texttt{compact} lo reduce a tres líneas, presentadas de forma |
012631b248de
translated some templates chapter paragraphs
Igor Támara <igor@tamarapatino.org>
parents:
501
diff
changeset
|
25 suscinta. |
501
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
26 |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
27 \interaction{template.simple.compact} |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
28 |
569
012631b248de
translated some templates chapter paragraphs
Igor Támara <igor@tamarapatino.org>
parents:
501
diff
changeset
|
29 El estilo de la \texttt{bitácora de cambios} vislumbra el poder |
012631b248de
translated some templates chapter paragraphs
Igor Támara <igor@tamarapatino.org>
parents:
501
diff
changeset
|
30 expresivo del sistema de plantillas de Mercurial. Este estilo busca |
012631b248de
translated some templates chapter paragraphs
Igor Támara <igor@tamarapatino.org>
parents:
501
diff
changeset
|
31 seguir los estándares de bitácora de cambios del proyecto |
012631b248de
translated some templates chapter paragraphs
Igor Támara <igor@tamarapatino.org>
parents:
501
diff
changeset
|
32 GNU\cite{web:changelog}. |
501
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
33 |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
34 \interaction{template.simple.changelog} |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
35 |
569
012631b248de
translated some templates chapter paragraphs
Igor Támara <igor@tamarapatino.org>
parents:
501
diff
changeset
|
36 No es una sorpresa que el estilo predeterminado de Mercurial se llame |
012631b248de
translated some templates chapter paragraphs
Igor Támara <igor@tamarapatino.org>
parents:
501
diff
changeset
|
37 \texttt{default}\ndt{predeterminado}. |
501
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
38 |
569
012631b248de
translated some templates chapter paragraphs
Igor Támara <igor@tamarapatino.org>
parents:
501
diff
changeset
|
39 \subsection{Especificar un estilo predeterminado} |
501
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
40 |
569
012631b248de
translated some templates chapter paragraphs
Igor Támara <igor@tamarapatino.org>
parents:
501
diff
changeset
|
41 Puede modificar el estilo de presentación que Mercurial usará para |
012631b248de
translated some templates chapter paragraphs
Igor Támara <igor@tamarapatino.org>
parents:
501
diff
changeset
|
42 toda orden vía el fichero \hgrc\, indicando el estilo que prefiere |
012631b248de
translated some templates chapter paragraphs
Igor Támara <igor@tamarapatino.org>
parents:
501
diff
changeset
|
43 usar. |
501
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
44 |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
45 \begin{codesample2} |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
46 [ui] |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
47 style = compact |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
48 \end{codesample2} |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
49 |
569
012631b248de
translated some templates chapter paragraphs
Igor Támara <igor@tamarapatino.org>
parents:
501
diff
changeset
|
50 Si escribe un estilo, puede usarlo bien sea proveyendo la ruta a su |
012631b248de
translated some templates chapter paragraphs
Igor Támara <igor@tamarapatino.org>
parents:
501
diff
changeset
|
51 fichero de estilo o copiando su fichero de estilo a un lugar en el |
012631b248de
translated some templates chapter paragraphs
Igor Támara <igor@tamarapatino.org>
parents:
501
diff
changeset
|
52 cual Mercurial pueda encontrarlo(típicamente el subdirectorio |
012631b248de
translated some templates chapter paragraphs
Igor Támara <igor@tamarapatino.org>
parents:
501
diff
changeset
|
53 \texttt{templates} de su directorio de instalación de Mercurial). |
501
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
54 |
569
012631b248de
translated some templates chapter paragraphs
Igor Támara <igor@tamarapatino.org>
parents:
501
diff
changeset
|
55 \section{Órdenes que soportan estilos y plantillas} |
501
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
56 |
569
012631b248de
translated some templates chapter paragraphs
Igor Támara <igor@tamarapatino.org>
parents:
501
diff
changeset
|
57 Todas las órdenes de Mercurial``relacionadas con \texttt{log}'' le |
012631b248de
translated some templates chapter paragraphs
Igor Támara <igor@tamarapatino.org>
parents:
501
diff
changeset
|
58 permiten usar estilos y plantillas: \hgcmd{incoming}, \hgcmd{log}, |
012631b248de
translated some templates chapter paragraphs
Igor Támara <igor@tamarapatino.org>
parents:
501
diff
changeset
|
59 \hgcmd{outgoing} y \hgcmd{tip}. |
501
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
60 |
569
012631b248de
translated some templates chapter paragraphs
Igor Támara <igor@tamarapatino.org>
parents:
501
diff
changeset
|
61 Al momento de la escritura del manual estas son las únicas órdenes que |
012631b248de
translated some templates chapter paragraphs
Igor Támara <igor@tamarapatino.org>
parents:
501
diff
changeset
|
62 soportan estilos y plantillas. Dado que son las órdenes más |
012631b248de
translated some templates chapter paragraphs
Igor Támara <igor@tamarapatino.org>
parents:
501
diff
changeset
|
63 importantes que necesitan personalización, no ha habido muchas |
012631b248de
translated some templates chapter paragraphs
Igor Támara <igor@tamarapatino.org>
parents:
501
diff
changeset
|
64 solicitudes desde la comunidad de usuarios de Mercurial para añadir |
012631b248de
translated some templates chapter paragraphs
Igor Támara <igor@tamarapatino.org>
parents:
501
diff
changeset
|
65 soporte de plantillas y estilos a otras órdenes. |
501
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
66 |
569
012631b248de
translated some templates chapter paragraphs
Igor Támara <igor@tamarapatino.org>
parents:
501
diff
changeset
|
67 \section{Cuestiones básicas de plantillas} |
501
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
68 |
569
012631b248de
translated some templates chapter paragraphs
Igor Támara <igor@tamarapatino.org>
parents:
501
diff
changeset
|
69 Una plantilla de Mercurial es sencillamente una pieza de texto. |
012631b248de
translated some templates chapter paragraphs
Igor Támara <igor@tamarapatino.org>
parents:
501
diff
changeset
|
70 Cierta porción nunca cambia, otras partes se \emph{expanden}, o |
012631b248de
translated some templates chapter paragraphs
Igor Támara <igor@tamarapatino.org>
parents:
501
diff
changeset
|
71 reemplazan con texto nuevo cuando es necesario. |
501
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
72 |
569
012631b248de
translated some templates chapter paragraphs
Igor Támara <igor@tamarapatino.org>
parents:
501
diff
changeset
|
73 Antes de continuar, veamos de nuevo un ejemplo sencillo de la salida |
012631b248de
translated some templates chapter paragraphs
Igor Támara <igor@tamarapatino.org>
parents:
501
diff
changeset
|
74 usual de Mercurial: |
501
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
75 |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
76 \interaction{template.simple.normal} |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
77 |
569
012631b248de
translated some templates chapter paragraphs
Igor Támara <igor@tamarapatino.org>
parents:
501
diff
changeset
|
78 Ahora, ejecutemos la misma orden, pero usemos una plantilla para |
012631b248de
translated some templates chapter paragraphs
Igor Támara <igor@tamarapatino.org>
parents:
501
diff
changeset
|
79 modificar su salida: |
501
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
80 |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
81 \interaction{template.simple.simplest} |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
82 |
569
012631b248de
translated some templates chapter paragraphs
Igor Támara <igor@tamarapatino.org>
parents:
501
diff
changeset
|
83 El ejemplo anterior ilustra la plantilla más sencilla posible; es |
012631b248de
translated some templates chapter paragraphs
Igor Támara <igor@tamarapatino.org>
parents:
501
diff
changeset
|
84 solamente una porción estática de código que se imprime una vez por |
012631b248de
translated some templates chapter paragraphs
Igor Támara <igor@tamarapatino.org>
parents:
501
diff
changeset
|
85 cada conjunto de cambios. La opción \hgopt{log}{--template} de la |
012631b248de
translated some templates chapter paragraphs
Igor Támara <igor@tamarapatino.org>
parents:
501
diff
changeset
|
86 orden \hgcmd{log} indica a Mercurial usar el texto dado como la |
012631b248de
translated some templates chapter paragraphs
Igor Támara <igor@tamarapatino.org>
parents:
501
diff
changeset
|
87 plantilla cuando se imprime cada conjunto de cambios. |
501
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
88 |
569
012631b248de
translated some templates chapter paragraphs
Igor Támara <igor@tamarapatino.org>
parents:
501
diff
changeset
|
89 Observe que la cadena de plantilla anterior termina con el texto |
012631b248de
translated some templates chapter paragraphs
Igor Támara <igor@tamarapatino.org>
parents:
501
diff
changeset
|
90 ``\Verb+\n+''. Es una \emph{secuencia de control}, que le indica a |
012631b248de
translated some templates chapter paragraphs
Igor Támara <igor@tamarapatino.org>
parents:
501
diff
changeset
|
91 Mercurial imprimira una nueva línea al final de cada objeto de la |
012631b248de
translated some templates chapter paragraphs
Igor Támara <igor@tamarapatino.org>
parents:
501
diff
changeset
|
92 plantilla. Si omite esta nueva línea, Mercurial colocará cada pieza |
012631b248de
translated some templates chapter paragraphs
Igor Támara <igor@tamarapatino.org>
parents:
501
diff
changeset
|
93 de salida seguida. Si desea más detalles acerca de secuencias de |
012631b248de
translated some templates chapter paragraphs
Igor Támara <igor@tamarapatino.org>
parents:
501
diff
changeset
|
94 control, vea la sección~\ref{sec:template:escape}. |
501
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
95 |
569
012631b248de
translated some templates chapter paragraphs
Igor Támara <igor@tamarapatino.org>
parents:
501
diff
changeset
|
96 Una plantilla que imprime una cadena fija de texto siempre no es muy |
012631b248de
translated some templates chapter paragraphs
Igor Támara <igor@tamarapatino.org>
parents:
501
diff
changeset
|
97 útil; intentemos algo un poco más complejo. |
501
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
98 |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
99 \interaction{template.simple.simplesub} |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
100 |
569
012631b248de
translated some templates chapter paragraphs
Igor Támara <igor@tamarapatino.org>
parents:
501
diff
changeset
|
101 Como puede ver, la cadena ``\Verb+{desc}+'' en la plantilla ha sido |
012631b248de
translated some templates chapter paragraphs
Igor Támara <igor@tamarapatino.org>
parents:
501
diff
changeset
|
102 reemplazada en la salida con la descricipción de cada conjunto de |
012631b248de
translated some templates chapter paragraphs
Igor Támara <igor@tamarapatino.org>
parents:
501
diff
changeset
|
103 cambios. Cada vez que Mercurial encuentra texto encerrado entre |
012631b248de
translated some templates chapter paragraphs
Igor Támara <igor@tamarapatino.org>
parents:
501
diff
changeset
|
104 corchetes(``\texttt{\{}'' y ``\texttt{\}}''), intentará reemplazar los |
012631b248de
translated some templates chapter paragraphs
Igor Támara <igor@tamarapatino.org>
parents:
501
diff
changeset
|
105 corchetes y el texto con la expansión de lo que sea está adentro. |
012631b248de
translated some templates chapter paragraphs
Igor Támara <igor@tamarapatino.org>
parents:
501
diff
changeset
|
106 Para imprimir un corchete de forma literal, debe escaparlo, como se |
012631b248de
translated some templates chapter paragraphs
Igor Támara <igor@tamarapatino.org>
parents:
501
diff
changeset
|
107 describe en la sección~\ref{sec:template:escape}. |
501
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
108 |
569
012631b248de
translated some templates chapter paragraphs
Igor Támara <igor@tamarapatino.org>
parents:
501
diff
changeset
|
109 \section{Palabras claves más comunes en las plantillas} |
501
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
110 \label{sec:template:keyword} |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
111 |
569
012631b248de
translated some templates chapter paragraphs
Igor Támara <igor@tamarapatino.org>
parents:
501
diff
changeset
|
112 Puede empezar a escribir plantillas sencillas rápidamente con las |
012631b248de
translated some templates chapter paragraphs
Igor Támara <igor@tamarapatino.org>
parents:
501
diff
changeset
|
113 palabras claves descritas a continuación: |
501
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
114 |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
115 \begin{itemize} |
569
012631b248de
translated some templates chapter paragraphs
Igor Támara <igor@tamarapatino.org>
parents:
501
diff
changeset
|
116 \item[\tplkword{author}] Cadena. El autor NO modificado del conjunto |
012631b248de
translated some templates chapter paragraphs
Igor Támara <igor@tamarapatino.org>
parents:
501
diff
changeset
|
117 de cambios. |
012631b248de
translated some templates chapter paragraphs
Igor Támara <igor@tamarapatino.org>
parents:
501
diff
changeset
|
118 \item[\tplkword{branches}] Cadena. El nombre de la rama en la cual se |
012631b248de
translated some templates chapter paragraphs
Igor Támara <igor@tamarapatino.org>
parents:
501
diff
changeset
|
119 consignó el conjunto de cambios. Será vacía si el nombre de la rama es |
501
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
120 \texttt{default}. |
569
012631b248de
translated some templates chapter paragraphs
Igor Támara <igor@tamarapatino.org>
parents:
501
diff
changeset
|
121 \item[\tplkword{date}] Información de fecha. La fecha en la cual se |
012631b248de
translated some templates chapter paragraphs
Igor Támara <igor@tamarapatino.org>
parents:
501
diff
changeset
|
122 consignó el conjunto de cambios. \emph{No} es legible por un |
012631b248de
translated some templates chapter paragraphs
Igor Támara <igor@tamarapatino.org>
parents:
501
diff
changeset
|
123 humano, debe pasarla por un firltro que la desplegará |
012631b248de
translated some templates chapter paragraphs
Igor Támara <igor@tamarapatino.org>
parents:
501
diff
changeset
|
124 apropiadamente. En la sección~\ref{sec:template:filter} hay más |
012631b248de
translated some templates chapter paragraphs
Igor Támara <igor@tamarapatino.org>
parents:
501
diff
changeset
|
125 detalles acerca de filtros. La fecha se expresa como un par de |
012631b248de
translated some templates chapter paragraphs
Igor Támara <igor@tamarapatino.org>
parents:
501
diff
changeset
|
126 números. El primer número corresponde a una marca de tiempo UNIX |
012631b248de
translated some templates chapter paragraphs
Igor Támara <igor@tamarapatino.org>
parents:
501
diff
changeset
|
127 UTC(segundos desde el primero de enero de 1970); la segunda es el |
012631b248de
translated some templates chapter paragraphs
Igor Támara <igor@tamarapatino.org>
parents:
501
diff
changeset
|
128 corrimiento horario de la zona horaria del UTC en la cual se encontraba |
012631b248de
translated some templates chapter paragraphs
Igor Támara <igor@tamarapatino.org>
parents:
501
diff
changeset
|
129 quien hizo la consignación, en segundos. |
012631b248de
translated some templates chapter paragraphs
Igor Támara <igor@tamarapatino.org>
parents:
501
diff
changeset
|
130 \item[\tplkword{desc}] Cadena. La descripción en texto del conjunto |
012631b248de
translated some templates chapter paragraphs
Igor Támara <igor@tamarapatino.org>
parents:
501
diff
changeset
|
131 de cambios. |
012631b248de
translated some templates chapter paragraphs
Igor Támara <igor@tamarapatino.org>
parents:
501
diff
changeset
|
132 \item[\tplkword{files}] Lista de cadenas. Todos los ficheros |
012631b248de
translated some templates chapter paragraphs
Igor Támara <igor@tamarapatino.org>
parents:
501
diff
changeset
|
133 modificados, adicionados o eliminados por este conjunto de cambios. |
012631b248de
translated some templates chapter paragraphs
Igor Támara <igor@tamarapatino.org>
parents:
501
diff
changeset
|
134 \item[\tplkword{file\_adds}] Lista de cadenas. Ficheros adicionados |
012631b248de
translated some templates chapter paragraphs
Igor Támara <igor@tamarapatino.org>
parents:
501
diff
changeset
|
135 por este conjunto de cambios. |
012631b248de
translated some templates chapter paragraphs
Igor Támara <igor@tamarapatino.org>
parents:
501
diff
changeset
|
136 \item[\tplkword{file\_dels}] Lista de cadenas. Ficheros eliminados |
012631b248de
translated some templates chapter paragraphs
Igor Támara <igor@tamarapatino.org>
parents:
501
diff
changeset
|
137 por este conjunto de cambios. |
012631b248de
translated some templates chapter paragraphs
Igor Támara <igor@tamarapatino.org>
parents:
501
diff
changeset
|
138 \item[\tplkword{node}] Cadena. El hash de identificación de este |
012631b248de
translated some templates chapter paragraphs
Igor Támara <igor@tamarapatino.org>
parents:
501
diff
changeset
|
139 conjunto de cambios como una cadena hexadecimal de 40 caracteres. |
012631b248de
translated some templates chapter paragraphs
Igor Támara <igor@tamarapatino.org>
parents:
501
diff
changeset
|
140 \item[\tplkword{parents}] Lista de cadenas. Los ancestros del |
012631b248de
translated some templates chapter paragraphs
Igor Támara <igor@tamarapatino.org>
parents:
501
diff
changeset
|
141 conjunto de cambios. |
012631b248de
translated some templates chapter paragraphs
Igor Támara <igor@tamarapatino.org>
parents:
501
diff
changeset
|
142 \item[\tplkword{rev}] Entero. El número de revisión del repositorio |
012631b248de
translated some templates chapter paragraphs
Igor Támara <igor@tamarapatino.org>
parents:
501
diff
changeset
|
143 local. |
012631b248de
translated some templates chapter paragraphs
Igor Támara <igor@tamarapatino.org>
parents:
501
diff
changeset
|
144 \item[\tplkword{tags}] Lista de cadenas. Todas las etiquetas |
012631b248de
translated some templates chapter paragraphs
Igor Támara <igor@tamarapatino.org>
parents:
501
diff
changeset
|
145 asociadas al conjunto de cambios. |
501
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
146 \end{itemize} |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
147 |
569
012631b248de
translated some templates chapter paragraphs
Igor Támara <igor@tamarapatino.org>
parents:
501
diff
changeset
|
148 Unos experimentos sencillos nos mostrarán qué esperar cuando usamos |
012631b248de
translated some templates chapter paragraphs
Igor Támara <igor@tamarapatino.org>
parents:
501
diff
changeset
|
149 estas palabras claves; puede ver los resultados en la |
012631b248de
translated some templates chapter paragraphs
Igor Támara <igor@tamarapatino.org>
parents:
501
diff
changeset
|
150 figura~\ref{fig:template:keywords}. |
501
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
151 |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
152 \begin{figure} |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
153 \interaction{template.simple.keywords} |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
154 \caption{Template keywords in use} |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
155 \label{fig:template:keywords} |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
156 \end{figure} |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
157 |
569
012631b248de
translated some templates chapter paragraphs
Igor Támara <igor@tamarapatino.org>
parents:
501
diff
changeset
|
158 Como mencionamos anteriormente, la palabra clave de fecha no produce |
012631b248de
translated some templates chapter paragraphs
Igor Támara <igor@tamarapatino.org>
parents:
501
diff
changeset
|
159 salida legible por un humano, debemos tratarla de forma especial. |
012631b248de
translated some templates chapter paragraphs
Igor Támara <igor@tamarapatino.org>
parents:
501
diff
changeset
|
160 Esto involucra usar un \emph{filtro}, acerca de lo cual hay más en la |
012631b248de
translated some templates chapter paragraphs
Igor Támara <igor@tamarapatino.org>
parents:
501
diff
changeset
|
161 sección~\ref{sec:template:filter}. |
501
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
162 |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
163 \interaction{template.simple.datekeyword} |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
164 |
569
012631b248de
translated some templates chapter paragraphs
Igor Támara <igor@tamarapatino.org>
parents:
501
diff
changeset
|
165 \section{Secuencias de Control} |
501
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
166 \label{sec:template:escape} |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
167 |
569
012631b248de
translated some templates chapter paragraphs
Igor Támara <igor@tamarapatino.org>
parents:
501
diff
changeset
|
168 El motor de plantillas de Mercurial reconoce las secuencias de control |
012631b248de
translated some templates chapter paragraphs
Igor Támara <igor@tamarapatino.org>
parents:
501
diff
changeset
|
169 más comunmente usadas dentro de las cadenas. Cuando ve un backslash |
012631b248de
translated some templates chapter paragraphs
Igor Támara <igor@tamarapatino.org>
parents:
501
diff
changeset
|
170 (``\Verb+\+''), ve el caracter siguiente y sustituye los dos |
012631b248de
translated some templates chapter paragraphs
Igor Támara <igor@tamarapatino.org>
parents:
501
diff
changeset
|
171 caracteres con un reemplazo sencillo, como se describe a continuación: |
501
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
172 |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
173 \begin{itemize} |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
174 \item[\Verb+\textbackslash\textbackslash+] Backslash, ``\Verb+\+'', |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
175 ASCII~134. |
569
012631b248de
translated some templates chapter paragraphs
Igor Támara <igor@tamarapatino.org>
parents:
501
diff
changeset
|
176 \item[\Verb+\textbackslash n+] Nueva línea, ASCII~12. |
012631b248de
translated some templates chapter paragraphs
Igor Támara <igor@tamarapatino.org>
parents:
501
diff
changeset
|
177 \item[\Verb+\textbackslash r+] Cambio de línea, ASCII~15. |
501
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
178 \item[\Verb+\textbackslash t+] Tab, ASCII~11. |
569
012631b248de
translated some templates chapter paragraphs
Igor Támara <igor@tamarapatino.org>
parents:
501
diff
changeset
|
179 \item[\Verb+\textbackslash v+] Tab Vertical, ASCII~13. |
012631b248de
translated some templates chapter paragraphs
Igor Támara <igor@tamarapatino.org>
parents:
501
diff
changeset
|
180 \item[\Verb+\textbackslash \{+] Corchete abierto, ``\Verb+{+'', ASCII~173. |
012631b248de
translated some templates chapter paragraphs
Igor Támara <igor@tamarapatino.org>
parents:
501
diff
changeset
|
181 \item[\Verb+\textbackslash \}+] Corchete cerrado, ``\Verb+}+'', ASCII~175. |
501
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
182 \end{itemize} |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
183 |
569
012631b248de
translated some templates chapter paragraphs
Igor Támara <igor@tamarapatino.org>
parents:
501
diff
changeset
|
184 Como se indicó arriba, si desea que la expansión en una plantilla |
012631b248de
translated some templates chapter paragraphs
Igor Támara <igor@tamarapatino.org>
parents:
501
diff
changeset
|
185 contenga un caracter literal ``\Verb+\+'', ``\Verb+{+'', o |
012631b248de
translated some templates chapter paragraphs
Igor Támara <igor@tamarapatino.org>
parents:
501
diff
changeset
|
186 ``\Verb+{+'', debe escaparlo. |
501
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
187 |
569
012631b248de
translated some templates chapter paragraphs
Igor Támara <igor@tamarapatino.org>
parents:
501
diff
changeset
|
188 \section{Uso de filtros con palabras claves} |
501
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
189 \label{sec:template:filter} |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
190 |
569
012631b248de
translated some templates chapter paragraphs
Igor Támara <igor@tamarapatino.org>
parents:
501
diff
changeset
|
191 Algunos de los resultados de la expansión de la plantilla no son |
012631b248de
translated some templates chapter paragraphs
Igor Támara <igor@tamarapatino.org>
parents:
501
diff
changeset
|
192 fáciles de usar de inmediato. Mercurial le permite especificar una |
012631b248de
translated some templates chapter paragraphs
Igor Támara <igor@tamarapatino.org>
parents:
501
diff
changeset
|
193 cadena de \emph{filtros} opcionales para modificar el resultado de |
012631b248de
translated some templates chapter paragraphs
Igor Támara <igor@tamarapatino.org>
parents:
501
diff
changeset
|
194 expandir una palabra clave. Ya ha visto el filtro usual |
012631b248de
translated some templates chapter paragraphs
Igor Támara <igor@tamarapatino.org>
parents:
501
diff
changeset
|
195 \tplkwfilt{date}{isodate} en acción con anterioridad para hacer |
012631b248de
translated some templates chapter paragraphs
Igor Támara <igor@tamarapatino.org>
parents:
501
diff
changeset
|
196 legible la fecha. |
501
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
197 |
569
012631b248de
translated some templates chapter paragraphs
Igor Támara <igor@tamarapatino.org>
parents:
501
diff
changeset
|
198 A continuación hay una lista de los filtros de Mercurial más |
012631b248de
translated some templates chapter paragraphs
Igor Támara <igor@tamarapatino.org>
parents:
501
diff
changeset
|
199 comunmente usados. Ciertos filtros pueden aplicarse a cualquier |
012631b248de
translated some templates chapter paragraphs
Igor Támara <igor@tamarapatino.org>
parents:
501
diff
changeset
|
200 texto, otros pueden usarse únicamente en circunstancias específicas. |
012631b248de
translated some templates chapter paragraphs
Igor Támara <igor@tamarapatino.org>
parents:
501
diff
changeset
|
201 El nombre de cada filtro está seguido de la indicación de dónde puede |
012631b248de
translated some templates chapter paragraphs
Igor Támara <igor@tamarapatino.org>
parents:
501
diff
changeset
|
202 ser usado y una descripción de su efecto. |
501
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
203 |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
204 \begin{itemize} |
569
012631b248de
translated some templates chapter paragraphs
Igor Támara <igor@tamarapatino.org>
parents:
501
diff
changeset
|
205 \item[\tplfilter{addbreaks}] Cualquier texto. Añade una etiqueta XHTML |
012631b248de
translated some templates chapter paragraphs
Igor Támara <igor@tamarapatino.org>
parents:
501
diff
changeset
|
206 ``\Verb+<br/>+'' antes del final de cada línea excepto en la final. |
012631b248de
translated some templates chapter paragraphs
Igor Támara <igor@tamarapatino.org>
parents:
501
diff
changeset
|
207 Por ejemplo, ``\Verb+foo\nbar+'' se convierte en ``\Verb+foo<br/>\nbar+''. |
012631b248de
translated some templates chapter paragraphs
Igor Támara <igor@tamarapatino.org>
parents:
501
diff
changeset
|
208 \item[\tplkwfilt{date}{age}] palabra clave \tplkword{date}. Muestra |
012631b248de
translated some templates chapter paragraphs
Igor Támara <igor@tamarapatino.org>
parents:
501
diff
changeset
|
209 la edad de la fecha, relativa al tiempo actual. Ofrece una cadena como |
501
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
210 ``\Verb+10 minutes+''. |
569
012631b248de
translated some templates chapter paragraphs
Igor Támara <igor@tamarapatino.org>
parents:
501
diff
changeset
|
211 \item[\tplfilter{basename}] Cualquier texto, pero de utilidad sobre |
012631b248de
translated some templates chapter paragraphs
Igor Támara <igor@tamarapatino.org>
parents:
501
diff
changeset
|
212 todo en palabras claves relativas a \tplkword{ficheros}. Trata el |
012631b248de
translated some templates chapter paragraphs
Igor Támara <igor@tamarapatino.org>
parents:
501
diff
changeset
|
213 texto como una ruta, retornando el nombre base. Por ejemplo, |
012631b248de
translated some templates chapter paragraphs
Igor Támara <igor@tamarapatino.org>
parents:
501
diff
changeset
|
214 ``\Verb+foo/bar/baz+'', se convierte en ``\Verb+baz+''. |
501
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
215 \item[\tplkwfilt{date}{date}] \tplkword{date} keyword. Render a date |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
216 in a similar format to the Unix \tplkword{date} command, but with |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
217 timezone included. Yields a string like |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
218 ``\Verb+Mon Sep 04 15:13:13 2006 -0700+''. |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
219 \item[\tplkwfilt{author}{domain}] Any text, but most useful for the |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
220 \tplkword{author} keyword. Finds the first string that looks like |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
221 an email address, and extract just the domain component. For |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
222 example, ``\Verb+Bryan O'Sullivan <bos@serpentine.com>+'' becomes |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
223 ``\Verb+serpentine.com+''. |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
224 \item[\tplkwfilt{author}{email}] Any text, but most useful for the |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
225 \tplkword{author} keyword. Extract the first string that looks like |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
226 an email address. For example, |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
227 ``\Verb+Bryan O'Sullivan <bos@serpentine.com>+'' becomes |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
228 ``\Verb+bos@serpentine.com+''. |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
229 \item[\tplfilter{escape}] Any text. Replace the special XML/XHTML |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
230 characters ``\Verb+&+'', ``\Verb+<+'' and ``\Verb+>+'' with |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
231 XML entities. |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
232 \item[\tplfilter{fill68}] Any text. Wrap the text to fit in 68 |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
233 columns. This is useful before you pass text through the |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
234 \tplfilter{tabindent} filter, and still want it to fit in an |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
235 80-column fixed-font window. |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
236 \item[\tplfilter{fill76}] Any text. Wrap the text to fit in 76 |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
237 columns. |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
238 \item[\tplfilter{firstline}] Any text. Yield the first line of text, |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
239 without any trailing newlines. |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
240 \item[\tplkwfilt{date}{hgdate}] \tplkword{date} keyword. Render the |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
241 date as a pair of readable numbers. Yields a string like |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
242 ``\Verb+1157407993 25200+''. |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
243 \item[\tplkwfilt{date}{isodate}] \tplkword{date} keyword. Render the |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
244 date as a text string in ISO~8601 format. Yields a string like |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
245 ``\Verb+2006-09-04 15:13:13 -0700+''. |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
246 \item[\tplfilter{obfuscate}] Any text, but most useful for the |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
247 \tplkword{author} keyword. Yield the input text rendered as a |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
248 sequence of XML entities. This helps to defeat some particularly |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
249 stupid screen-scraping email harvesting spambots. |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
250 \item[\tplkwfilt{author}{person}] Any text, but most useful for the |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
251 \tplkword{author} keyword. Yield the text before an email address. |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
252 For example, ``\Verb+Bryan O'Sullivan <bos@serpentine.com>+'' |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
253 becomes ``\Verb+Bryan O'Sullivan+''. |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
254 \item[\tplkwfilt{date}{rfc822date}] \tplkword{date} keyword. Render a |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
255 date using the same format used in email headers. Yields a string |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
256 like ``\Verb+Mon, 04 Sep 2006 15:13:13 -0700+''. |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
257 \item[\tplkwfilt{node}{short}] Changeset hash. Yield the short form |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
258 of a changeset hash, i.e.~a 12-byte hexadecimal string. |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
259 \item[\tplkwfilt{date}{shortdate}] \tplkword{date} keyword. Render |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
260 the year, month, and day of the date. Yields a string like |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
261 ``\Verb+2006-09-04+''. |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
262 \item[\tplfilter{strip}] Any text. Strip all leading and trailing |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
263 whitespace from the string. |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
264 \item[\tplfilter{tabindent}] Any text. Yield the text, with every line |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
265 except the first starting with a tab character. |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
266 \item[\tplfilter{urlescape}] Any text. Escape all characters that are |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
267 considered ``special'' by URL parsers. For example, \Verb+foo bar+ |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
268 becomes \Verb+foo%20bar+. |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
269 \item[\tplkwfilt{author}{user}] Any text, but most useful for the |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
270 \tplkword{author} keyword. Return the ``user'' portion of an email |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
271 address. For example, |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
272 ``\Verb+Bryan O'Sullivan <bos@serpentine.com>+'' becomes |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
273 ``\Verb+bos+''. |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
274 \end{itemize} |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
275 |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
276 \begin{figure} |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
277 \interaction{template.simple.manyfilters} |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
278 \caption{Template filters in action} |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
279 \label{fig:template:filters} |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
280 \end{figure} |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
281 |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
282 \begin{note} |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
283 If you try to apply a filter to a piece of data that it cannot |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
284 process, Mercurial will fail and print a Python exception. For |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
285 example, trying to run the output of the \tplkword{desc} keyword |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
286 into the \tplkwfilt{date}{isodate} filter is not a good idea. |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
287 \end{note} |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
288 |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
289 \subsection{Combining filters} |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
290 |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
291 It is easy to combine filters to yield output in the form you would |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
292 like. The following chain of filters tidies up a description, then |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
293 makes sure that it fits cleanly into 68 columns, then indents it by a |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
294 further 8~characters (at least on Unix-like systems, where a tab is |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
295 conventionally 8~characters wide). |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
296 |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
297 \interaction{template.simple.combine} |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
298 |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
299 Note the use of ``\Verb+\t+'' (a tab character) in the template to |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
300 force the first line to be indented; this is necessary since |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
301 \tplkword{tabindent} indents all lines \emph{except} the first. |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
302 |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
303 Keep in mind that the order of filters in a chain is significant. The |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
304 first filter is applied to the result of the keyword; the second to |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
305 the result of the first filter; and so on. For example, using |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
306 \Verb+fill68|tabindent+ gives very different results from |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
307 \Verb+tabindent|fill68+. |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
308 |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
309 |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
310 \section{From templates to styles} |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
311 |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
312 A command line template provides a quick and simple way to format some |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
313 output. Templates can become verbose, though, and it's useful to be |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
314 able to give a template a name. A style file is a template with a |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
315 name, stored in a file. |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
316 |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
317 More than that, using a style file unlocks the power of Mercurial's |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
318 templating engine in ways that are not possible using the command line |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
319 \hgopt{log}{--template} option. |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
320 |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
321 \subsection{The simplest of style files} |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
322 |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
323 Our simple style file contains just one line: |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
324 |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
325 \interaction{template.simple.rev} |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
326 |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
327 This tells Mercurial, ``if you're printing a changeset, use the text |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
328 on the right as the template''. |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
329 |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
330 \subsection{Style file syntax} |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
331 |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
332 The syntax rules for a style file are simple. |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
333 |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
334 \begin{itemize} |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
335 \item The file is processed one line at a time. |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
336 |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
337 \item Leading and trailing white space are ignored. |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
338 |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
339 \item Empty lines are skipped. |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
340 |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
341 \item If a line starts with either of the characters ``\texttt{\#}'' or |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
342 ``\texttt{;}'', the entire line is treated as a comment, and skipped |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
343 as if empty. |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
344 |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
345 \item A line starts with a keyword. This must start with an |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
346 alphabetic character or underscore, and can subsequently contain any |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
347 alphanumeric character or underscore. (In regexp notation, a |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
348 keyword must match \Verb+[A-Za-z_][A-Za-z0-9_]*+.) |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
349 |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
350 \item The next element must be an ``\texttt{=}'' character, which can |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
351 be preceded or followed by an arbitrary amount of white space. |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
352 |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
353 \item If the rest of the line starts and ends with matching quote |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
354 characters (either single or double quote), it is treated as a |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
355 template body. |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
356 |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
357 \item If the rest of the line \emph{does not} start with a quote |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
358 character, it is treated as the name of a file; the contents of this |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
359 file will be read and used as a template body. |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
360 \end{itemize} |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
361 |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
362 \section{Style files by example} |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
363 |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
364 To illustrate how to write a style file, we will construct a few by |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
365 example. Rather than provide a complete style file and walk through |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
366 it, we'll mirror the usual process of developing a style file by |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
367 starting with something very simple, and walking through a series of |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
368 successively more complete examples. |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
369 |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
370 \subsection{Identifying mistakes in style files} |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
371 |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
372 If Mercurial encounters a problem in a style file you are working on, |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
373 it prints a terse error message that, once you figure out what it |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
374 means, is actually quite useful. |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
375 |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
376 \interaction{template.svnstyle.syntax.input} |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
377 |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
378 Notice that \filename{broken.style} attempts to define a |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
379 \texttt{changeset} keyword, but forgets to give any content for it. |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
380 When instructed to use this style file, Mercurial promptly complains. |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
381 |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
382 \interaction{template.svnstyle.syntax.error} |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
383 |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
384 This error message looks intimidating, but it is not too hard to |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
385 follow. |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
386 |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
387 \begin{itemize} |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
388 \item The first component is simply Mercurial's way of saying ``I am |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
389 giving up''. |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
390 \begin{codesample4} |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
391 \textbf{abort:} broken.style:1: parse error |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
392 \end{codesample4} |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
393 |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
394 \item Next comes the name of the style file that contains the error. |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
395 \begin{codesample4} |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
396 abort: \textbf{broken.style}:1: parse error |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
397 \end{codesample4} |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
398 |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
399 \item Following the file name is the line number where the error was |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
400 encountered. |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
401 \begin{codesample4} |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
402 abort: broken.style:\textbf{1}: parse error |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
403 \end{codesample4} |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
404 |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
405 \item Finally, a description of what went wrong. |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
406 \begin{codesample4} |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
407 abort: broken.style:1: \textbf{parse error} |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
408 \end{codesample4} |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
409 The description of the problem is not always clear (as in this |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
410 case), but even when it is cryptic, it is almost always trivial to |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
411 visually inspect the offending line in the style file and see what |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
412 is wrong. |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
413 \end{itemize} |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
414 |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
415 \subsection{Uniquely identifying a repository} |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
416 |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
417 If you would like to be able to identify a Mercurial repository |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
418 ``fairly uniquely'' using a short string as an identifier, you can |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
419 use the first revision in the repository. |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
420 \interaction{template.svnstyle.id} |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
421 This is not guaranteed to be unique, but it is nevertheless useful in |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
422 many cases. |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
423 \begin{itemize} |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
424 \item It will not work in a completely empty repository, because such |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
425 a repository does not have a revision~zero. |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
426 \item Neither will it work in the (extremely rare) case where a |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
427 repository is a merge of two or more formerly independent |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
428 repositories, and you still have those repositories around. |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
429 \end{itemize} |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
430 Here are some uses to which you could put this identifier: |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
431 \begin{itemize} |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
432 \item As a key into a table for a database that manages repositories |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
433 on a server. |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
434 \item As half of a \{\emph{repository~ID}, \emph{revision~ID}\} tuple. |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
435 Save this information away when you run an automated build or other |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
436 activity, so that you can ``replay'' the build later if necessary. |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
437 \end{itemize} |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
438 |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
439 \subsection{Mimicking Subversion's output} |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
440 |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
441 Let's try to emulate the default output format used by another |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
442 revision control tool, Subversion. |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
443 \interaction{template.svnstyle.short} |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
444 |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
445 Since Subversion's output style is fairly simple, it is easy to |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
446 copy-and-paste a hunk of its output into a file, and replace the text |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
447 produced above by Subversion with the template values we'd like to see |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
448 expanded. |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
449 \interaction{template.svnstyle.template} |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
450 |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
451 There are a few small ways in which this template deviates from the |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
452 output produced by Subversion. |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
453 \begin{itemize} |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
454 \item Subversion prints a ``readable'' date (the ``\texttt{Wed, 27 Sep |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
455 2006}'' in the example output above) in parentheses. Mercurial's |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
456 templating engine does not provide a way to display a date in this |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
457 format without also printing the time and time zone. |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
458 \item We emulate Subversion's printing of ``separator'' lines full of |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
459 ``\texttt{-}'' characters by ending the template with such a line. |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
460 We use the templating engine's \tplkword{header} keyword to print a |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
461 separator line as the first line of output (see below), thus |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
462 achieving similar output to Subversion. |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
463 \item Subversion's output includes a count in the header of the number |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
464 of lines in the commit message. We cannot replicate this in |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
465 Mercurial; the templating engine does not currently provide a filter |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
466 that counts the number of items it is passed. |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
467 \end{itemize} |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
468 It took me no more than a minute or two of work to replace literal |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
469 text from an example of Subversion's output with some keywords and |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
470 filters to give the template above. The style file simply refers to |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
471 the template. |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
472 \interaction{template.svnstyle.style} |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
473 |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
474 We could have included the text of the template file directly in the |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
475 style file by enclosing it in quotes and replacing the newlines with |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
476 ``\verb!\n!'' sequences, but it would have made the style file too |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
477 difficult to read. Readability is a good guide when you're trying to |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
478 decide whether some text belongs in a style file, or in a template |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
479 file that the style file points to. If the style file will look too |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
480 big or cluttered if you insert a literal piece of text, drop it into a |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
481 template instead. |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
482 |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
483 %%% Local Variables: |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
484 %%% mode: latex |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
485 %%% TeX-master: "00book" |
b05e35d641e4
Copying the files from en to es and taking intro chapter
Igor TAmara <igor@tamarapatino.org>
parents:
432
diff
changeset
|
486 %%% End: |