comparison en/ch11-template.xml @ 746:d0160b0b1a9e

Merge with http://hg.serpentine.com/mercurial/book
author Dongsheng Song <dongsheng.song@gmail.com>
date Wed, 18 Mar 2009 20:32:37 +0800
parents cfdb601a3c8b 8366882f67f2
children
comparison
equal deleted inserted replaced
745:c2cefd9f9893 746:d0160b0b1a9e
42 42
43 <sect2> 43 <sect2>
44 <title>Setting a default style</title> 44 <title>Setting a default style</title>
45 45
46 <para>You can modify the output style that Mercurial will use 46 <para>You can modify the output style that Mercurial will use
47 for every command by editing your <filename role="special"> 47 for every command by editing your <filename
48 /.hgrc</filename>\ file, naming the style you would prefer 48 role="special">~/.hgrc</filename> file, naming the style
49 to use.</para> 49 you would prefer to use.</para>
50 50
51 <programlisting>[ui] style = compact</programlisting> 51 <programlisting>[ui]
52 style = compact</programlisting>
52 53
53 <para>If you write a style of your own, you can use it by either 54 <para>If you write a style of your own, you can use it by either
54 providing the path to your style file, or copying your style 55 providing the path to your style file, or copying your style
55 file into a location where Mercurial can find it (typically 56 file into a location where Mercurial can find it (typically
56 the <literal>templates</literal> subdirectory of your 57 the <literal>templates</literal> subdirectory of your
210 (<quote><literal>\</literal></quote>) character, it looks at the 211 (<quote><literal>\</literal></quote>) character, it looks at the
211 following character and substitutes the two characters with a 212 following character and substitutes the two characters with a
212 single replacement, as described below.</para> 213 single replacement, as described below.</para>
213 214
214 <itemizedlist> 215 <itemizedlist>
215 <listitem><para><literal>\textbackslash\textbackslash</literal>: 216 <listitem><para><literal>\</literal>:
216 Backslash, <quote><literal>\</literal></quote>, ASCII 217 Backslash, <quote><literal>\</literal></quote>, ASCII
217 134.</para> 218 134.</para>
218 </listitem> 219 </listitem>
219 <listitem><para><literal>\textbackslash n</literal>: Newline, 220 <listitem><para><literal>\n</literal>: Newline,
220 ASCII 12.</para> 221 ASCII 12.</para>
221 </listitem> 222 </listitem>
222 <listitem><para><literal>\textbackslash r</literal>: Carriage 223 <listitem><para><literal>\r</literal>: Carriage
223 return, ASCII 15.</para> 224 return, ASCII 15.</para>
224 </listitem> 225 </listitem>
225 <listitem><para><literal>\textbackslash t</literal>: Tab, ASCII 226 <listitem><para><literal>\t</literal>: Tab, ASCII
226 11.</para> 227 11.</para>
227 </listitem> 228 </listitem>
228 <listitem><para><literal>\textbackslash v</literal>: Vertical 229 <listitem><para><literal>\v</literal>: Vertical
229 tab, ASCII 13.</para> 230 tab, ASCII 13.</para>
230 </listitem> 231 </listitem>
231 <listitem><para><literal>\textbackslash {</literal>: Open curly 232 <listitem><para><literal>{</literal>: Open curly
232 brace, <quote><literal>{</literal></quote>, ASCII 233 brace, <quote><literal>{</literal></quote>, ASCII
233 173.</para> 234 173.</para>
234 </listitem> 235 </listitem>
235 <listitem><para><literal>\textbackslash }</literal>: Close curly 236 <listitem><para><literal>}</literal>: Close curly
236 brace, <quote><literal>}</literal></quote>, ASCII 237 brace, <quote><literal>}</literal></quote>, ASCII
237 175.</para> 238 175.</para>
238 </listitem></itemizedlist> 239 </listitem></itemizedlist>
239 240
240 <para>As indicated above, if you want the expansion of a template 241 <para>As indicated above, if you want the expansion of a template
546 hard to follow.</para> 547 hard to follow.</para>
547 548
548 <itemizedlist> 549 <itemizedlist>
549 <listitem><para>The first component is simply Mercurial's way 550 <listitem><para>The first component is simply Mercurial's way
550 of saying <quote>I am giving up</quote>.</para> 551 of saying <quote>I am giving up</quote>.</para>
551 <programlisting>___abort___: broken.style:1: parse 552 <programlisting>___abort___: broken.style:1: parse error</programlisting>
552 error</programlisting>
553 </listitem> 553 </listitem>
554 <listitem><para>Next comes the name of the style file that 554 <listitem><para>Next comes the name of the style file that
555 contains the error.</para> 555 contains the error.</para>
556 <programlisting> 556 <programlisting>abort: ___broken.style___:1: parse error</programlisting>
557 abort: ___broken.style___:1: parse error
558 </programlisting>
559 </listitem> 557 </listitem>
560 <listitem><para>Following the file name is the line number 558 <listitem><para>Following the file name is the line number
561 where the error was encountered.</para> 559 where the error was encountered.</para>
562 <programlisting>abort: broken.style:___1___: parse 560 <programlisting>abort: broken.style:___1___: parse error</programlisting>
563 error</programlisting>
564 </listitem> 561 </listitem>
565 <listitem><para>Finally, a description of what went 562 <listitem><para>Finally, a description of what went
566 wrong.</para> 563 wrong.</para>
567 <programlisting>abort: broken.style:1: ___parse 564 <programlisting>abort: broken.style:1: ___parse error___</programlisting>
568 error___</programlisting>
569 </listitem> 565 </listitem>
570 <listitem><para>The description of the problem is not always 566 <listitem><para>The description of the problem is not always
571 clear (as in this case), but even when it is cryptic, it 567 clear (as in this case), but even when it is cryptic, it
572 is almost always trivial to visually inspect the offending 568 is almost always trivial to visually inspect the offending
573 line in the style file and see what is wrong.</para> 569 line in the style file and see what is wrong.</para>