Mercurial > hgbook
annotate en/ch10-hook.xml @ 744:1114da00d30e
Fix '<programlisting>' in ch02-tour-basic.xml
author | Dongsheng Song <dongsheng.song@gmail.com> |
---|---|
date | Wed, 18 Mar 2009 19:43:46 +0800 |
parents | cfdb601a3c8b |
children | d0160b0b1a9e |
rev | line source |
---|---|
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1 <!-- vim: set filetype=docbkxml shiftwidth=2 autoindent expandtab tw=77 : --> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
2 |
724
cfdb601a3c8b
Fix imagedata fileref in xml files, and replace ':' with '.' in id attribute
Dongsheng Song <dongsheng.song@gmail.com>
parents:
671
diff
changeset
|
3 <chapter id="chap.hook"> |
671
13513d2a128d
Add sensible names to chapters.
Bryan O'Sullivan <bos@serpentine.com>
parents:
666
diff
changeset
|
4 <?dbhtml filename="handling-repository-events-with-hooks.html"?> |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
5 <title>Handling repository events with hooks</title> |
34
c0979ed1eabd
Get started on hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
6 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
7 <para>Mercurial offers a powerful mechanism to let you perform |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
8 automated actions in response to events that occur in a |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
9 repository. In some cases, you can even control Mercurial's |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
10 response to those events.</para> |
34
c0979ed1eabd
Get started on hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
11 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
12 <para>The name Mercurial uses for one of these actions is a |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
13 <emphasis>hook</emphasis>. Hooks are called |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
14 <quote>triggers</quote> in some revision control systems, but the |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
15 two names refer to the same idea.</para> |
34
c0979ed1eabd
Get started on hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
16 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
17 <sect1> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
18 <title>An overview of hooks in Mercurial</title> |
38
b49a7dd4e564
More content for hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
37
diff
changeset
|
19 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
20 <para>Here is a brief list of the hooks that Mercurial supports. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
21 We will revisit each of these hooks in more detail later, in |
724
cfdb601a3c8b
Fix imagedata fileref in xml files, and replace ':' with '.' in id attribute
Dongsheng Song <dongsheng.song@gmail.com>
parents:
671
diff
changeset
|
22 section <xref linkend="sec.hook.ref"/>.</para> |
41 | 23 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
24 <itemizedlist> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
25 <listitem><para><literal role="hook">changegroup</literal>: This |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
26 is run after a group of changesets has been brought into the |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
27 repository from elsewhere.</para> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
28 </listitem> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
29 <listitem><para><literal role="hook">commit</literal>: This is |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
30 run after a new changeset has been created in the local |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
31 repository.</para> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
32 </listitem> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
33 <listitem><para><literal role="hook">incoming</literal>: This is |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
34 run once for each new changeset that is brought into the |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
35 repository from elsewhere. Notice the difference from |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
36 <literal role="hook">changegroup</literal>, which is run |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
37 once per <emphasis>group</emphasis> of changesets brought |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
38 in.</para> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
39 </listitem> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
40 <listitem><para><literal role="hook">outgoing</literal>: This is |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
41 run after a group of changesets has been transmitted from |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
42 this repository.</para> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
43 </listitem> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
44 <listitem><para><literal role="hook">prechangegroup</literal>: |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
45 This is run before starting to bring a group of changesets |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
46 into the repository. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
47 </para> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
48 </listitem> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
49 <listitem><para><literal role="hook">precommit</literal>: |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
50 Controlling. This is run before starting a commit. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
51 </para> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
52 </listitem> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
53 <listitem><para><literal role="hook">preoutgoing</literal>: |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
54 Controlling. This is run before starting to transmit a group |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
55 of changesets from this repository. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
56 </para> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
57 </listitem> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
58 <listitem><para><literal role="hook">pretag</literal>: |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
59 Controlling. This is run before creating a tag. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
60 </para> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
61 </listitem> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
62 <listitem><para><literal |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
63 role="hook">pretxnchangegroup</literal>: Controlling. This |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
64 is run after a group of changesets has been brought into the |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
65 local repository from another, but before the transaction |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
66 completes that will make the changes permanent in the |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
67 repository. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
68 </para> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
69 </listitem> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
70 <listitem><para><literal role="hook">pretxncommit</literal>: |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
71 Controlling. This is run after a new changeset has been |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
72 created in the local repository, but before the transaction |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
73 completes that will make it permanent. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
74 </para> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
75 </listitem> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
76 <listitem><para><literal role="hook">preupdate</literal>: |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
77 Controlling. This is run before starting an update or merge |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
78 of the working directory. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
79 </para> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
80 </listitem> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
81 <listitem><para><literal role="hook">tag</literal>: This is run |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
82 after a tag is created. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
83 </para> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
84 </listitem> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
85 <listitem><para><literal role="hook">update</literal>: This is |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
86 run after an update or merge of the working directory has |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
87 finished. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
88 </para> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
89 </listitem></itemizedlist> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
90 <para>Each of the hooks whose description begins with the word |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
91 <quote>Controlling</quote> has the ability to determine whether |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
92 an activity can proceed. If the hook succeeds, the activity may |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
93 proceed; if it fails, the activity is either not permitted or |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
94 undone, depending on the hook. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
95 </para> |
38
b49a7dd4e564
More content for hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
37
diff
changeset
|
96 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
97 </sect1> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
98 <sect1> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
99 <title>Hooks and security</title> |
38
b49a7dd4e564
More content for hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
37
diff
changeset
|
100 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
101 <sect2> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
102 <title>Hooks are run with your privileges</title> |
38
b49a7dd4e564
More content for hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
37
diff
changeset
|
103 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
104 <para>When you run a Mercurial command in a repository, and the |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
105 command causes a hook to run, that hook runs on |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
106 <emphasis>your</emphasis> system, under |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
107 <emphasis>your</emphasis> user account, with |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
108 <emphasis>your</emphasis> privilege level. Since hooks are |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
109 arbitrary pieces of executable code, you should treat them |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
110 with an appropriate level of suspicion. Do not install a hook |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
111 unless you are confident that you know who created it and what |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
112 it does. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
113 </para> |
38
b49a7dd4e564
More content for hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
37
diff
changeset
|
114 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
115 <para>In some cases, you may be exposed to hooks that you did |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
116 not install yourself. If you work with Mercurial on an |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
117 unfamiliar system, Mercurial will run hooks defined in that |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
118 system's global <filename role="special"> /.hgrc</filename>\ |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
119 file. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
120 </para> |
38
b49a7dd4e564
More content for hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
37
diff
changeset
|
121 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
122 <para>If you are working with a repository owned by another |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
123 user, Mercurial can run hooks defined in that user's |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
124 repository, but it will still run them as <quote>you</quote>. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
125 For example, if you <command role="hg-cmd">hg pull</command> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
126 from that repository, and its <filename |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
127 role="special">.hg/hgrc</filename> defines a local <literal |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
128 role="hook">outgoing</literal> hook, that hook will run |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
129 under your user account, even though you don't own that |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
130 repository. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
131 </para> |
38
b49a7dd4e564
More content for hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
37
diff
changeset
|
132 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
133 <note> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
134 <para> This only applies if you are pulling from a repository |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
135 on a local or network filesystem. If you're pulling over |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
136 http or ssh, any <literal role="hook">outgoing</literal> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
137 hook will run under whatever account is executing the server |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
138 process, on the server. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
139 </para> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
140 </note> |
38
b49a7dd4e564
More content for hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
37
diff
changeset
|
141 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
142 <para>XXX To see what hooks are defined in a repository, use the |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
143 <command role="hg-cmd">hg config hooks</command> command. If |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
144 you are working in one repository, but talking to another that |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
145 you do not own (e.g. using <command role="hg-cmd">hg |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
146 pull</command> or <command role="hg-cmd">hg |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
147 incoming</command>), remember that it is the other |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
148 repository's hooks you should be checking, not your own. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
149 </para> |
38
b49a7dd4e564
More content for hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
37
diff
changeset
|
150 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
151 </sect2> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
152 <sect2> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
153 <title>Hooks do not propagate</title> |
38
b49a7dd4e564
More content for hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
37
diff
changeset
|
154 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
155 <para>In Mercurial, hooks are not revision controlled, and do |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
156 not propagate when you clone, or pull from, a repository. The |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
157 reason for this is simple: a hook is a completely arbitrary |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
158 piece of executable code. It runs under your user identity, |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
159 with your privilege level, on your machine. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
160 </para> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
161 |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
162 <para>It would be extremely reckless for any distributed |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
163 revision control system to implement revision-controlled |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
164 hooks, as this would offer an easily exploitable way to |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
165 subvert the accounts of users of the revision control system. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
166 </para> |
38
b49a7dd4e564
More content for hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
37
diff
changeset
|
167 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
168 <para>Since Mercurial does not propagate hooks, if you are |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
169 collaborating with other people on a common project, you |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
170 should not assume that they are using the same Mercurial hooks |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
171 as you are, or that theirs are correctly configured. You |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
172 should document the hooks you expect people to use. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
173 </para> |
38
b49a7dd4e564
More content for hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
37
diff
changeset
|
174 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
175 <para>In a corporate intranet, this is somewhat easier to |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
176 control, as you can for example provide a |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
177 <quote>standard</quote> installation of Mercurial on an NFS |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
178 filesystem, and use a site-wide <filename role="special"> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
179 /.hgrc</filename>\ file to define hooks that all users will |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
180 see. However, this too has its limits; see below. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
181 </para> |
38
b49a7dd4e564
More content for hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
37
diff
changeset
|
182 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
183 </sect2> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
184 <sect2> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
185 <title>Hooks can be overridden</title> |
38
b49a7dd4e564
More content for hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
37
diff
changeset
|
186 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
187 <para>Mercurial allows you to override a hook definition by |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
188 redefining the hook. You can disable it by setting its value |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
189 to the empty string, or change its behaviour as you wish. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
190 </para> |
38
b49a7dd4e564
More content for hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
37
diff
changeset
|
191 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
192 <para>If you deploy a system- or site-wide <filename |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
193 role="special"> /.hgrc</filename>\ file that defines some |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
194 hooks, you should thus understand that your users can disable |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
195 or override those hooks. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
196 </para> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
197 |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
198 </sect2> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
199 <sect2> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
200 <title>Ensuring that critical hooks are run</title> |
38
b49a7dd4e564
More content for hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
37
diff
changeset
|
201 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
202 <para>Sometimes you may want to enforce a policy that you do not |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
203 want others to be able to work around. For example, you may |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
204 have a requirement that every changeset must pass a rigorous |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
205 set of tests. Defining this requirement via a hook in a |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
206 site-wide <filename role="special"> /.hgrc</filename>\ won't |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
207 work for remote users on laptops, and of course local users |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
208 can subvert it at will by overriding the hook. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
209 </para> |
38
b49a7dd4e564
More content for hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
37
diff
changeset
|
210 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
211 <para>Instead, you can set up your policies for use of Mercurial |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
212 so that people are expected to propagate changes through a |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
213 well-known <quote>canonical</quote> server that you have |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
214 locked down and configured appropriately. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
215 </para> |
38
b49a7dd4e564
More content for hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
37
diff
changeset
|
216 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
217 <para>One way to do this is via a combination of social |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
218 engineering and technology. Set up a restricted-access |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
219 account; users can push changes over the network to |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
220 repositories managed by this account, but they cannot log into |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
221 the account and run normal shell commands. In this scenario, |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
222 a user can commit a changeset that contains any old garbage |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
223 they want. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
224 </para> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
225 |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
226 <para>When someone pushes a changeset to the server that |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
227 everyone pulls from, the server will test the changeset before |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
228 it accepts it as permanent, and reject it if it fails to pass |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
229 the test suite. If people only pull changes from this |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
230 filtering server, it will serve to ensure that all changes |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
231 that people pull have been automatically vetted. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
232 </para> |
38
b49a7dd4e564
More content for hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
37
diff
changeset
|
233 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
234 </sect2> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
235 </sect1> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
236 <sect1> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
237 <title>Care with <literal>pretxn</literal> hooks in a |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
238 shared-access repository</title> |
41 | 239 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
240 <para>If you want to use hooks to do some automated work in a |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
241 repository that a number of people have shared access to, you |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
242 need to be careful in how you do this. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
243 </para> |
41 | 244 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
245 <para>Mercurial only locks a repository when it is writing to the |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
246 repository, and only the parts of Mercurial that write to the |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
247 repository pay attention to locks. Write locks are necessary to |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
248 prevent multiple simultaneous writers from scribbling on each |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
249 other's work, corrupting the repository. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
250 </para> |
41 | 251 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
252 <para>Because Mercurial is careful with the order in which it |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
253 reads and writes data, it does not need to acquire a lock when |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
254 it wants to read data from the repository. The parts of |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
255 Mercurial that read from the repository never pay attention to |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
256 locks. This lockless reading scheme greatly increases |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
257 performance and concurrency. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
258 </para> |
41 | 259 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
260 <para>With great performance comes a trade-off, though, one which |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
261 has the potential to cause you trouble unless you're aware of |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
262 it. To describe this requires a little detail about how |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
263 Mercurial adds changesets to a repository and reads those |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
264 changes. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
265 </para> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
266 |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
267 <para>When Mercurial <emphasis>writes</emphasis> metadata, it |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
268 writes it straight into the destination file. It writes file |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
269 data first, then manifest data (which contains pointers to the |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
270 new file data), then changelog data (which contains pointers to |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
271 the new manifest data). Before the first write to each file, it |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
272 stores a record of where the end of the file was in its |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
273 transaction log. If the transaction must be rolled back, |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
274 Mercurial simply truncates each file back to the size it was |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
275 before the transaction began. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
276 </para> |
41 | 277 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
278 <para>When Mercurial <emphasis>reads</emphasis> metadata, it reads |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
279 the changelog first, then everything else. Since a reader will |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
280 only access parts of the manifest or file metadata that it can |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
281 see in the changelog, it can never see partially written data. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
282 </para> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
283 |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
284 <para>Some controlling hooks (<literal |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
285 role="hook">pretxncommit</literal> and <literal |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
286 role="hook">pretxnchangegroup</literal>) run when a |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
287 transaction is almost complete. All of the metadata has been |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
288 written, but Mercurial can still roll the transaction back and |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
289 cause the newly-written data to disappear. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
290 </para> |
41 | 291 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
292 <para>If one of these hooks runs for long, it opens a window of |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
293 time during which a reader can see the metadata for changesets |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
294 that are not yet permanent, and should not be thought of as |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
295 <quote>really there</quote>. The longer the hook runs, the |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
296 longer that window is open. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
297 </para> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
298 |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
299 <sect2> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
300 <title>The problem illustrated</title> |
41 | 301 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
302 <para>In principle, a good use for the <literal |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
303 role="hook">pretxnchangegroup</literal> hook would be to |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
304 automatically build and test incoming changes before they are |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
305 accepted into a central repository. This could let you |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
306 guarantee that nobody can push changes to this repository that |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
307 <quote>break the build</quote>. But if a client can pull |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
308 changes while they're being tested, the usefulness of the test |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
309 is zero; an unsuspecting someone can pull untested changes, |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
310 potentially breaking their build. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
311 </para> |
134
b727a63518d4
Minor updates to race description.
Bryan O'Sullivan <bos@serpentine.com>
parents:
41
diff
changeset
|
312 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
313 <para>The safest technological answer to this challenge is to |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
314 set up such a <quote>gatekeeper</quote> repository as |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
315 <emphasis>unidirectional</emphasis>. Let it take changes |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
316 pushed in from the outside, but do not allow anyone to pull |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
317 changes from it (use the <literal |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
318 role="hook">preoutgoing</literal> hook to lock it down). |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
319 Configure a <literal role="hook">changegroup</literal> hook so |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
320 that if a build or test succeeds, the hook will push the new |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
321 changes out to another repository that people |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
322 <emphasis>can</emphasis> pull from. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
323 </para> |
41 | 324 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
325 <para>In practice, putting a centralised bottleneck like this in |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
326 place is not often a good idea, and transaction visibility has |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
327 nothing to do with the problem. As the size of a |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
328 project&emdash;and the time it takes to build and |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
329 test&emdash;grows, you rapidly run into a wall with this |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
330 <quote>try before you buy</quote> approach, where you have |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
331 more changesets to test than time in which to deal with them. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
332 The inevitable result is frustration on the part of all |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
333 involved. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
334 </para> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
335 |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
336 <para>An approach that scales better is to get people to build |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
337 and test before they push, then run automated builds and tests |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
338 centrally <emphasis>after</emphasis> a push, to be sure all is |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
339 well. The advantage of this approach is that it does not |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
340 impose a limit on the rate at which the repository can accept |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
341 changes. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
342 </para> |
41 | 343 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
344 </sect2> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
345 </sect1> |
724
cfdb601a3c8b
Fix imagedata fileref in xml files, and replace ':' with '.' in id attribute
Dongsheng Song <dongsheng.song@gmail.com>
parents:
671
diff
changeset
|
346 <sect1 id="sec.hook.simple"> |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
347 <title>A short tutorial on using hooks</title> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
348 |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
349 <para>It is easy to write a Mercurial hook. Let's start with a |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
350 hook that runs when you finish a <command role="hg-cmd">hg |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
351 commit</command>, and simply prints the hash of the changeset |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
352 you just created. The hook is called <literal |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
353 role="hook">commit</literal>. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
354 </para> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
355 |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
356 <para>All hooks follow the pattern in this example.</para> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
357 |
666
8fcd44708f41
Uncomment all the mangled interaction examples.
Bryan O'Sullivan <bos@serpentine.com>
parents:
660
diff
changeset
|
358 &interaction.hook.simple.init; |
134
b727a63518d4
Minor updates to race description.
Bryan O'Sullivan <bos@serpentine.com>
parents:
41
diff
changeset
|
359 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
360 <para>You add an entry to the <literal |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
361 role="rc-hooks">hooks</literal> section of your <filename |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
362 role="special"> /.hgrc</filename>. On the left is the name of |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
363 the event to trigger on; on the right is the action to take. As |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
364 you can see, you can run an arbitrary shell command in a hook. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
365 Mercurial passes extra information to the hook using environment |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
366 variables (look for <envar>HG_NODE</envar> in the example). |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
367 </para> |
34
c0979ed1eabd
Get started on hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
368 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
369 <sect2> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
370 <title>Performing multiple actions per event</title> |
34
c0979ed1eabd
Get started on hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
371 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
372 <para>Quite often, you will want to define more than one hook |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
373 for a particular kind of event, as shown below.</para> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
374 |
666
8fcd44708f41
Uncomment all the mangled interaction examples.
Bryan O'Sullivan <bos@serpentine.com>
parents:
660
diff
changeset
|
375 &interaction.hook.simple.ext; |
34
c0979ed1eabd
Get started on hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
376 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
377 <para>Mercurial lets you do this by adding an |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
378 <emphasis>extension</emphasis> to the end of a hook's name. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
379 You extend a hook's name by giving the name of the hook, |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
380 followed by a full stop (the |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
381 <quote><literal>.</literal></quote> character), followed by |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
382 some more text of your choosing. For example, Mercurial will |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
383 run both <literal>commit.foo</literal> and |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
384 <literal>commit.bar</literal> when the |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
385 <literal>commit</literal> event occurs. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
386 </para> |
34
c0979ed1eabd
Get started on hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
387 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
388 <para>To give a well-defined order of execution when there are |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
389 multiple hooks defined for an event, Mercurial sorts hooks by |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
390 extension, and executes the hook commands in this sorted |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
391 order. In the above example, it will execute |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
392 <literal>commit.bar</literal> before |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
393 <literal>commit.foo</literal>, and <literal>commit</literal> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
394 before both. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
395 </para> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
396 |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
397 <para>It is a good idea to use a somewhat descriptive extension |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
398 when you define a new hook. This will help you to remember |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
399 what the hook was for. If the hook fails, you'll get an error |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
400 message that contains the hook name and extension, so using a |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
401 descriptive extension could give you an immediate hint as to |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
402 why the hook failed (see section <xref |
724
cfdb601a3c8b
Fix imagedata fileref in xml files, and replace ':' with '.' in id attribute
Dongsheng Song <dongsheng.song@gmail.com>
parents:
671
diff
changeset
|
403 linkend="sec.hook.perm"/> for an example). |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
404 </para> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
405 |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
406 </sect2> |
724
cfdb601a3c8b
Fix imagedata fileref in xml files, and replace ':' with '.' in id attribute
Dongsheng Song <dongsheng.song@gmail.com>
parents:
671
diff
changeset
|
407 <sect2 id="sec.hook.perm"> |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
408 <title>Controlling whether an activity can proceed</title> |
34
c0979ed1eabd
Get started on hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
409 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
410 <para>In our earlier examples, we used the <literal |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
411 role="hook">commit</literal> hook, which is run after a |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
412 commit has completed. This is one of several Mercurial hooks |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
413 that run after an activity finishes. Such hooks have no way |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
414 of influencing the activity itself. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
415 </para> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
416 |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
417 <para>Mercurial defines a number of events that occur before an |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
418 activity starts; or after it starts, but before it finishes. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
419 Hooks that trigger on these events have the added ability to |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
420 choose whether the activity can continue, or will abort. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
421 </para> |
34
c0979ed1eabd
Get started on hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
422 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
423 <para>The <literal role="hook">pretxncommit</literal> hook runs |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
424 after a commit has all but completed. In other words, the |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
425 metadata representing the changeset has been written out to |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
426 disk, but the transaction has not yet been allowed to |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
427 complete. The <literal role="hook">pretxncommit</literal> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
428 hook has the ability to decide whether the transaction can |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
429 complete, or must be rolled back. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
430 </para> |
34
c0979ed1eabd
Get started on hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
431 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
432 <para>If the <literal role="hook">pretxncommit</literal> hook |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
433 exits with a status code of zero, the transaction is allowed |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
434 to complete; the commit finishes; and the <literal |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
435 role="hook">commit</literal> hook is run. If the <literal |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
436 role="hook">pretxncommit</literal> hook exits with a |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
437 non-zero status code, the transaction is rolled back; the |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
438 metadata representing the changeset is erased; and the |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
439 <literal role="hook">commit</literal> hook is not run. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
440 </para> |
34
c0979ed1eabd
Get started on hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
441 |
666
8fcd44708f41
Uncomment all the mangled interaction examples.
Bryan O'Sullivan <bos@serpentine.com>
parents:
660
diff
changeset
|
442 &interaction.hook.simple.pretxncommit; |
34
c0979ed1eabd
Get started on hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
443 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
444 <para>The hook in the example above checks that a commit comment |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
445 contains a bug ID. If it does, the commit can complete. If |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
446 not, the commit is rolled back. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
447 </para> |
34
c0979ed1eabd
Get started on hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
448 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
449 </sect2> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
450 </sect1> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
451 <sect1> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
452 <title>Writing your own hooks</title> |
34
c0979ed1eabd
Get started on hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
453 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
454 <para>When you are writing a hook, you might find it useful to run |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
455 Mercurial either with the <option |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
456 role="hg-opt-global">-v</option> option, or the <envar |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
457 role="rc-item-ui">verbose</envar> config item set to |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
458 <quote>true</quote>. When you do so, Mercurial will print a |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
459 message before it calls each hook. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
460 </para> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
461 |
724
cfdb601a3c8b
Fix imagedata fileref in xml files, and replace ':' with '.' in id attribute
Dongsheng Song <dongsheng.song@gmail.com>
parents:
671
diff
changeset
|
462 <sect2 id="sec.hook.lang"> |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
463 <title>Choosing how your hook should run</title> |
34
c0979ed1eabd
Get started on hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
464 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
465 <para>You can write a hook either as a normal |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
466 program&emdash;typically a shell script&emdash;or as a Python |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
467 function that is executed within the Mercurial process. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
468 </para> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
469 |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
470 <para>Writing a hook as an external program has the advantage |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
471 that it requires no knowledge of Mercurial's internals. You |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
472 can call normal Mercurial commands to get any added |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
473 information you need. The trade-off is that external hooks |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
474 are slower than in-process hooks. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
475 </para> |
34
c0979ed1eabd
Get started on hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
476 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
477 <para>An in-process Python hook has complete access to the |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
478 Mercurial API, and does not <quote>shell out</quote> to |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
479 another process, so it is inherently faster than an external |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
480 hook. It is also easier to obtain much of the information |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
481 that a hook requires by using the Mercurial API than by |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
482 running Mercurial commands. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
483 </para> |
34
c0979ed1eabd
Get started on hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
484 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
485 <para>If you are comfortable with Python, or require high |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
486 performance, writing your hooks in Python may be a good |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
487 choice. However, when you have a straightforward hook to |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
488 write and you don't need to care about performance (probably |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
489 the majority of hooks), a shell script is perfectly fine. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
490 </para> |
37 | 491 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
492 </sect2> |
724
cfdb601a3c8b
Fix imagedata fileref in xml files, and replace ':' with '.' in id attribute
Dongsheng Song <dongsheng.song@gmail.com>
parents:
671
diff
changeset
|
493 <sect2 id="sec.hook.param"> |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
494 <title>Hook parameters</title> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
495 |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
496 <para>Mercurial calls each hook with a set of well-defined |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
497 parameters. In Python, a parameter is passed as a keyword |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
498 argument to your hook function. For an external program, a |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
499 parameter is passed as an environment variable. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
500 </para> |
37 | 501 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
502 <para>Whether your hook is written in Python or as a shell |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
503 script, the hook-specific parameter names and values will be |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
504 the same. A boolean parameter will be represented as a |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
505 boolean value in Python, but as the number 1 (for |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
506 <quote>true</quote>) or 0 (for <quote>false</quote>) as an |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
507 environment variable for an external hook. If a hook |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
508 parameter is named <literal>foo</literal>, the keyword |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
509 argument for a Python hook will also be named |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
510 <literal>foo</literal>, while the environment variable for an |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
511 external hook will be named <literal>HG_FOO</literal>. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
512 </para> |
34
c0979ed1eabd
Get started on hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
513 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
514 </sect2> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
515 <sect2> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
516 <title>Hook return values and activity control</title> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
517 |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
518 <para>A hook that executes successfully must exit with a status |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
519 of zero if external, or return boolean <quote>false</quote> if |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
520 in-process. Failure is indicated with a non-zero exit status |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
521 from an external hook, or an in-process hook returning boolean |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
522 <quote>true</quote>. If an in-process hook raises an |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
523 exception, the hook is considered to have failed. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
524 </para> |
34
c0979ed1eabd
Get started on hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
525 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
526 <para>For a hook that controls whether an activity can proceed, |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
527 zero/false means <quote>allow</quote>, while |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
528 non-zero/true/exception means <quote>deny</quote>. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
529 </para> |
34
c0979ed1eabd
Get started on hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
530 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
531 </sect2> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
532 <sect2> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
533 <title>Writing an external hook</title> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
534 |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
535 <para>When you define an external hook in your <filename |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
536 role="special"> /.hgrc</filename>\ and the hook is run, its |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
537 value is passed to your shell, which interprets it. This |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
538 means that you can use normal shell constructs in the body of |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
539 the hook. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
540 </para> |
34
c0979ed1eabd
Get started on hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
541 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
542 <para>An executable hook is always run with its current |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
543 directory set to a repository's root directory. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
544 </para> |
34
c0979ed1eabd
Get started on hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
545 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
546 <para>Each hook parameter is passed in as an environment |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
547 variable; the name is upper-cased, and prefixed with the |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
548 string <quote><literal>HG_</literal></quote>. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
549 </para> |
34
c0979ed1eabd
Get started on hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
550 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
551 <para>With the exception of hook parameters, Mercurial does not |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
552 set or modify any environment variables when running a hook. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
553 This is useful to remember if you are writing a site-wide hook |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
554 that may be run by a number of different users with differing |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
555 environment variables set. In multi-user situations, you |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
556 should not rely on environment variables being set to the |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
557 values you have in your environment when testing the hook. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
558 </para> |
37 | 559 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
560 </sect2> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
561 <sect2> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
562 <title>Telling Mercurial to use an in-process hook</title> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
563 |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
564 <para>The <filename role="special"> /.hgrc</filename>\ syntax |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
565 for defining an in-process hook is slightly different than for |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
566 an executable hook. The value of the hook must start with the |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
567 text <quote><literal>python:</literal></quote>, and continue |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
568 with the fully-qualified name of a callable object to use as |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
569 the hook's value. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
570 </para> |
37 | 571 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
572 <para>The module in which a hook lives is automatically imported |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
573 when a hook is run. So long as you have the module name and |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
574 <envar>PYTHONPATH</envar> right, it should <quote>just |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
575 work</quote>. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
576 </para> |
37 | 577 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
578 <para>The following <filename role="special"> /.hgrc</filename>\ |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
579 example snippet illustrates the syntax and meaning of the |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
580 notions we just described. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
581 </para> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
582 <programlisting>[hooks] commit.example = |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
583 python:mymodule.submodule.myhook</programlisting> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
584 <para>When Mercurial runs the <literal>commit.example</literal> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
585 hook, it imports <literal>mymodule.submodule</literal>, looks |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
586 for the callable object named <literal>myhook</literal>, and |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
587 calls it. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
588 </para> |
37 | 589 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
590 </sect2> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
591 <sect2> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
592 <title>Writing an in-process hook</title> |
37 | 593 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
594 <para>The simplest in-process hook does nothing, but illustrates |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
595 the basic shape of the hook API: |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
596 </para> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
597 <programlisting>def myhook(ui, repo, **kwargs): |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
598 pass</programlisting> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
599 <para>The first argument to a Python hook is always a <literal |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
600 role="py-mod-mercurial.ui">ui</literal> object. The second |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
601 is a repository object; at the moment, it is always an |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
602 instance of <literal |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
603 role="py-mod-mercurial.localrepo">localrepository</literal>. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
604 Following these two arguments are other keyword arguments. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
605 Which ones are passed in depends on the hook being called, but |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
606 a hook can ignore arguments it doesn't care about by dropping |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
607 them into a keyword argument dict, as with |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
608 <literal>**kwargs</literal> above. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
609 </para> |
37 | 610 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
611 </sect2> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
612 </sect1> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
613 <sect1> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
614 <title>Some hook examples</title> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
615 |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
616 <sect2> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
617 <title>Writing meaningful commit messages</title> |
37 | 618 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
619 <para>It's hard to imagine a useful commit message being very |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
620 short. The simple <literal role="hook">pretxncommit</literal> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
621 hook of the example below will prevent you from committing a |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
622 changeset with a message that is less than ten bytes long. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
623 </para> |
37 | 624 |
666
8fcd44708f41
Uncomment all the mangled interaction examples.
Bryan O'Sullivan <bos@serpentine.com>
parents:
660
diff
changeset
|
625 &interaction.hook.msglen.go; |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
626 |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
627 </sect2> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
628 <sect2> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
629 <title>Checking for trailing whitespace</title> |
37 | 630 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
631 <para>An interesting use of a commit-related hook is to help you |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
632 to write cleaner code. A simple example of <quote>cleaner |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
633 code</quote> is the dictum that a change should not add any |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
634 new lines of text that contain <quote>trailing |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
635 whitespace</quote>. Trailing whitespace is a series of |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
636 space and tab characters at the end of a line of text. In |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
637 most cases, trailing whitespace is unnecessary, invisible |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
638 noise, but it is occasionally problematic, and people often |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
639 prefer to get rid of it. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
640 </para> |
37 | 641 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
642 <para>You can use either the <literal |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
643 role="hook">precommit</literal> or <literal |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
644 role="hook">pretxncommit</literal> hook to tell whether you |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
645 have a trailing whitespace problem. If you use the <literal |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
646 role="hook">precommit</literal> hook, the hook will not know |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
647 which files you are committing, so it will have to check every |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
648 modified file in the repository for trailing white space. If |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
649 you want to commit a change to just the file |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
650 <filename>foo</filename>, but the file |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
651 <filename>bar</filename> contains trailing whitespace, doing a |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
652 check in the <literal role="hook">precommit</literal> hook |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
653 will prevent you from committing <filename>foo</filename> due |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
654 to the problem with <filename>bar</filename>. This doesn't |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
655 seem right. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
656 </para> |
34
c0979ed1eabd
Get started on hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
657 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
658 <para>Should you choose the <literal |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
659 role="hook">pretxncommit</literal> hook, the check won't |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
660 occur until just before the transaction for the commit |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
661 completes. This will allow you to check for problems only the |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
662 exact files that are being committed. However, if you entered |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
663 the commit message interactively and the hook fails, the |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
664 transaction will roll back; you'll have to re-enter the commit |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
665 message after you fix the trailing whitespace and run <command |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
666 role="hg-cmd">hg commit</command> again. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
667 </para> |
49 | 668 |
666
8fcd44708f41
Uncomment all the mangled interaction examples.
Bryan O'Sullivan <bos@serpentine.com>
parents:
660
diff
changeset
|
669 &interaction.hook.ws.simple; |
49 | 670 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
671 <para>In this example, we introduce a simple <literal |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
672 role="hook">pretxncommit</literal> hook that checks for |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
673 trailing whitespace. This hook is short, but not very |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
674 helpful. It exits with an error status if a change adds a |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
675 line with trailing whitespace to any file, but does not print |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
676 any information that might help us to identify the offending |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
677 file or line. It also has the nice property of not paying |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
678 attention to unmodified lines; only lines that introduce new |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
679 trailing whitespace cause problems. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
680 </para> |
44
012df94a02fe
Start hook examples. First is for trailing whitespace.
Bryan O'Sullivan <bos@serpentine.com>
parents:
41
diff
changeset
|
681 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
682 <para>The above version is much more complex, but also more |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
683 useful. It parses a unified diff to see if any lines add |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
684 trailing whitespace, and prints the name of the file and the |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
685 line number of each such occurrence. Even better, if the |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
686 change adds trailing whitespace, this hook saves the commit |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
687 comment and prints the name of the save file before exiting |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
688 and telling Mercurial to roll the transaction back, so you can |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
689 use the <option role="hg-opt-commit">-l filename</option> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
690 option to <command role="hg-cmd">hg commit</command> to reuse |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
691 the saved commit message once you've corrected the problem. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
692 </para> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
693 |
666
8fcd44708f41
Uncomment all the mangled interaction examples.
Bryan O'Sullivan <bos@serpentine.com>
parents:
660
diff
changeset
|
694 &interaction.hook.ws.better; |
44
012df94a02fe
Start hook examples. First is for trailing whitespace.
Bryan O'Sullivan <bos@serpentine.com>
parents:
41
diff
changeset
|
695 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
696 <para>As a final aside, note in the example above the use of |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
697 <command>perl</command>'s in-place editing feature to get rid |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
698 of trailing whitespace from a file. This is concise and |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
699 useful enough that I will reproduce it here. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
700 </para> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
701 <programlisting>perl -pi -e 's,\s+$,,' filename</programlisting> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
702 |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
703 </sect2> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
704 </sect1> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
705 <sect1> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
706 <title>Bundled hooks</title> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
707 |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
708 <para>Mercurial ships with several bundled hooks. You can find |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
709 them in the <filename class="directory">hgext</filename> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
710 directory of a Mercurial source tree. If you are using a |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
711 Mercurial binary package, the hooks will be located in the |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
712 <filename class="directory">hgext</filename> directory of |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
713 wherever your package installer put Mercurial. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
714 </para> |
44
012df94a02fe
Start hook examples. First is for trailing whitespace.
Bryan O'Sullivan <bos@serpentine.com>
parents:
41
diff
changeset
|
715 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
716 <sect2> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
717 <title><literal role="hg-ext">acl</literal>&emdash;access |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
718 control for parts of a repository</title> |
44
012df94a02fe
Start hook examples. First is for trailing whitespace.
Bryan O'Sullivan <bos@serpentine.com>
parents:
41
diff
changeset
|
719 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
720 <para>The <literal role="hg-ext">acl</literal> extension lets |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
721 you control which remote users are allowed to push changesets |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
722 to a networked server. You can protect any portion of a |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
723 repository (including the entire repo), so that a specific |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
724 remote user can push changes that do not affect the protected |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
725 portion. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
726 </para> |
44
012df94a02fe
Start hook examples. First is for trailing whitespace.
Bryan O'Sullivan <bos@serpentine.com>
parents:
41
diff
changeset
|
727 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
728 <para>This extension implements access control based on the |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
729 identity of the user performing a push, |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
730 <emphasis>not</emphasis> on who committed the changesets |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
731 they're pushing. It makes sense to use this hook only if you |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
732 have a locked-down server environment that authenticates |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
733 remote users, and you want to be sure that only specific users |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
734 are allowed to push changes to that server. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
735 </para> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
736 |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
737 <sect3> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
738 <title>Configuring the <literal role="hook">acl</literal> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
739 hook</title> |
49 | 740 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
741 <para>In order to manage incoming changesets, the <literal |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
742 role="hg-ext">acl</literal> hook must be used as a |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
743 <literal role="hook">pretxnchangegroup</literal> hook. This |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
744 lets it see which files are modified by each incoming |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
745 changeset, and roll back a group of changesets if they |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
746 modify <quote>forbidden</quote> files. Example: |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
747 </para> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
748 <programlisting>[hooks] pretxnchangegroup.acl = |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
749 python:hgext.acl.hook</programlisting> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
750 |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
751 <para>The <literal role="hg-ext">acl</literal> extension is |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
752 configured using three sections. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
753 </para> |
49 | 754 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
755 <para>The <literal role="rc-acl">acl</literal> section has |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
756 only one entry, <envar role="rc-item-acl">sources</envar>, |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
757 which lists the sources of incoming changesets that the hook |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
758 should pay attention to. You don't normally need to |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
759 configure this section. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
760 </para> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
761 <itemizedlist> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
762 <listitem><para><envar role="rc-item-acl">serve</envar>: |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
763 Control incoming changesets that are arriving from a |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
764 remote repository over http or ssh. This is the default |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
765 value of <envar role="rc-item-acl">sources</envar>, and |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
766 usually the only setting you'll need for this |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
767 configuration item. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
768 </para> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
769 </listitem> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
770 <listitem><para><envar role="rc-item-acl">pull</envar>: |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
771 Control incoming changesets that are arriving via a pull |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
772 from a local repository. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
773 </para> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
774 </listitem> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
775 <listitem><para><envar role="rc-item-acl">push</envar>: |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
776 Control incoming changesets that are arriving via a push |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
777 from a local repository. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
778 </para> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
779 </listitem> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
780 <listitem><para><envar role="rc-item-acl">bundle</envar>: |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
781 Control incoming changesets that are arriving from |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
782 another repository via a bundle. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
783 </para> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
784 </listitem></itemizedlist> |
49 | 785 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
786 <para>The <literal role="rc-acl.allow">acl.allow</literal> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
787 section controls the users that are allowed to add |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
788 changesets to the repository. If this section is not |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
789 present, all users that are not explicitly denied are |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
790 allowed. If this section is present, all users that are not |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
791 explicitly allowed are denied (so an empty section means |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
792 that all users are denied). |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
793 </para> |
49 | 794 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
795 <para>The <literal role="rc-acl.deny">acl.deny</literal> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
796 section determines which users are denied from adding |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
797 changesets to the repository. If this section is not |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
798 present or is empty, no users are denied. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
799 </para> |
49 | 800 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
801 <para>The syntaxes for the <literal |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
802 role="rc-acl.allow">acl.allow</literal> and <literal |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
803 role="rc-acl.deny">acl.deny</literal> sections are |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
804 identical. On the left of each entry is a glob pattern that |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
805 matches files or directories, relative to the root of the |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
806 repository; on the right, a user name. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
807 </para> |
49 | 808 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
809 <para>In the following example, the user |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
810 <literal>docwriter</literal> can only push changes to the |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
811 <filename class="directory">docs</filename> subtree of the |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
812 repository, while <literal>intern</literal> can push changes |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
813 to any file or directory except <filename |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
814 class="directory">source/sensitive</filename>. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
815 </para> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
816 <programlisting>[acl.allow] docs/** = docwriter [acl.deny] |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
817 source/sensitive/** = intern</programlisting> |
49 | 818 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
819 </sect3> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
820 <sect3> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
821 <title>Testing and troubleshooting</title> |
49 | 822 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
823 <para>If you want to test the <literal |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
824 role="hg-ext">acl</literal> hook, run it with Mercurial's |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
825 debugging output enabled. Since you'll probably be running |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
826 it on a server where it's not convenient (or sometimes |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
827 possible) to pass in the <option |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
828 role="hg-opt-global">--debug</option> option, don't forget |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
829 that you can enable debugging output in your <filename |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
830 role="special"> /.hgrc</filename>: |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
831 </para> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
832 <programlisting>[ui] debug = true</programlisting> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
833 <para>With this enabled, the <literal |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
834 role="hg-ext">acl</literal> hook will print enough |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
835 information to let you figure out why it is allowing or |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
836 forbidding pushes from specific users. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
837 </para> |
62
8806b2875f10
Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
54
diff
changeset
|
838 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
839 </sect3> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
840 </sect2> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
841 <sect2> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
842 <title><literal |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
843 role="hg-ext">bugzilla</literal>&emdash;integration with |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
844 Bugzilla</title> |
62
8806b2875f10
Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
54
diff
changeset
|
845 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
846 <para>The <literal role="hg-ext">bugzilla</literal> extension |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
847 adds a comment to a Bugzilla bug whenever it finds a reference |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
848 to that bug ID in a commit comment. You can install this hook |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
849 on a shared server, so that any time a remote user pushes |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
850 changes to this server, the hook gets run. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
851 </para> |
62
8806b2875f10
Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
54
diff
changeset
|
852 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
853 <para>It adds a comment to the bug that looks like this (you can |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
854 configure the contents of the comment&emdash;see below): |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
855 </para> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
856 <programlisting>Changeset aad8b264143a, made by Joe User |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
857 <joe.user@domain.com> in the frobnitz repository, refers |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
858 to this bug. For complete details, see |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
859 http://hg.domain.com/frobnitz?cmd=changeset;node=aad8b264143a |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
860 Changeset description: Fix bug 10483 by guarding against some |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
861 NULL pointers</programlisting> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
862 <para>The value of this hook is that it automates the process of |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
863 updating a bug any time a changeset refers to it. If you |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
864 configure the hook properly, it makes it easy for people to |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
865 browse straight from a Bugzilla bug to a changeset that refers |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
866 to that bug. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
867 </para> |
62
8806b2875f10
Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
54
diff
changeset
|
868 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
869 <para>You can use the code in this hook as a starting point for |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
870 some more exotic Bugzilla integration recipes. Here are a few |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
871 possibilities: |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
872 </para> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
873 <itemizedlist> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
874 <listitem><para>Require that every changeset pushed to the |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
875 server have a valid bug ID in its commit comment. In this |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
876 case, you'd want to configure the hook as a <literal |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
877 role="hook">pretxncommit</literal> hook. This would |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
878 allow the hook to reject changes that didn't contain bug |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
879 IDs. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
880 </para> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
881 </listitem> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
882 <listitem><para>Allow incoming changesets to automatically |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
883 modify the <emphasis>state</emphasis> of a bug, as well as |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
884 simply adding a comment. For example, the hook could |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
885 recognise the string <quote>fixed bug 31337</quote> as |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
886 indicating that it should update the state of bug 31337 to |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
887 <quote>requires testing</quote>. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
888 </para> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
889 </listitem></itemizedlist> |
62
8806b2875f10
Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
54
diff
changeset
|
890 |
724
cfdb601a3c8b
Fix imagedata fileref in xml files, and replace ':' with '.' in id attribute
Dongsheng Song <dongsheng.song@gmail.com>
parents:
671
diff
changeset
|
891 <sect3 id="sec.hook.bugzilla.config"> |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
892 <title>Configuring the <literal role="hook">bugzilla</literal> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
893 hook</title> |
62
8806b2875f10
Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
54
diff
changeset
|
894 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
895 <para>You should configure this hook in your server's |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
896 <filename role="special"> /.hgrc</filename>\ as an <literal |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
897 role="hook">incoming</literal> hook, for example as |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
898 follows: |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
899 </para> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
900 <programlisting>[hooks] incoming.bugzilla = |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
901 python:hgext.bugzilla.hook</programlisting> |
62
8806b2875f10
Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
54
diff
changeset
|
902 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
903 <para>Because of the specialised nature of this hook, and |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
904 because Bugzilla was not written with this kind of |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
905 integration in mind, configuring this hook is a somewhat |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
906 involved process. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
907 </para> |
62
8806b2875f10
Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
54
diff
changeset
|
908 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
909 <para>Before you begin, you must install the MySQL bindings |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
910 for Python on the host(s) where you'll be running the hook. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
911 If this is not available as a binary package for your |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
912 system, you can download it from |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
913 <citation>web:mysql-python</citation>. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
914 </para> |
62
8806b2875f10
Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
54
diff
changeset
|
915 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
916 <para>Configuration information for this hook lives in the |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
917 <literal role="rc-bugzilla">bugzilla</literal> section of |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
918 your <filename role="special"> /.hgrc</filename>. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
919 </para> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
920 <itemizedlist> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
921 <listitem><para><envar |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
922 role="rc-item-bugzilla">version</envar>: The version |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
923 of Bugzilla installed on the server. The database |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
924 schema that Bugzilla uses changes occasionally, so this |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
925 hook has to know exactly which schema to use. At the |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
926 moment, the only version supported is |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
927 <literal>2.16</literal>. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
928 </para> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
929 </listitem> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
930 <listitem><para><envar role="rc-item-bugzilla">host</envar>: |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
931 The hostname of the MySQL server that stores your |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
932 Bugzilla data. The database must be configured to allow |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
933 connections from whatever host you are running the |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
934 <literal role="hook">bugzilla</literal> hook on. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
935 </para> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
936 </listitem> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
937 <listitem><para><envar role="rc-item-bugzilla">user</envar>: |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
938 The username with which to connect to the MySQL server. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
939 The database must be configured to allow this user to |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
940 connect from whatever host you are running the <literal |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
941 role="hook">bugzilla</literal> hook on. This user |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
942 must be able to access and modify Bugzilla tables. The |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
943 default value of this item is <literal>bugs</literal>, |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
944 which is the standard name of the Bugzilla user in a |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
945 MySQL database. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
946 </para> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
947 </listitem> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
948 <listitem><para><envar |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
949 role="rc-item-bugzilla">password</envar>: The MySQL |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
950 password for the user you configured above. This is |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
951 stored as plain text, so you should make sure that |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
952 unauthorised users cannot read the <filename |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
953 role="special"> /.hgrc</filename>\ file where you |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
954 store this information. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
955 </para> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
956 </listitem> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
957 <listitem><para><envar role="rc-item-bugzilla">db</envar>: |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
958 The name of the Bugzilla database on the MySQL server. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
959 The default value of this item is |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
960 <literal>bugs</literal>, which is the standard name of |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
961 the MySQL database where Bugzilla stores its data. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
962 </para> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
963 </listitem> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
964 <listitem><para><envar |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
965 role="rc-item-bugzilla">notify</envar>: If you want |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
966 Bugzilla to send out a notification email to subscribers |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
967 after this hook has added a comment to a bug, you will |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
968 need this hook to run a command whenever it updates the |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
969 database. The command to run depends on where you have |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
970 installed Bugzilla, but it will typically look something |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
971 like this, if you have Bugzilla installed in <filename |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
972 class="directory">/var/www/html/bugzilla</filename>: |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
973 </para> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
974 <programlisting>cd /var/www/html/bugzilla && |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
975 ./processmail %s nobody@nowhere.com</programlisting> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
976 </listitem> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
977 <listitem><para> The Bugzilla |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
978 <literal>processmail</literal> program expects to be |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
979 given a bug ID (the hook replaces |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
980 <quote><literal>%s</literal></quote> with the bug ID) |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
981 and an email address. It also expects to be able to |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
982 write to some files in the directory that it runs in. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
983 If Bugzilla and this hook are not installed on the same |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
984 machine, you will need to find a way to run |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
985 <literal>processmail</literal> on the server where |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
986 Bugzilla is installed. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
987 </para> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
988 </listitem></itemizedlist> |
62
8806b2875f10
Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
54
diff
changeset
|
989 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
990 </sect3> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
991 <sect3> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
992 <title>Mapping committer names to Bugzilla user names</title> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
993 |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
994 <para>By default, the <literal |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
995 role="hg-ext">bugzilla</literal> hook tries to use the |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
996 email address of a changeset's committer as the Bugzilla |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
997 user name with which to update a bug. If this does not suit |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
998 your needs, you can map committer email addresses to |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
999 Bugzilla user names using a <literal |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1000 role="rc-usermap">usermap</literal> section. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1001 </para> |
62
8806b2875f10
Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
54
diff
changeset
|
1002 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1003 <para>Each item in the <literal |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1004 role="rc-usermap">usermap</literal> section contains an |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1005 email address on the left, and a Bugzilla user name on the |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1006 right. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1007 </para> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1008 <programlisting>[usermap] jane.user@example.com = |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1009 jane</programlisting> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1010 <para>You can either keep the <literal |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1011 role="rc-usermap">usermap</literal> data in a normal |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1012 <filename role="special">~/.hgrc</filename>, or tell the |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1013 <literal role="hg-ext">bugzilla</literal> hook to read the |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1014 information from an external <filename>usermap</filename> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1015 file. In the latter case, you can store |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1016 <filename>usermap</filename> data by itself in (for example) |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1017 a user-modifiable repository. This makes it possible to let |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1018 your users maintain their own <envar |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1019 role="rc-item-bugzilla">usermap</envar> entries. The main |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1020 <filename role="special"> /.hgrc</filename>\ file might look |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1021 like this: |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1022 </para> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1023 <programlisting># regular hgrc file refers to external usermap |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1024 file [bugzilla] usermap = |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1025 /home/hg/repos/userdata/bugzilla-usermap.conf</programlisting> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1026 <para>While the <filename>usermap</filename> file that it |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1027 refers to might look like this: |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1028 </para> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1029 <programlisting># bugzilla-usermap.conf - inside a hg |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1030 repository [usermap] stephanie@example.com = |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1031 steph</programlisting> |
62
8806b2875f10
Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
54
diff
changeset
|
1032 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1033 </sect3> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1034 <sect3> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1035 <title>Configuring the text that gets added to a bug</title> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1036 |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1037 <para>You can configure the text that this hook adds as a |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1038 comment; you specify it in the form of a Mercurial template. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1039 Several <filename role="special"> /.hgrc</filename>\ entries |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1040 (still in the <literal role="rc-bugzilla">bugzilla</literal> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1041 section) control this behaviour. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1042 </para> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1043 <itemizedlist> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1044 <listitem><para><literal>strip</literal>: The number of |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1045 leading path elements to strip from a repository's path |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1046 name to construct a partial path for a URL. For example, |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1047 if the repositories on your server live under <filename |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1048 class="directory">/home/hg/repos</filename>, and you |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1049 have a repository whose path is <filename |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1050 class="directory">/home/hg/repos/app/tests</filename>, |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1051 then setting <literal>strip</literal> to |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1052 <literal>4</literal> will give a partial path of |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1053 <filename class="directory">app/tests</filename>. The |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1054 hook will make this partial path available when |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1055 expanding a template, as <literal>webroot</literal>. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1056 </para> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1057 </listitem> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1058 <listitem><para><literal>template</literal>: The text of the |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1059 template to use. In addition to the usual |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1060 changeset-related variables, this template can use |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1061 <literal>hgweb</literal> (the value of the |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1062 <literal>hgweb</literal> configuration item above) and |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1063 <literal>webroot</literal> (the path constructed using |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1064 <literal>strip</literal> above). |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1065 </para> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1066 </listitem></itemizedlist> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1067 |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1068 <para>In addition, you can add a <envar |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1069 role="rc-item-web">baseurl</envar> item to the <literal |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1070 role="rc-web">web</literal> section of your <filename |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1071 role="special"> /.hgrc</filename>. The <literal |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1072 role="hg-ext">bugzilla</literal> hook will make this |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1073 available when expanding a template, as the base string to |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1074 use when constructing a URL that will let users browse from |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1075 a Bugzilla comment to view a changeset. Example: |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1076 </para> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1077 <programlisting>[web] baseurl = |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1078 http://hg.domain.com/</programlisting> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1079 |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1080 <para>Here is an example set of <literal |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1081 role="hg-ext">bugzilla</literal> hook config information. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1082 </para> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1083 <programlisting>[bugzilla] host = bugzilla.example.com |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1084 password = mypassword version = 2.16 # server-side repos |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1085 live in /home/hg/repos, so strip 4 leading # separators |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1086 strip = 4 hgweb = http://hg.example.com/ usermap = |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1087 /home/hg/repos/notify/bugzilla.conf template = Changeset |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1088 {node|short}, made by {author} in the {webroot} repo, refers |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1089 to this bug.\\nFor complete details, see |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1090 {hgweb}{webroot}?cmd=changeset;node={node|short}\\nChangeset |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1091 description:\\n\\t{desc|tabindent}</programlisting> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1092 |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1093 </sect3> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1094 <sect3> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1095 <title>Testing and troubleshooting</title> |
62
8806b2875f10
Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
54
diff
changeset
|
1096 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1097 <para>The most common problems with configuring the <literal |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1098 role="hg-ext">bugzilla</literal> hook relate to running |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1099 Bugzilla's <filename>processmail</filename> script and |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1100 mapping committer names to user names. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1101 </para> |
62
8806b2875f10
Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
54
diff
changeset
|
1102 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1103 <para>Recall from section <xref |
724
cfdb601a3c8b
Fix imagedata fileref in xml files, and replace ':' with '.' in id attribute
Dongsheng Song <dongsheng.song@gmail.com>
parents:
671
diff
changeset
|
1104 linkend="sec.hook.bugzilla.config"/> above that the user |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1105 that runs the Mercurial process on the server is also the |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1106 one that will run the <filename>processmail</filename> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1107 script. The <filename>processmail</filename> script |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1108 sometimes causes Bugzilla to write to files in its |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1109 configuration directory, and Bugzilla's configuration files |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1110 are usually owned by the user that your web server runs |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1111 under. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1112 </para> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1113 |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1114 <para>You can cause <filename>processmail</filename> to be run |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1115 with the suitable user's identity using the |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1116 <command>sudo</command> command. Here is an example entry |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1117 for a <filename>sudoers</filename> file. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1118 </para> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1119 <programlisting>hg_user = (httpd_user) NOPASSWD: |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1120 /var/www/html/bugzilla/processmail-wrapper |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1121 %s</programlisting> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1122 <para>This allows the <literal>hg_user</literal> user to run a |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1123 <filename>processmail-wrapper</filename> program under the |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1124 identity of <literal>httpd_user</literal>. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1125 </para> |
62
8806b2875f10
Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
54
diff
changeset
|
1126 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1127 <para>This indirection through a wrapper script is necessary, |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1128 because <filename>processmail</filename> expects to be run |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1129 with its current directory set to wherever you installed |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1130 Bugzilla; you can't specify that kind of constraint in a |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1131 <filename>sudoers</filename> file. The contents of the |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1132 wrapper script are simple: |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1133 </para> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1134 <programlisting>#!/bin/sh cd `dirname $0` && |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1135 ./processmail "$1" nobody@example.com</programlisting> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1136 <para>It doesn't seem to matter what email address you pass to |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1137 <filename>processmail</filename>. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1138 </para> |
49 | 1139 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1140 <para>If your <literal role="rc-usermap">usermap</literal> is |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1141 not set up correctly, users will see an error message from |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1142 the <literal role="hg-ext">bugzilla</literal> hook when they |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1143 push changes to the server. The error message will look |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1144 like this: |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1145 </para> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1146 <programlisting>cannot find bugzilla user id for |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1147 john.q.public@example.com</programlisting> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1148 <para>What this means is that the committer's address, |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1149 <literal>john.q.public@example.com</literal>, is not a valid |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1150 Bugzilla user name, nor does it have an entry in your |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1151 <literal role="rc-usermap">usermap</literal> that maps it to |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1152 a valid Bugzilla user name. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1153 </para> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1154 |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1155 </sect3> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1156 </sect2> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1157 <sect2> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1158 <title><literal role="hg-ext">notify</literal>&emdash;send email |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1159 notifications</title> |
62
8806b2875f10
Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
54
diff
changeset
|
1160 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1161 <para>Although Mercurial's built-in web server provides RSS |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1162 feeds of changes in every repository, many people prefer to |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1163 receive change notifications via email. The <literal |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1164 role="hg-ext">notify</literal> hook lets you send out |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1165 notifications to a set of email addresses whenever changesets |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1166 arrive that those subscribers are interested in. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1167 </para> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1168 |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1169 <para>As with the <literal role="hg-ext">bugzilla</literal> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1170 hook, the <literal role="hg-ext">notify</literal> hook is |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1171 template-driven, so you can customise the contents of the |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1172 notification messages that it sends. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1173 </para> |
62
8806b2875f10
Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
54
diff
changeset
|
1174 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1175 <para>By default, the <literal role="hg-ext">notify</literal> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1176 hook includes a diff of every changeset that it sends out; you |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1177 can limit the size of the diff, or turn this feature off |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1178 entirely. It is useful for letting subscribers review changes |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1179 immediately, rather than clicking to follow a URL. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1180 </para> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1181 |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1182 <sect3> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1183 <title>Configuring the <literal role="hg-ext">notify</literal> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1184 hook</title> |
64
d12a199ed472
Update hook reference.
Bryan O'Sullivan <bos@serpentine.com>
parents:
63
diff
changeset
|
1185 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1186 <para>You can set up the <literal |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1187 role="hg-ext">notify</literal> hook to send one email |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1188 message per incoming changeset, or one per incoming group of |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1189 changesets (all those that arrived in a single pull or |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1190 push). |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1191 </para> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1192 <programlisting>[hooks] # send one email per group of changes |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1193 changegroup.notify = python:hgext.notify.hook # send one |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1194 email per change incoming.notify = |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1195 python:hgext.notify.hook</programlisting> |
62
8806b2875f10
Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
54
diff
changeset
|
1196 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1197 <para>Configuration information for this hook lives in the |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1198 <literal role="rc-notify">notify</literal> section of a |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1199 <filename role="special"> /.hgrc</filename>\ file. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1200 </para> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1201 <itemizedlist> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1202 <listitem><para><envar role="rc-item-notify">test</envar>: |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1203 By default, this hook does not send out email at all; |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1204 instead, it prints the message that it |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1205 <emphasis>would</emphasis> send. Set this item to |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1206 <literal>false</literal> to allow email to be sent. The |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1207 reason that sending of email is turned off by default is |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1208 that it takes several tries to configure this extension |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1209 exactly as you would like, and it would be bad form to |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1210 spam subscribers with a number of <quote>broken</quote> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1211 notifications while you debug your configuration. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1212 </para> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1213 </listitem> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1214 <listitem><para><envar role="rc-item-notify">config</envar>: |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1215 The path to a configuration file that contains |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1216 subscription information. This is kept separate from |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1217 the main <filename role="special"> /.hgrc</filename>\ so |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1218 that you can maintain it in a repository of its own. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1219 People can then clone that repository, update their |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1220 subscriptions, and push the changes back to your server. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1221 </para> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1222 </listitem> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1223 <listitem><para><envar role="rc-item-notify">strip</envar>: |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1224 The number of leading path separator characters to strip |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1225 from a repository's path, when deciding whether a |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1226 repository has subscribers. For example, if the |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1227 repositories on your server live in <filename |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1228 class="directory">/home/hg/repos</filename>, and |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1229 <literal role="hg-ext">notify</literal> is considering a |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1230 repository named <filename |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1231 class="directory">/home/hg/repos/shared/test</filename>, |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1232 setting <envar role="rc-item-notify">strip</envar> to |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1233 <literal>4</literal> will cause <literal |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1234 role="hg-ext">notify</literal> to trim the path it |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1235 considers down to <filename |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1236 class="directory">shared/test</filename>, and it will |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1237 match subscribers against that. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1238 </para> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1239 </listitem> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1240 <listitem><para><envar |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1241 role="rc-item-notify">template</envar>: The template |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1242 text to use when sending messages. This specifies both |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1243 the contents of the message header and its body. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1244 </para> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1245 </listitem> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1246 <listitem><para><envar |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1247 role="rc-item-notify">maxdiff</envar>: The maximum |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1248 number of lines of diff data to append to the end of a |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1249 message. If a diff is longer than this, it is |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1250 truncated. By default, this is set to 300. Set this to |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1251 <literal>0</literal> to omit diffs from notification |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1252 emails. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1253 </para> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1254 </listitem> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1255 <listitem><para><envar |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1256 role="rc-item-notify">sources</envar>: A list of |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1257 sources of changesets to consider. This lets you limit |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1258 <literal role="hg-ext">notify</literal> to only sending |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1259 out email about changes that remote users pushed into |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1260 this repository via a server, for example. See section |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1261 <xref |
724
cfdb601a3c8b
Fix imagedata fileref in xml files, and replace ':' with '.' in id attribute
Dongsheng Song <dongsheng.song@gmail.com>
parents:
671
diff
changeset
|
1262 linkend="sec.hook.sources"/> for the sources you can |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1263 specify here. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1264 </para> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1265 </listitem></itemizedlist> |
62
8806b2875f10
Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
54
diff
changeset
|
1266 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1267 <para>If you set the <envar role="rc-item-web">baseurl</envar> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1268 item in the <literal role="rc-web">web</literal> section, |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1269 you can use it in a template; it will be available as |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1270 <literal>webroot</literal>. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1271 </para> |
62
8806b2875f10
Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
54
diff
changeset
|
1272 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1273 <para>Here is an example set of <literal |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1274 role="hg-ext">notify</literal> configuration information. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1275 </para> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1276 <programlisting> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1277 [notify] # really send email test = false # subscriber data |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1278 lives in the notify repo config = |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1279 /home/hg/repos/notify/notify.conf # repos live in |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1280 /home/hg/repos on server, so strip 4 "/" chars strip = 4 |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1281 template = X-Hg-Repo: {webroot} Subject: {webroot}: |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1282 {desc|firstline|strip} From: {author} changeset {node|short} |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1283 in {root} details: |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1284 {baseurl}{webroot}?cmd=changeset;node={node|short} |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1285 description: {desc|tabindent|strip} [web] baseurl = |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1286 http://hg.example.com/ |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1287 </programlisting> |
62
8806b2875f10
Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
54
diff
changeset
|
1288 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1289 <para>This will produce a message that looks like the |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1290 following: |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1291 </para> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1292 <programlisting> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1293 X-Hg-Repo: tests/slave Subject: tests/slave: Handle error |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1294 case when slave has no buffers Date: Wed, 2 Aug 2006 |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1295 15:25:46 -0700 (PDT) changeset 3cba9bfe74b5 in |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1296 /home/hg/repos/tests/slave details: |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1297 http://hg.example.com/tests/slave?cmd=changeset;node=3cba9bfe74b5 |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1298 description: Handle error case when slave has no buffers |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1299 diffs (54 lines): diff -r 9d95df7cf2ad -r 3cba9bfe74b5 |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1300 include/tests.h --- a/include/tests.h Wed Aug 02 |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1301 15:19:52 2006 -0700 +++ b/include/tests.h Wed Aug 02 |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1302 15:25:26 2006 -0700 @@ -212,6 +212,15 @@ static __inline__ |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1303 void test_headers(void *h) [...snip...] |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1304 </programlisting> |
62
8806b2875f10
Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
54
diff
changeset
|
1305 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1306 </sect3> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1307 <sect3> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1308 <title>Testing and troubleshooting</title> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1309 |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1310 <para>Do not forget that by default, the <literal |
660
21c62e09b99f
Typo and spelling corrections. Removed tex tags.
Ori Avtalion <ori@avtalion.name>
parents:
658
diff
changeset
|
1311 role="hg-ext">notify</literal> extension <emphasis>will not |
21c62e09b99f
Typo and spelling corrections. Removed tex tags.
Ori Avtalion <ori@avtalion.name>
parents:
658
diff
changeset
|
1312 send any mail</emphasis> until you explicitly configure it to do so, |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1313 by setting <envar role="rc-item-notify">test</envar> to |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1314 <literal>false</literal>. Until you do that, it simply |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1315 prints the message it <emphasis>would</emphasis> send. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1316 </para> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1317 |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1318 </sect3> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1319 </sect2> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1320 </sect1> |
724
cfdb601a3c8b
Fix imagedata fileref in xml files, and replace ':' with '.' in id attribute
Dongsheng Song <dongsheng.song@gmail.com>
parents:
671
diff
changeset
|
1321 <sect1 id="sec.hook.ref"> |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1322 <title>Information for writers of hooks</title> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1323 |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1324 <sect2> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1325 <title>In-process hook execution</title> |
62
8806b2875f10
Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
54
diff
changeset
|
1326 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1327 <para>An in-process hook is called with arguments of the |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1328 following form: |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1329 </para> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1330 <programlisting> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1331 def myhook(ui, repo, **kwargs): pass |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1332 </programlisting> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1333 <para>The <literal>ui</literal> parameter is a <literal |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1334 role="py-mod-mercurial.ui">ui</literal> object. The |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1335 <literal>repo</literal> parameter is a <literal |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1336 role="py-mod-mercurial.localrepo">localrepository</literal> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1337 object. The names and values of the |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1338 <literal>**kwargs</literal> parameters depend on the hook |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1339 being invoked, with the following common features: |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1340 </para> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1341 <itemizedlist> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1342 <listitem><para>If a parameter is named |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1343 <literal>node</literal> or <literal>parentN</literal>, it |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1344 will contain a hexadecimal changeset ID. The empty string |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1345 is used to represent <quote>null changeset ID</quote> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1346 instead of a string of zeroes. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1347 </para> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1348 </listitem> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1349 <listitem><para>If a parameter is named |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1350 <literal>url</literal>, it will contain the URL of a |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1351 remote repository, if that can be determined. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1352 </para> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1353 </listitem> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1354 <listitem><para>Boolean-valued parameters are represented as |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1355 Python <literal>bool</literal> objects. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1356 </para> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1357 </listitem></itemizedlist> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1358 |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1359 <para>An in-process hook is called without a change to the |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1360 process's working directory (unlike external hooks, which are |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1361 run in the root of the repository). It must not change the |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1362 process's working directory, or it will cause any calls it |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1363 makes into the Mercurial API to fail. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1364 </para> |
62
8806b2875f10
Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
54
diff
changeset
|
1365 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1366 <para>If a hook returns a boolean <quote>false</quote> value, it |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1367 is considered to have succeeded. If it returns a boolean |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1368 <quote>true</quote> value or raises an exception, it is |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1369 considered to have failed. A useful way to think of the |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1370 calling convention is <quote>tell me if you fail</quote>. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1371 </para> |
62
8806b2875f10
Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
54
diff
changeset
|
1372 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1373 <para>Note that changeset IDs are passed into Python hooks as |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1374 hexadecimal strings, not the binary hashes that Mercurial's |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1375 APIs normally use. To convert a hash from hex to binary, use |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1376 the \pymodfunc{mercurial.node}{bin} function. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1377 </para> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1378 |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1379 </sect2> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1380 <sect2> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1381 <title>External hook execution</title> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1382 |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1383 <para>An external hook is passed to the shell of the user |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1384 running Mercurial. Features of that shell, such as variable |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1385 substitution and command redirection, are available. The hook |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1386 is run in the root directory of the repository (unlike |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1387 in-process hooks, which are run in the same directory that |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1388 Mercurial was run in). |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1389 </para> |
285
814698eebbaf
fixed a typo and formatted the notify hook configuration example nicer.
Timo Paulssen <timonator@perpetuum-immobile.de>
parents:
247
diff
changeset
|
1390 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1391 <para>Hook parameters are passed to the hook as environment |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1392 variables. Each environment variable's name is converted in |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1393 upper case and prefixed with the string |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1394 <quote><literal>HG_</literal></quote>. For example, if the |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1395 name of a parameter is <quote><literal>node</literal></quote>, |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1396 the name of the environment variable representing that |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1397 parameter will be <quote><literal>HG_NODE</literal></quote>. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1398 </para> |
62
8806b2875f10
Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
54
diff
changeset
|
1399 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1400 <para>A boolean parameter is represented as the string |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1401 <quote><literal>1</literal></quote> for <quote>true</quote>, |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1402 <quote><literal>0</literal></quote> for <quote>false</quote>. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1403 If an environment variable is named <envar>HG_NODE</envar>, |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1404 <envar>HG_PARENT1</envar> or <envar>HG_PARENT2</envar>, it |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1405 contains a changeset ID represented as a hexadecimal string. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1406 The empty string is used to represent <quote>null changeset |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1407 ID</quote> instead of a string of zeroes. If an environment |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1408 variable is named <envar>HG_URL</envar>, it will contain the |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1409 URL of a remote repository, if that can be determined. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1410 </para> |
62
8806b2875f10
Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
54
diff
changeset
|
1411 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1412 <para>If a hook exits with a status of zero, it is considered to |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1413 have succeeded. If it exits with a non-zero status, it is |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1414 considered to have failed. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1415 </para> |
62
8806b2875f10
Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
54
diff
changeset
|
1416 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1417 </sect2> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1418 <sect2> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1419 <title>Finding out where changesets come from</title> |
62
8806b2875f10
Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
54
diff
changeset
|
1420 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1421 <para>A hook that involves the transfer of changesets between a |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1422 local repository and another may be able to find out |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1423 information about the <quote>far side</quote>. Mercurial |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1424 knows <emphasis>how</emphasis> changes are being transferred, |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1425 and in many cases <emphasis>where</emphasis> they are being |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1426 transferred to or from. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1427 </para> |
44
012df94a02fe
Start hook examples. First is for trailing whitespace.
Bryan O'Sullivan <bos@serpentine.com>
parents:
41
diff
changeset
|
1428 |
724
cfdb601a3c8b
Fix imagedata fileref in xml files, and replace ':' with '.' in id attribute
Dongsheng Song <dongsheng.song@gmail.com>
parents:
671
diff
changeset
|
1429 <sect3 id="sec.hook.sources"> |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1430 <title>Sources of changesets</title> |
39
576fef93bb49
Further content for hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
38
diff
changeset
|
1431 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1432 <para>Mercurial will tell a hook what means are, or were, used |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1433 to transfer changesets between repositories. This is |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1434 provided by Mercurial in a Python parameter named |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1435 <literal>source</literal>, or an environment variable named |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1436 <envar>HG_SOURCE</envar>. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1437 </para> |
39
576fef93bb49
Further content for hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
38
diff
changeset
|
1438 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1439 <itemizedlist> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1440 <listitem><para><literal>serve</literal>: Changesets are |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1441 transferred to or from a remote repository over http or |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1442 ssh. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1443 </para> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1444 </listitem> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1445 <listitem><para><literal>pull</literal>: Changesets are |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1446 being transferred via a pull from one repository into |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1447 another. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1448 </para> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1449 </listitem> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1450 <listitem><para><literal>push</literal>: Changesets are |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1451 being transferred via a push from one repository into |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1452 another. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1453 </para> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1454 </listitem> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1455 <listitem><para><literal>bundle</literal>: Changesets are |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1456 being transferred to or from a bundle. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1457 </para> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1458 </listitem></itemizedlist> |
39
576fef93bb49
Further content for hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
38
diff
changeset
|
1459 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1460 </sect3> |
724
cfdb601a3c8b
Fix imagedata fileref in xml files, and replace ':' with '.' in id attribute
Dongsheng Song <dongsheng.song@gmail.com>
parents:
671
diff
changeset
|
1461 <sect3 id="sec.hook.url"> |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1462 <title>Where changes are going&emdash;remote repository |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1463 URLs</title> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1464 |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1465 <para>When possible, Mercurial will tell a hook the location |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1466 of the <quote>far side</quote> of an activity that transfers |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1467 changeset data between repositories. This is provided by |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1468 Mercurial in a Python parameter named |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1469 <literal>url</literal>, or an environment variable named |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1470 <envar>HG_URL</envar>. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1471 </para> |
39
576fef93bb49
Further content for hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
38
diff
changeset
|
1472 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1473 <para>This information is not always known. If a hook is |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1474 invoked in a repository that is being served via http or |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1475 ssh, Mercurial cannot tell where the remote repository is, |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1476 but it may know where the client is connecting from. In |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1477 such cases, the URL will take one of the following forms: |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1478 </para> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1479 <itemizedlist> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1480 <listitem><para><literal>remote:ssh:1.2.3.4</literal>&emdash;remote |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1481 ssh client, at the IP address |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1482 <literal>1.2.3.4</literal>. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1483 </para> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1484 </listitem> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1485 <listitem><para><literal>remote:http:1.2.3.4</literal>&emdash;remote |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1486 http client, at the IP address |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1487 <literal>1.2.3.4</literal>. If the client is using SSL, |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1488 this will be of the form |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1489 <literal>remote:https:1.2.3.4</literal>. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1490 </para> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1491 </listitem> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1492 <listitem><para>Empty&emdash;no information could be |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1493 discovered about the remote client. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1494 </para> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1495 </listitem></itemizedlist> |
39
576fef93bb49
Further content for hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
38
diff
changeset
|
1496 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1497 </sect3> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1498 </sect2> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1499 </sect1> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1500 <sect1> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1501 <title>Hook reference</title> |
39
576fef93bb49
Further content for hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
38
diff
changeset
|
1502 |
724
cfdb601a3c8b
Fix imagedata fileref in xml files, and replace ':' with '.' in id attribute
Dongsheng Song <dongsheng.song@gmail.com>
parents:
671
diff
changeset
|
1503 <sect2 id="sec.hook.changegroup"> |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1504 <title><literal role="hook">changegroup</literal>&emdash;after |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1505 remote changesets added</title> |
39
576fef93bb49
Further content for hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
38
diff
changeset
|
1506 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1507 <para>This hook is run after a group of pre-existing changesets |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1508 has been added to the repository, for example via a <command |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1509 role="hg-cmd">hg pull</command> or <command role="hg-cmd">hg |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1510 unbundle</command>. This hook is run once per operation |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1511 that added one or more changesets. This is in contrast to the |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1512 <literal role="hook">incoming</literal> hook, which is run |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1513 once per changeset, regardless of whether the changesets |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1514 arrive in a group. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1515 </para> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1516 |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1517 <para>Some possible uses for this hook include kicking off an |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1518 automated build or test of the added changesets, updating a |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1519 bug database, or notifying subscribers that a repository |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1520 contains new changes. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1521 </para> |
39
576fef93bb49
Further content for hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
38
diff
changeset
|
1522 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1523 <para>Parameters to this hook: |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1524 </para> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1525 <itemizedlist> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1526 <listitem><para><literal>node</literal>: A changeset ID. The |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1527 changeset ID of the first changeset in the group that was |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1528 added. All changesets between this and |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1529 \index{tags!<literal>tip</literal>}<literal>tip</literal>, |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1530 inclusive, were added by a single <command |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1531 role="hg-cmd">hg pull</command>, <command |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1532 role="hg-cmd">hg push</command> or <command |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1533 role="hg-cmd">hg unbundle</command>. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1534 </para> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1535 </listitem> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1536 <listitem><para><literal>source</literal>: A string. The |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1537 source of these changes. See section <xref |
724
cfdb601a3c8b
Fix imagedata fileref in xml files, and replace ':' with '.' in id attribute
Dongsheng Song <dongsheng.song@gmail.com>
parents:
671
diff
changeset
|
1538 linkend="sec.hook.sources"/> for details. |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1539 </para> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1540 </listitem> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1541 <listitem><para><literal>url</literal>: A URL. The location |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1542 of the remote repository, if known. See section <xref |
724
cfdb601a3c8b
Fix imagedata fileref in xml files, and replace ':' with '.' in id attribute
Dongsheng Song <dongsheng.song@gmail.com>
parents:
671
diff
changeset
|
1543 linkend="sec.hook.url"/> for more |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1544 information. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1545 </para> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1546 </listitem></itemizedlist> |
62
8806b2875f10
Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
54
diff
changeset
|
1547 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1548 <para>See also: <literal role="hook">incoming</literal> (section |
724
cfdb601a3c8b
Fix imagedata fileref in xml files, and replace ':' with '.' in id attribute
Dongsheng Song <dongsheng.song@gmail.com>
parents:
671
diff
changeset
|
1549 <xref linkend="sec.hook.incoming"/>), <literal |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1550 role="hook">prechangegroup</literal> (section <xref |
724
cfdb601a3c8b
Fix imagedata fileref in xml files, and replace ':' with '.' in id attribute
Dongsheng Song <dongsheng.song@gmail.com>
parents:
671
diff
changeset
|
1551 linkend="sec.hook.prechangegroup"/>), <literal |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1552 role="hook">pretxnchangegroup</literal> (section <xref |
724
cfdb601a3c8b
Fix imagedata fileref in xml files, and replace ':' with '.' in id attribute
Dongsheng Song <dongsheng.song@gmail.com>
parents:
671
diff
changeset
|
1553 linkend="sec.hook.pretxnchangegroup"/>) |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1554 </para> |
62
8806b2875f10
Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
54
diff
changeset
|
1555 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1556 </sect2> |
724
cfdb601a3c8b
Fix imagedata fileref in xml files, and replace ':' with '.' in id attribute
Dongsheng Song <dongsheng.song@gmail.com>
parents:
671
diff
changeset
|
1557 <sect2 id="sec.hook.commit"> |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1558 <title><literal role="hook">commit</literal>&emdash;after a new |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1559 changeset is created</title> |
62
8806b2875f10
Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
54
diff
changeset
|
1560 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1561 <para>This hook is run after a new changeset has been created. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1562 </para> |
62
8806b2875f10
Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
54
diff
changeset
|
1563 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1564 <para>Parameters to this hook: |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1565 </para> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1566 <itemizedlist> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1567 <listitem><para><literal>node</literal>: A changeset ID. The |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1568 changeset ID of the newly committed changeset. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1569 </para> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1570 </listitem> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1571 <listitem><para><literal>parent1</literal>: A changeset ID. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1572 The changeset ID of the first parent of the newly |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1573 committed changeset. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1574 </para> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1575 </listitem> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1576 <listitem><para><literal>parent2</literal>: A changeset ID. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1577 The changeset ID of the second parent of the newly |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1578 committed changeset. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1579 </para> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1580 </listitem></itemizedlist> |
62
8806b2875f10
Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
54
diff
changeset
|
1581 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1582 <para>See also: <literal role="hook">precommit</literal> |
724
cfdb601a3c8b
Fix imagedata fileref in xml files, and replace ':' with '.' in id attribute
Dongsheng Song <dongsheng.song@gmail.com>
parents:
671
diff
changeset
|
1583 (section <xref linkend="sec.hook.precommit"/>), <literal |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1584 role="hook">pretxncommit</literal> (section <xref |
724
cfdb601a3c8b
Fix imagedata fileref in xml files, and replace ':' with '.' in id attribute
Dongsheng Song <dongsheng.song@gmail.com>
parents:
671
diff
changeset
|
1585 linkend="sec.hook.pretxncommit"/>) |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1586 </para> |
62
8806b2875f10
Finish off a big whack of content for the hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
54
diff
changeset
|
1587 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1588 </sect2> |
724
cfdb601a3c8b
Fix imagedata fileref in xml files, and replace ':' with '.' in id attribute
Dongsheng Song <dongsheng.song@gmail.com>
parents:
671
diff
changeset
|
1589 <sect2 id="sec.hook.incoming"> |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1590 <title><literal role="hook">incoming</literal>&emdash;after one |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1591 remote changeset is added</title> |
39
576fef93bb49
Further content for hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
38
diff
changeset
|
1592 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1593 <para>This hook is run after a pre-existing changeset has been |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1594 added to the repository, for example via a <command |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1595 role="hg-cmd">hg push</command>. If a group of changesets |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1596 was added in a single operation, this hook is called once for |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1597 each added changeset. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1598 </para> |
41 | 1599 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1600 <para>You can use this hook for the same purposes as the |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1601 <literal role="hook">changegroup</literal> hook (section <xref |
724
cfdb601a3c8b
Fix imagedata fileref in xml files, and replace ':' with '.' in id attribute
Dongsheng Song <dongsheng.song@gmail.com>
parents:
671
diff
changeset
|
1602 linkend="sec.hook.changegroup"/>); it's simply |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1603 more convenient sometimes to run a hook once per group of |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1604 changesets, while other times it's handier once per changeset. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1605 </para> |
40
b2fe9964b21b
More content for hook reference.
Bryan O'Sullivan <bos@serpentine.com>
parents:
39
diff
changeset
|
1606 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1607 <para>Parameters to this hook: |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1608 </para> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1609 <itemizedlist> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1610 <listitem><para><literal>node</literal>: A changeset ID. The |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1611 ID of the newly added changeset. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1612 </para> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1613 </listitem> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1614 <listitem><para><literal>source</literal>: A string. The |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1615 source of these changes. See section <xref |
724
cfdb601a3c8b
Fix imagedata fileref in xml files, and replace ':' with '.' in id attribute
Dongsheng Song <dongsheng.song@gmail.com>
parents:
671
diff
changeset
|
1616 linkend="sec.hook.sources"/> for details. |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1617 </para> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1618 </listitem> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1619 <listitem><para><literal>url</literal>: A URL. The location |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1620 of the remote repository, if known. See section <xref |
724
cfdb601a3c8b
Fix imagedata fileref in xml files, and replace ':' with '.' in id attribute
Dongsheng Song <dongsheng.song@gmail.com>
parents:
671
diff
changeset
|
1621 linkend="sec.hook.url"/> for more |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1622 information. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1623 </para> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1624 </listitem></itemizedlist> |
39
576fef93bb49
Further content for hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
38
diff
changeset
|
1625 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1626 <para>See also: <literal role="hook">changegroup</literal> |
724
cfdb601a3c8b
Fix imagedata fileref in xml files, and replace ':' with '.' in id attribute
Dongsheng Song <dongsheng.song@gmail.com>
parents:
671
diff
changeset
|
1627 (section <xref linkend="sec.hook.changegroup"/>) <literal |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1628 role="hook">prechangegroup</literal> (section <xref |
724
cfdb601a3c8b
Fix imagedata fileref in xml files, and replace ':' with '.' in id attribute
Dongsheng Song <dongsheng.song@gmail.com>
parents:
671
diff
changeset
|
1629 linkend="sec.hook.prechangegroup"/>), <literal |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1630 role="hook">pretxnchangegroup</literal> (section <xref |
724
cfdb601a3c8b
Fix imagedata fileref in xml files, and replace ':' with '.' in id attribute
Dongsheng Song <dongsheng.song@gmail.com>
parents:
671
diff
changeset
|
1631 linkend="sec.hook.pretxnchangegroup"/>) |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1632 </para> |
40
b2fe9964b21b
More content for hook reference.
Bryan O'Sullivan <bos@serpentine.com>
parents:
39
diff
changeset
|
1633 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1634 </sect2> |
724
cfdb601a3c8b
Fix imagedata fileref in xml files, and replace ':' with '.' in id attribute
Dongsheng Song <dongsheng.song@gmail.com>
parents:
671
diff
changeset
|
1635 <sect2 id="sec.hook.outgoing"> |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1636 <title><literal role="hook">outgoing</literal>&emdash;after |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1637 changesets are propagated</title> |
40
b2fe9964b21b
More content for hook reference.
Bryan O'Sullivan <bos@serpentine.com>
parents:
39
diff
changeset
|
1638 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1639 <para>This hook is run after a group of changesets has been |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1640 propagated out of this repository, for example by a <command |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1641 role="hg-cmd">hg push</command> or <command role="hg-cmd">hg |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1642 bundle</command> command. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1643 </para> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1644 |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1645 <para>One possible use for this hook is to notify administrators |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1646 that changes have been pulled. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1647 </para> |
40
b2fe9964b21b
More content for hook reference.
Bryan O'Sullivan <bos@serpentine.com>
parents:
39
diff
changeset
|
1648 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1649 <para>Parameters to this hook: |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1650 </para> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1651 <itemizedlist> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1652 <listitem><para><literal>node</literal>: A changeset ID. The |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1653 changeset ID of the first changeset of the group that was |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1654 sent. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1655 </para> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1656 </listitem> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1657 <listitem><para><literal>source</literal>: A string. The |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1658 source of the of the operation (see section <xref |
724
cfdb601a3c8b
Fix imagedata fileref in xml files, and replace ':' with '.' in id attribute
Dongsheng Song <dongsheng.song@gmail.com>
parents:
671
diff
changeset
|
1659 linkend="sec.hook.sources"/>). If a remote |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1660 client pulled changes from this repository, |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1661 <literal>source</literal> will be |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1662 <literal>serve</literal>. If the client that obtained |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1663 changes from this repository was local, |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1664 <literal>source</literal> will be |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1665 <literal>bundle</literal>, <literal>pull</literal>, or |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1666 <literal>push</literal>, depending on the operation the |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1667 client performed. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1668 </para> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1669 </listitem> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1670 <listitem><para><literal>url</literal>: A URL. The location |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1671 of the remote repository, if known. See section <xref |
724
cfdb601a3c8b
Fix imagedata fileref in xml files, and replace ':' with '.' in id attribute
Dongsheng Song <dongsheng.song@gmail.com>
parents:
671
diff
changeset
|
1672 linkend="sec.hook.url"/> for more |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1673 information. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1674 </para> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1675 </listitem></itemizedlist> |
40
b2fe9964b21b
More content for hook reference.
Bryan O'Sullivan <bos@serpentine.com>
parents:
39
diff
changeset
|
1676 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1677 <para>See also: <literal role="hook">preoutgoing</literal> |
724
cfdb601a3c8b
Fix imagedata fileref in xml files, and replace ':' with '.' in id attribute
Dongsheng Song <dongsheng.song@gmail.com>
parents:
671
diff
changeset
|
1678 (section <xref linkend="sec.hook.preoutgoing"/>) |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1679 </para> |
40
b2fe9964b21b
More content for hook reference.
Bryan O'Sullivan <bos@serpentine.com>
parents:
39
diff
changeset
|
1680 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1681 </sect2> |
724
cfdb601a3c8b
Fix imagedata fileref in xml files, and replace ':' with '.' in id attribute
Dongsheng Song <dongsheng.song@gmail.com>
parents:
671
diff
changeset
|
1682 <sect2 id="sec.hook.prechangegroup"> |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1683 <title><literal |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1684 role="hook">prechangegroup</literal>&emdash;before starting |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1685 to add remote changesets</title> |
41 | 1686 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1687 <para>This controlling hook is run before Mercurial begins to |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1688 add a group of changesets from another repository. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1689 </para> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1690 |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1691 <para>This hook does not have any information about the |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1692 changesets to be added, because it is run before transmission |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1693 of those changesets is allowed to begin. If this hook fails, |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1694 the changesets will not be transmitted. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1695 </para> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1696 |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1697 <para>One use for this hook is to prevent external changes from |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1698 being added to a repository. For example, you could use this |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1699 to <quote>freeze</quote> a server-hosted branch temporarily or |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1700 permanently so that users cannot push to it, while still |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1701 allowing a local administrator to modify the repository. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1702 </para> |
40
b2fe9964b21b
More content for hook reference.
Bryan O'Sullivan <bos@serpentine.com>
parents:
39
diff
changeset
|
1703 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1704 <para>Parameters to this hook: |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1705 </para> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1706 <itemizedlist> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1707 <listitem><para><literal>source</literal>: A string. The |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1708 source of these changes. See section <xref |
724
cfdb601a3c8b
Fix imagedata fileref in xml files, and replace ':' with '.' in id attribute
Dongsheng Song <dongsheng.song@gmail.com>
parents:
671
diff
changeset
|
1709 linkend="sec.hook.sources"/> for details. |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1710 </para> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1711 </listitem> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1712 <listitem><para><literal>url</literal>: A URL. The location |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1713 of the remote repository, if known. See section <xref |
724
cfdb601a3c8b
Fix imagedata fileref in xml files, and replace ':' with '.' in id attribute
Dongsheng Song <dongsheng.song@gmail.com>
parents:
671
diff
changeset
|
1714 linkend="sec.hook.url"/> for more |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1715 information. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1716 </para> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1717 </listitem></itemizedlist> |
40
b2fe9964b21b
More content for hook reference.
Bryan O'Sullivan <bos@serpentine.com>
parents:
39
diff
changeset
|
1718 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1719 <para>See also: <literal role="hook">changegroup</literal> |
724
cfdb601a3c8b
Fix imagedata fileref in xml files, and replace ':' with '.' in id attribute
Dongsheng Song <dongsheng.song@gmail.com>
parents:
671
diff
changeset
|
1720 (section <xref linkend="sec.hook.changegroup"/>), <literal |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1721 role="hook">incoming</literal> (section <xref |
724
cfdb601a3c8b
Fix imagedata fileref in xml files, and replace ':' with '.' in id attribute
Dongsheng Song <dongsheng.song@gmail.com>
parents:
671
diff
changeset
|
1722 linkend="sec.hook.incoming"/>), , <literal |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1723 role="hook">pretxnchangegroup</literal> (section <xref |
724
cfdb601a3c8b
Fix imagedata fileref in xml files, and replace ':' with '.' in id attribute
Dongsheng Song <dongsheng.song@gmail.com>
parents:
671
diff
changeset
|
1724 linkend="sec.hook.pretxnchangegroup"/>) |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1725 </para> |
41 | 1726 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1727 </sect2> |
724
cfdb601a3c8b
Fix imagedata fileref in xml files, and replace ':' with '.' in id attribute
Dongsheng Song <dongsheng.song@gmail.com>
parents:
671
diff
changeset
|
1728 <sect2 id="sec.hook.precommit"> |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1729 <title><literal role="hook">precommit</literal>&emdash;before |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1730 starting to commit a changeset</title> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1731 |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1732 <para>This hook is run before Mercurial begins to commit a new |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1733 changeset. It is run before Mercurial has any of the metadata |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1734 for the commit, such as the files to be committed, the commit |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1735 message, or the commit date. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1736 </para> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1737 |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1738 <para>One use for this hook is to disable the ability to commit |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1739 new changesets, while still allowing incoming changesets. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1740 Another is to run a build or test, and only allow the commit |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1741 to begin if the build or test succeeds. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1742 </para> |
40
b2fe9964b21b
More content for hook reference.
Bryan O'Sullivan <bos@serpentine.com>
parents:
39
diff
changeset
|
1743 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1744 <para>Parameters to this hook: |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1745 </para> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1746 <itemizedlist> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1747 <listitem><para><literal>parent1</literal>: A changeset ID. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1748 The changeset ID of the first parent of the working |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1749 directory. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1750 </para> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1751 </listitem> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1752 <listitem><para><literal>parent2</literal>: A changeset ID. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1753 The changeset ID of the second parent of the working |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1754 directory. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1755 </para> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1756 </listitem></itemizedlist> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1757 <para>If the commit proceeds, the parents of the working |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1758 directory will become the parents of the new changeset. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1759 </para> |
41 | 1760 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1761 <para>See also: <literal role="hook">commit</literal> (section |
724
cfdb601a3c8b
Fix imagedata fileref in xml files, and replace ':' with '.' in id attribute
Dongsheng Song <dongsheng.song@gmail.com>
parents:
671
diff
changeset
|
1762 <xref linkend="sec.hook.commit"/>), <literal |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1763 role="hook">pretxncommit</literal> (section <xref |
724
cfdb601a3c8b
Fix imagedata fileref in xml files, and replace ':' with '.' in id attribute
Dongsheng Song <dongsheng.song@gmail.com>
parents:
671
diff
changeset
|
1764 linkend="sec.hook.pretxncommit"/>) |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1765 </para> |
41 | 1766 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1767 </sect2> |
724
cfdb601a3c8b
Fix imagedata fileref in xml files, and replace ':' with '.' in id attribute
Dongsheng Song <dongsheng.song@gmail.com>
parents:
671
diff
changeset
|
1768 <sect2 id="sec.hook.preoutgoing"> |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1769 <title><literal role="hook">preoutgoing</literal>&emdash;before |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1770 starting to propagate changesets</title> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1771 |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1772 <para>This hook is invoked before Mercurial knows the identities |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1773 of the changesets to be transmitted. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1774 </para> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1775 |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1776 <para>One use for this hook is to prevent changes from being |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1777 transmitted to another repository. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1778 </para> |
40
b2fe9964b21b
More content for hook reference.
Bryan O'Sullivan <bos@serpentine.com>
parents:
39
diff
changeset
|
1779 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1780 <para>Parameters to this hook: |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1781 </para> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1782 <itemizedlist> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1783 <listitem><para><literal>source</literal>: A string. The |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1784 source of the operation that is attempting to obtain |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1785 changes from this repository (see section <xref |
724
cfdb601a3c8b
Fix imagedata fileref in xml files, and replace ':' with '.' in id attribute
Dongsheng Song <dongsheng.song@gmail.com>
parents:
671
diff
changeset
|
1786 linkend="sec.hook.sources"/>). See the documentation |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1787 for the <literal>source</literal> parameter to the |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1788 <literal role="hook">outgoing</literal> hook, in section |
724
cfdb601a3c8b
Fix imagedata fileref in xml files, and replace ':' with '.' in id attribute
Dongsheng Song <dongsheng.song@gmail.com>
parents:
671
diff
changeset
|
1789 <xref linkend="sec.hook.outgoing"/>, for possible values |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1790 of |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1791 this parameter. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1792 </para> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1793 </listitem> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1794 <listitem><para><literal>url</literal>: A URL. The location |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1795 of the remote repository, if known. See section <xref |
724
cfdb601a3c8b
Fix imagedata fileref in xml files, and replace ':' with '.' in id attribute
Dongsheng Song <dongsheng.song@gmail.com>
parents:
671
diff
changeset
|
1796 linkend="sec.hook.url"/> for more |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1797 information. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1798 </para> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1799 </listitem></itemizedlist> |
40
b2fe9964b21b
More content for hook reference.
Bryan O'Sullivan <bos@serpentine.com>
parents:
39
diff
changeset
|
1800 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1801 <para>See also: <literal role="hook">outgoing</literal> (section |
724
cfdb601a3c8b
Fix imagedata fileref in xml files, and replace ':' with '.' in id attribute
Dongsheng Song <dongsheng.song@gmail.com>
parents:
671
diff
changeset
|
1802 <xref linkend="sec.hook.outgoing"/>) |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1803 </para> |
40
b2fe9964b21b
More content for hook reference.
Bryan O'Sullivan <bos@serpentine.com>
parents:
39
diff
changeset
|
1804 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1805 </sect2> |
724
cfdb601a3c8b
Fix imagedata fileref in xml files, and replace ':' with '.' in id attribute
Dongsheng Song <dongsheng.song@gmail.com>
parents:
671
diff
changeset
|
1806 <sect2 id="sec.hook.pretag"> |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1807 <title><literal role="hook">pretag</literal>&emdash;before |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1808 tagging a changeset</title> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1809 |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1810 <para>This controlling hook is run before a tag is created. If |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1811 the hook succeeds, creation of the tag proceeds. If the hook |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1812 fails, the tag is not created. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1813 </para> |
40
b2fe9964b21b
More content for hook reference.
Bryan O'Sullivan <bos@serpentine.com>
parents:
39
diff
changeset
|
1814 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1815 <para>Parameters to this hook: |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1816 </para> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1817 <itemizedlist> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1818 <listitem><para><literal>local</literal>: A boolean. Whether |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1819 the tag is local to this repository instance (i.e. stored |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1820 in <filename role="special">.hg/localtags</filename>) or |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1821 managed by Mercurial (stored in <filename |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1822 role="special">.hgtags</filename>). |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1823 </para> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1824 </listitem> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1825 <listitem><para><literal>node</literal>: A changeset ID. The |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1826 ID of the changeset to be tagged. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1827 </para> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1828 </listitem> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1829 <listitem><para><literal>tag</literal>: A string. The name of |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1830 the tag to be created. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1831 </para> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1832 </listitem></itemizedlist> |
40
b2fe9964b21b
More content for hook reference.
Bryan O'Sullivan <bos@serpentine.com>
parents:
39
diff
changeset
|
1833 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1834 <para>If the tag to be created is revision-controlled, the |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1835 <literal role="hook">precommit</literal> and <literal |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1836 role="hook">pretxncommit</literal> hooks (sections <xref |
724
cfdb601a3c8b
Fix imagedata fileref in xml files, and replace ':' with '.' in id attribute
Dongsheng Song <dongsheng.song@gmail.com>
parents:
671
diff
changeset
|
1837 linkend="sec.hook.commit"/> and <xref |
cfdb601a3c8b
Fix imagedata fileref in xml files, and replace ':' with '.' in id attribute
Dongsheng Song <dongsheng.song@gmail.com>
parents:
671
diff
changeset
|
1838 linkend="sec.hook.pretxncommit"/>) will also be run. |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1839 </para> |
41 | 1840 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1841 <para>See also: <literal role="hook">tag</literal> (section |
724
cfdb601a3c8b
Fix imagedata fileref in xml files, and replace ':' with '.' in id attribute
Dongsheng Song <dongsheng.song@gmail.com>
parents:
671
diff
changeset
|
1842 <xref linkend="sec.hook.tag"/>) |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1843 </para> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1844 </sect2> |
724
cfdb601a3c8b
Fix imagedata fileref in xml files, and replace ':' with '.' in id attribute
Dongsheng Song <dongsheng.song@gmail.com>
parents:
671
diff
changeset
|
1845 <sect2 id="sec.hook.pretxnchangegroup"> |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1846 <title><literal |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1847 role="hook">pretxnchangegroup</literal>&emdash;before |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1848 completing addition of remote changesets</title> |
40
b2fe9964b21b
More content for hook reference.
Bryan O'Sullivan <bos@serpentine.com>
parents:
39
diff
changeset
|
1849 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1850 <para>This controlling hook is run before a |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1851 transaction&emdash;that manages the addition of a group of new |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1852 changesets from outside the repository&emdash;completes. If |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1853 the hook succeeds, the transaction completes, and all of the |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1854 changesets become permanent within this repository. If the |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1855 hook fails, the transaction is rolled back, and the data for |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1856 the changesets is erased. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1857 </para> |
40
b2fe9964b21b
More content for hook reference.
Bryan O'Sullivan <bos@serpentine.com>
parents:
39
diff
changeset
|
1858 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1859 <para>This hook can access the metadata associated with the |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1860 almost-added changesets, but it should not do anything |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1861 permanent with this data. It must also not modify the working |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1862 directory. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1863 </para> |
41 | 1864 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1865 <para>While this hook is running, if other Mercurial processes |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1866 access this repository, they will be able to see the |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1867 almost-added changesets as if they are permanent. This may |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1868 lead to race conditions if you do not take steps to avoid |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1869 them. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1870 </para> |
34
c0979ed1eabd
Get started on hook chapter.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
1871 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1872 <para>This hook can be used to automatically vet a group of |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1873 changesets. If the hook fails, all of the changesets are |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1874 <quote>rejected</quote> when the transaction rolls back. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1875 </para> |
40
b2fe9964b21b
More content for hook reference.
Bryan O'Sullivan <bos@serpentine.com>
parents:
39
diff
changeset
|
1876 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1877 <para>Parameters to this hook: |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1878 </para> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1879 <itemizedlist> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1880 <listitem><para><literal>node</literal>: A changeset ID. The |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1881 changeset ID of the first changeset in the group that was |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1882 added. All changesets between this and |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1883 \index{tags!<literal>tip</literal>}<literal>tip</literal>, |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1884 inclusive, were added by a single <command |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1885 role="hg-cmd">hg pull</command>, <command |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1886 role="hg-cmd">hg push</command> or <command |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1887 role="hg-cmd">hg unbundle</command>. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1888 </para> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1889 </listitem> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1890 <listitem><para><literal>source</literal>: A string. The |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1891 source of these changes. See section <xref |
724
cfdb601a3c8b
Fix imagedata fileref in xml files, and replace ':' with '.' in id attribute
Dongsheng Song <dongsheng.song@gmail.com>
parents:
671
diff
changeset
|
1892 linkend="sec.hook.sources"/> for details. |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1893 </para> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1894 </listitem> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1895 <listitem><para><literal>url</literal>: A URL. The location |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1896 of the remote repository, if known. See section <xref |
724
cfdb601a3c8b
Fix imagedata fileref in xml files, and replace ':' with '.' in id attribute
Dongsheng Song <dongsheng.song@gmail.com>
parents:
671
diff
changeset
|
1897 linkend="sec.hook.url"/> for more |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1898 information. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1899 </para> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1900 </listitem></itemizedlist> |
41 | 1901 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1902 <para>See also: <literal role="hook">changegroup</literal> |
724
cfdb601a3c8b
Fix imagedata fileref in xml files, and replace ':' with '.' in id attribute
Dongsheng Song <dongsheng.song@gmail.com>
parents:
671
diff
changeset
|
1903 (section <xref linkend="sec.hook.changegroup"/>), <literal |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1904 role="hook">incoming</literal> (section <xref |
724
cfdb601a3c8b
Fix imagedata fileref in xml files, and replace ':' with '.' in id attribute
Dongsheng Song <dongsheng.song@gmail.com>
parents:
671
diff
changeset
|
1905 linkend="sec.hook.incoming"/>), <literal |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1906 role="hook">prechangegroup</literal> (section <xref |
724
cfdb601a3c8b
Fix imagedata fileref in xml files, and replace ':' with '.' in id attribute
Dongsheng Song <dongsheng.song@gmail.com>
parents:
671
diff
changeset
|
1907 linkend="sec.hook.prechangegroup"/>) |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1908 </para> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1909 |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1910 </sect2> |
724
cfdb601a3c8b
Fix imagedata fileref in xml files, and replace ':' with '.' in id attribute
Dongsheng Song <dongsheng.song@gmail.com>
parents:
671
diff
changeset
|
1911 <sect2 id="sec.hook.pretxncommit"> |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1912 <title><literal role="hook">pretxncommit</literal>&emdash;before |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1913 completing commit of new changeset</title> |
41 | 1914 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1915 <para>This controlling hook is run before a |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1916 transaction&emdash;that manages a new commit&emdash;completes. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1917 If the hook succeeds, the transaction completes and the |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1918 changeset becomes permanent within this repository. If the |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1919 hook fails, the transaction is rolled back, and the commit |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1920 data is erased. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1921 </para> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1922 |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1923 <para>This hook can access the metadata associated with the |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1924 almost-new changeset, but it should not do anything permanent |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1925 with this data. It must also not modify the working |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1926 directory. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1927 </para> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1928 |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1929 <para>While this hook is running, if other Mercurial processes |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1930 access this repository, they will be able to see the |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1931 almost-new changeset as if it is permanent. This may lead to |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1932 race conditions if you do not take steps to avoid them. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1933 </para> |
40
b2fe9964b21b
More content for hook reference.
Bryan O'Sullivan <bos@serpentine.com>
parents:
39
diff
changeset
|
1934 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1935 <para>Parameters to this hook: |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1936 </para> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1937 <itemizedlist> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1938 <listitem><para><literal>node</literal>: A changeset ID. The |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1939 changeset ID of the newly committed changeset. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1940 </para> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1941 </listitem> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1942 <listitem><para><literal>parent1</literal>: A changeset ID. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1943 The changeset ID of the first parent of the newly |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1944 committed changeset. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1945 </para> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1946 </listitem> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1947 <listitem><para><literal>parent2</literal>: A changeset ID. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1948 The changeset ID of the second parent of the newly |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1949 committed changeset. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1950 </para> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1951 </listitem></itemizedlist> |
40
b2fe9964b21b
More content for hook reference.
Bryan O'Sullivan <bos@serpentine.com>
parents:
39
diff
changeset
|
1952 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1953 <para>See also: <literal role="hook">precommit</literal> |
724
cfdb601a3c8b
Fix imagedata fileref in xml files, and replace ':' with '.' in id attribute
Dongsheng Song <dongsheng.song@gmail.com>
parents:
671
diff
changeset
|
1954 (section <xref linkend="sec.hook.precommit"/>) |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1955 </para> |
41 | 1956 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1957 </sect2> |
724
cfdb601a3c8b
Fix imagedata fileref in xml files, and replace ':' with '.' in id attribute
Dongsheng Song <dongsheng.song@gmail.com>
parents:
671
diff
changeset
|
1958 <sect2 id="sec.hook.preupdate"> |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1959 <title><literal role="hook">preupdate</literal>&emdash;before |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1960 updating or merging working directory</title> |
41 | 1961 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1962 <para>This controlling hook is run before an update or merge of |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1963 the working directory begins. It is run only if Mercurial's |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1964 normal pre-update checks determine that the update or merge |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1965 can proceed. If the hook succeeds, the update or merge may |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1966 proceed; if it fails, the update or merge does not start. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1967 </para> |
41 | 1968 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1969 <para>Parameters to this hook: |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1970 </para> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1971 <itemizedlist> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1972 <listitem><para><literal>parent1</literal>: A changeset ID. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1973 The ID of the parent that the working directory is to be |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1974 updated to. If the working directory is being merged, it |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1975 will not change this parent. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1976 </para> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1977 </listitem> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1978 <listitem><para><literal>parent2</literal>: A changeset ID. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1979 Only set if the working directory is being merged. The ID |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1980 of the revision that the working directory is being merged |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1981 with. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1982 </para> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1983 </listitem></itemizedlist> |
40
b2fe9964b21b
More content for hook reference.
Bryan O'Sullivan <bos@serpentine.com>
parents:
39
diff
changeset
|
1984 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1985 <para>See also: <literal role="hook">update</literal> (section |
724
cfdb601a3c8b
Fix imagedata fileref in xml files, and replace ':' with '.' in id attribute
Dongsheng Song <dongsheng.song@gmail.com>
parents:
671
diff
changeset
|
1986 <xref linkend="sec.hook.update"/>) |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1987 </para> |
40
b2fe9964b21b
More content for hook reference.
Bryan O'Sullivan <bos@serpentine.com>
parents:
39
diff
changeset
|
1988 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1989 </sect2> |
724
cfdb601a3c8b
Fix imagedata fileref in xml files, and replace ':' with '.' in id attribute
Dongsheng Song <dongsheng.song@gmail.com>
parents:
671
diff
changeset
|
1990 <sect2 id="sec.hook.tag"> |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1991 <title><literal role="hook">tag</literal>&emdash;after tagging a |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1992 changeset</title> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1993 |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1994 <para>This hook is run after a tag has been created. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1995 </para> |
41 | 1996 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1997 <para>Parameters to this hook: |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1998 </para> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
1999 <itemizedlist> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
2000 <listitem><para><literal>local</literal>: A boolean. Whether |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
2001 the new tag is local to this repository instance (i.e. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
2002 stored in <filename |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
2003 role="special">.hg/localtags</filename>) or managed by |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
2004 Mercurial (stored in <filename |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
2005 role="special">.hgtags</filename>). |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
2006 </para> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
2007 </listitem> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
2008 <listitem><para><literal>node</literal>: A changeset ID. The |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
2009 ID of the changeset that was tagged. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
2010 </para> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
2011 </listitem> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
2012 <listitem><para><literal>tag</literal>: A string. The name of |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
2013 the tag that was created. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
2014 </para> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
2015 </listitem></itemizedlist> |
40
b2fe9964b21b
More content for hook reference.
Bryan O'Sullivan <bos@serpentine.com>
parents:
39
diff
changeset
|
2016 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
2017 <para>If the created tag is revision-controlled, the <literal |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
2018 role="hook">commit</literal> hook (section <xref |
724
cfdb601a3c8b
Fix imagedata fileref in xml files, and replace ':' with '.' in id attribute
Dongsheng Song <dongsheng.song@gmail.com>
parents:
671
diff
changeset
|
2019 linkend="sec.hook.commit"/>) is run before this hook. |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
2020 </para> |
41 | 2021 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
2022 <para>See also: <literal role="hook">pretag</literal> (section |
724
cfdb601a3c8b
Fix imagedata fileref in xml files, and replace ':' with '.' in id attribute
Dongsheng Song <dongsheng.song@gmail.com>
parents:
671
diff
changeset
|
2023 <xref linkend="sec.hook.pretag"/>) |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
2024 </para> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
2025 |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
2026 </sect2> |
724
cfdb601a3c8b
Fix imagedata fileref in xml files, and replace ':' with '.' in id attribute
Dongsheng Song <dongsheng.song@gmail.com>
parents:
671
diff
changeset
|
2027 <sect2 id="sec.hook.update"> |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
2028 <title><literal role="hook">update</literal>&emdash;after |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
2029 updating or merging working directory</title> |
40
b2fe9964b21b
More content for hook reference.
Bryan O'Sullivan <bos@serpentine.com>
parents:
39
diff
changeset
|
2030 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
2031 <para>This hook is run after an update or merge of the working |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
2032 directory completes. Since a merge can fail (if the external |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
2033 <command>hgmerge</command> command fails to resolve conflicts |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
2034 in a file), this hook communicates whether the update or merge |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
2035 completed cleanly. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
2036 </para> |
41 | 2037 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
2038 <itemizedlist> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
2039 <listitem><para><literal>error</literal>: A boolean. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
2040 Indicates whether the update or merge completed |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
2041 successfully. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
2042 </para> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
2043 </listitem> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
2044 <listitem><para><literal>parent1</literal>: A changeset ID. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
2045 The ID of the parent that the working directory was |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
2046 updated to. If the working directory was merged, it will |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
2047 not have changed this parent. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
2048 </para> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
2049 </listitem> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
2050 <listitem><para><literal>parent2</literal>: A changeset ID. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
2051 Only set if the working directory was merged. The ID of |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
2052 the revision that the working directory was merged with. |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
2053 </para> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
2054 </listitem></itemizedlist> |
40
b2fe9964b21b
More content for hook reference.
Bryan O'Sullivan <bos@serpentine.com>
parents:
39
diff
changeset
|
2055 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
2056 <para>See also: <literal role="hook">preupdate</literal> |
724
cfdb601a3c8b
Fix imagedata fileref in xml files, and replace ':' with '.' in id attribute
Dongsheng Song <dongsheng.song@gmail.com>
parents:
671
diff
changeset
|
2057 (section <xref linkend="sec.hook.preupdate"/>) |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
2058 </para> |
40
b2fe9964b21b
More content for hook reference.
Bryan O'Sullivan <bos@serpentine.com>
parents:
39
diff
changeset
|
2059 |
658
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
2060 </sect2> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
2061 </sect1> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
2062 </chapter> |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
2063 |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
2064 <!-- |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
2065 local variables: |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
2066 sgml-parent-document: ("00book.xml" "book" "chapter") |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
2067 end: |
b90b024729f1
WIP DocBook snapshot that all compiles. Mirabile dictu!
Bryan O'Sullivan <bos@serpentine.com>
parents:
649
diff
changeset
|
2068 --> |