comparison en/ch14-hgext.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
164 say you weren't warned!</para> 164 say you weren't warned!</para>
165 </note> 165 </note>
166 <orderedlist> 166 <orderedlist>
167 <listitem><para>Clone the Python <literal>inotify</literal> 167 <listitem><para>Clone the Python <literal>inotify</literal>
168 binding repository. Build and install it.</para> 168 binding repository. Build and install it.</para>
169 <programlisting> 169 <programlisting>hg clone http://hg.kublai.com/python/inotify
170 hg clone http://hg.kublai.com/python/inotify cd inotify 170 cd inotify
171 python setup.py build --force sudo python setup.py install 171 python setup.py build --force
172 --skip-build 172 sudo python setup.py install --skip-build</programlisting>
173 </programlisting>
174 </listitem> 173 </listitem>
175 <listitem><para>Clone the <filename 174 <listitem><para>Clone the <filename
176 class="directory">crew</filename> Mercurial repository. 175 class="directory">crew</filename> Mercurial repository.
177 Clone the <literal role="hg-ext">inotify</literal> patch 176 Clone the <literal role="hg-ext">inotify</literal> patch
178 repository so that Mercurial Queues will be able to apply 177 repository so that Mercurial Queues will be able to apply
179 patches to your cope of the <filename 178 patches to your cope of the <filename
180 class="directory">crew</filename> repository.</para> 179 class="directory">crew</filename> repository.</para>
181 <programlisting> 180 <programlisting>hg clone http://hg.intevation.org/mercurial/crew
182 hg clone http://hg.intevation.org/mercurial/crew hg clone 181 hg clone crew inotify
183 crew inotify hg clone 182 hg clone http://hg.kublai.com/mercurial/patches/inotify inotify/.hg/patches</programlisting>
184 http://hg.kublai.com/mercurial/patches/inotify
185 inotify/.hg/patches
186 </programlisting>
187 </listitem> 183 </listitem>
188 <listitem><para>Make sure that you have the Mercurial Queues 184 <listitem><para>Make sure that you have the Mercurial Queues
189 extension, <literal role="hg-ext">mq</literal>, enabled. If 185 extension, <literal role="hg-ext">mq</literal>, enabled. If
190 you've never used MQ, read section <xref 186 you've never used MQ, read section <xref
191 linkend="sec.mq.start"/> to get started 187 linkend="sec.mq.start"/> to get started
195 class="directory">inotify</filename> repo, and apply all 191 class="directory">inotify</filename> repo, and apply all
196 of the <literal role="hg-ext">inotify</literal> patches 192 of the <literal role="hg-ext">inotify</literal> patches
197 using the <option role="hg-ext-mq-cmd-qpush-opt">hg 193 using the <option role="hg-ext-mq-cmd-qpush-opt">hg
198 -a</option> option to the <command 194 -a</option> option to the <command
199 role="hg-ext-mq">qpush</command> command.</para> 195 role="hg-ext-mq">qpush</command> command.</para>
200 <programlisting> 196 <programlisting>cd inotify
201 cd inotify hg qpush -a 197 hg qpush -a</programlisting>
202 </programlisting>
203 </listitem> 198 </listitem>
204 <listitem><para> If you get an error message from <command 199 <listitem><para> If you get an error message from <command
205 role="hg-ext-mq">qpush</command>, you should not continue. 200 role="hg-ext-mq">qpush</command>, you should not continue.
206 Instead, ask for help.</para> 201 Instead, ask for help.</para>
207 </listitem> 202 </listitem>
208 <listitem><para>Build and install the patched version of 203 <listitem><para>Build and install the patched version of
209 Mercurial.</para> 204 Mercurial.</para>
210 <programlisting> 205 <programlisting>python setup.py build --force
211 python setup.py build --force sudo python setup.py install 206 sudo python setup.py install --skip-build</programlisting>
212 --skip-build
213 </programlisting>
214 </listitem> 207 </listitem>
215 </orderedlist> 208 </orderedlist>
216 <para>Once you've build a suitably patched version of Mercurial, 209 <para>Once you've build a suitably patched version of Mercurial,
217 all you need to do to enable the <literal 210 all you need to do to enable the <literal
218 role="hg-ext">inotify</literal> extension is add an entry to 211 role="hg-ext">inotify</literal> extension is add an entry to
219 your <filename role="special"> /.hgrc</filename>.</para> 212 your <filename role="special">~/.hgrc</filename>.</para>
220 <programlisting>[extensions] inotify =</programlisting> 213 <programlisting>[extensions] inotify =</programlisting>
221 <para>When the <literal role="hg-ext">inotify</literal> extension 214 <para>When the <literal role="hg-ext">inotify</literal> extension
222 is enabled, Mercurial will automatically and transparently start 215 is enabled, Mercurial will automatically and transparently start
223 the status daemon the first time you run a command that needs 216 the status daemon the first time you run a command that needs
224 status in a repository. It runs one status daemon per 217 status in a repository. It runs one status daemon per
278 use, for example, a graphical diff tool.</para> 271 use, for example, a graphical diff tool.</para>
279 272
280 <para>The <literal role="hg-ext">extdiff</literal> extension is 273 <para>The <literal role="hg-ext">extdiff</literal> extension is
281 bundled with Mercurial, so it's easy to set up. In the <literal 274 bundled with Mercurial, so it's easy to set up. In the <literal
282 role="rc-extensions">extensions</literal> section of your 275 role="rc-extensions">extensions</literal> section of your
283 <filename role="special"> /.hgrc</filename>, simply add a 276 <filename role="special">~/.hgrc</filename>, simply add a
284 one-line entry to enable the extension.</para> 277 one-line entry to enable the extension.</para>
285 <programlisting>[extensions] extdiff =</programlisting> 278 <programlisting>[extensions]
279 extdiff =</programlisting>
286 <para>This introduces a command named <command 280 <para>This introduces a command named <command
287 role="hg-ext-extdiff">extdiff</command>, which by default uses 281 role="hg-ext-extdiff">extdiff</command>, which by default uses
288 your system's <command>diff</command> command to generate a 282 your system's <command>diff</command> command to generate a
289 unified diff in the same form as the built-in <command 283 unified diff in the same form as the built-in <command
290 role="hg-cmd">hg diff</command> command.</para> 284 role="hg-cmd">hg diff</command> command.</para>
370 the diff viewer you want to use, so the <literal 364 the diff viewer you want to use, so the <literal
371 role="hg-ext">extdiff</literal> extension lets you define 365 role="hg-ext">extdiff</literal> extension lets you define
372 <emphasis>new</emphasis> commands that will invoke your diff 366 <emphasis>new</emphasis> commands that will invoke your diff
373 viewer with exactly the right options.</para> 367 viewer with exactly the right options.</para>
374 368
375 <para>All you need to do is edit your <filename role="special"> 369 <para>All you need to do is edit your <filename
376 /.hgrc</filename>, and add a section named <literal 370 role="special">~/.hgrc</filename>, and add a section named
377 role="rc-extdiff">extdiff</literal>. Inside this section, 371 <literal role="rc-extdiff">extdiff</literal>. Inside this
378 you can define multiple commands. Here's how to add a 372 section, you can define multiple commands. Here's how to add
379 <literal>kdiff3</literal> command. Once you've defined this, 373 a <literal>kdiff3</literal> command. Once you've defined
380 you can type <quote><literal>hg kdiff3</literal></quote> and 374 this, you can type <quote><literal>hg kdiff3</literal></quote>
381 the <literal role="hg-ext">extdiff</literal> extension will 375 and the <literal role="hg-ext">extdiff</literal> extension
382 run <command>kdiff3</command> for you.</para> 376 will run <command>kdiff3</command> for you.</para>
383 <programlisting>[extdiff] cmd.kdiff3 =</programlisting> 377 <programlisting>[extdiff]
378 cmd.kdiff3 =</programlisting>
384 <para>If you leave the right hand side of the definition empty, 379 <para>If you leave the right hand side of the definition empty,
385 as above, the <literal role="hg-ext">extdiff</literal> 380 as above, the <literal role="hg-ext">extdiff</literal>
386 extension uses the name of the command you defined as the name 381 extension uses the name of the command you defined as the name
387 of the external program to run. But these names don't have to 382 of the external program to run. But these names don't have to
388 be the same. Here, we define a command named 383 be the same. Here, we define a command named
389 <quote><literal>hg wibble</literal></quote>, which runs 384 <quote><literal>hg wibble</literal></quote>, which runs
390 <command>kdiff3</command>.</para> 385 <command>kdiff3</command>.</para>
391 <programlisting>[extdiff] cmd.wibble = kdiff3</programlisting> 386 <programlisting>[extdiff]
387 cmd.wibble = kdiff3</programlisting>
392 388
393 <para>You can also specify the default options that you want to 389 <para>You can also specify the default options that you want to
394 invoke your diff viewing program with. The prefix to use is 390 invoke your diff viewing program with. The prefix to use is
395 <quote><literal>opts.</literal></quote>, followed by the name 391 <quote><literal>opts.</literal></quote>, followed by the name
396 of the command to which the options apply. This example 392 of the command to which the options apply. This example
397 defines a <quote><literal>hg vimdiff</literal></quote> command 393 defines a <quote><literal>hg vimdiff</literal></quote> command
398 that runs the <command>vim</command> editor's 394 that runs the <command>vim</command> editor's
399 <literal>DirDiff</literal> extension.</para> 395 <literal>DirDiff</literal> extension.</para>
400 <programlisting>[extdiff] cmd.vimdiff = vim opts.vimdiff = -f 396 <programlisting>[extdiff]
401 '+next' '+execute "DirDiff" argv(0) argv(1)'</programlisting> 397 cmd.vimdiff = vim
398 opts.vimdiff = -f '+next' '+execute "DirDiff" argv(0) argv(1)'</programlisting>
402 399
403 </sect2> 400 </sect2>
404 </sect1> 401 </sect1>
405 <sect1 id="sec.hgext.transplant"> 402 <sect1 id="sec.hgext.transplant">
406 <title>Cherrypicking changes with the <literal 403 <title>Cherrypicking changes with the <literal
431 428
432 <para>As usual, the basic configuration of the <literal 429 <para>As usual, the basic configuration of the <literal
433 role="hg-ext">patchbomb</literal> extension takes just one or 430 role="hg-ext">patchbomb</literal> extension takes just one or
434 two lines in your <filename role="special"> 431 two lines in your <filename role="special">
435 /.hgrc</filename>.</para> 432 /.hgrc</filename>.</para>
436 <programlisting>[extensions] patchbomb =</programlisting> 433 <programlisting>[extensions]
434 patchbomb =</programlisting>
437 <para>Once you've enabled the extension, you will have a new 435 <para>Once you've enabled the extension, you will have a new
438 command available, named <command 436 command available, named <command
439 role="hg-ext-patchbomb">email</command>.</para> 437 role="hg-ext-patchbomb">email</command>.</para>
440 438
441 <para>The safest and best way to invoke the <command 439 <para>The safest and best way to invoke the <command