5 # This software may be used and distributed according to the terms of the |
5 # This software may be used and distributed according to the terms of the |
6 # GNU General Public License version 2, incorporated herein by reference. |
6 # GNU General Public License version 2, incorporated herein by reference. |
7 |
7 |
8 '''hooks for integrating with the Bugzilla bug tracker |
8 '''hooks for integrating with the Bugzilla bug tracker |
9 |
9 |
10 This hook extension adds comments on bugs in Bugzilla when changesets that |
10 This hook extension adds comments on bugs in Bugzilla when changesets |
11 refer to bugs by Bugzilla ID are seen. The hook does not change bug status. |
11 that refer to bugs by Bugzilla ID are seen. The hook does not change |
12 |
12 bug status. |
13 The hook updates the Bugzilla database directly. Only Bugzilla installations |
13 |
14 using MySQL are supported. |
14 The hook updates the Bugzilla database directly. Only Bugzilla |
15 |
15 installations using MySQL are supported. |
16 The hook relies on a Bugzilla script to send bug change notification emails. |
16 |
17 That script changes between Bugzilla versions; the 'processmail' script used |
17 The hook relies on a Bugzilla script to send bug change notification |
18 prior to 2.18 is replaced in 2.18 and subsequent versions by |
18 emails. That script changes between Bugzilla versions; the |
19 'config/sendbugmail.pl'. Note that these will be run by Mercurial as the user |
19 'processmail' script used prior to 2.18 is replaced in 2.18 and |
20 pushing the change; you will need to ensure the Bugzilla install file |
20 subsequent versions by 'config/sendbugmail.pl'. Note that these will |
21 permissions are set appropriately. |
21 be run by Mercurial as the user pushing the change; you will need to |
22 |
22 ensure the Bugzilla install file permissions are set appropriately. |
23 The extension is configured through three different configuration sections. |
23 |
24 These keys are recognized in the [bugzilla] section: |
24 The extension is configured through three different configuration |
|
25 sections. These keys are recognized in the [bugzilla] section: |
25 |
26 |
26 host |
27 host |
27 Hostname of the MySQL server holding the Bugzilla database. |
28 Hostname of the MySQL server holding the Bugzilla database. |
28 |
29 |
29 db |
30 db |
37 |
38 |
38 timeout |
39 timeout |
39 Database connection timeout (seconds). Default 5. |
40 Database connection timeout (seconds). Default 5. |
40 |
41 |
41 version |
42 version |
42 Bugzilla version. Specify '3.0' for Bugzilla versions 3.0 and later, '2.18' |
43 Bugzilla version. Specify '3.0' for Bugzilla versions 3.0 and later, |
43 for Bugzilla versions from 2.18 and '2.16' for versions prior to 2.18. |
44 '2.18' for Bugzilla versions from 2.18 and '2.16' for versions prior |
|
45 to 2.18. |
44 |
46 |
45 bzuser |
47 bzuser |
46 Fallback Bugzilla user name to record comments with, if changeset committer |
48 Fallback Bugzilla user name to record comments with, if changeset |
47 cannot be found as a Bugzilla user. |
49 committer cannot be found as a Bugzilla user. |
48 |
50 |
49 bzdir |
51 bzdir |
50 Bugzilla install directory. Used by default notify. Default |
52 Bugzilla install directory. Used by default notify. Default |
51 '/var/www/html/bugzilla'. |
53 '/var/www/html/bugzilla'. |
52 |
54 |
53 notify |
55 notify |
54 The command to run to get Bugzilla to send bug change notification emails. |
56 The command to run to get Bugzilla to send bug change notification |
55 Substitutes from a map with 3 keys, 'bzdir', 'id' (bug id) and 'user' |
57 emails. Substitutes from a map with 3 keys, 'bzdir', 'id' (bug id) |
56 (committer bugzilla email). Default depends on version; from 2.18 it is "cd |
58 and 'user' (committer bugzilla email). Default depends on version; |
57 %(bzdir)s && perl -T contrib/sendbugmail.pl %(id)s %(user)s". |
59 from 2.18 it is "cd %(bzdir)s && perl -T contrib/sendbugmail.pl |
|
60 %(id)s %(user)s". |
58 |
61 |
59 regexp |
62 regexp |
60 Regular expression to match bug IDs in changeset commit message. Must |
63 Regular expression to match bug IDs in changeset commit message. |
61 contain one "()" group. The default expression matches 'Bug 1234', 'Bug no. |
64 Must contain one "()" group. The default expression matches 'Bug |
62 1234', 'Bug number 1234', 'Bugs 1234,5678', 'Bug 1234 and 5678' and |
65 1234', 'Bug no. 1234', 'Bug number 1234', 'Bugs 1234,5678', 'Bug |
63 variations thereof. Matching is case insensitive. |
66 1234 and 5678' and variations thereof. Matching is case insensitive. |
64 |
67 |
65 style |
68 style |
66 The style file to use when formatting comments. |
69 The style file to use when formatting comments. |
67 |
70 |
68 template |
71 template |
69 Template to use when formatting comments. Overrides style if specified. In |
72 Template to use when formatting comments. Overrides style if |
70 addition to the usual Mercurial keywords, the extension specifies:: |
73 specified. In addition to the usual Mercurial keywords, the |
|
74 extension specifies:: |
71 |
75 |
72 {bug} The Bugzilla bug ID. |
76 {bug} The Bugzilla bug ID. |
73 {root} The full pathname of the Mercurial repository. |
77 {root} The full pathname of the Mercurial repository. |
74 {webroot} Stripped pathname of the Mercurial repository. |
78 {webroot} Stripped pathname of the Mercurial repository. |
75 {hgweb} Base URL for browsing Mercurial repositories. |
79 {hgweb} Base URL for browsing Mercurial repositories. |
80 strip |
84 strip |
81 The number of slashes to strip from the front of {root} to produce |
85 The number of slashes to strip from the front of {root} to produce |
82 {webroot}. Default 0. |
86 {webroot}. Default 0. |
83 |
87 |
84 usermap |
88 usermap |
85 Path of file containing Mercurial committer ID to Bugzilla user ID mappings. |
89 Path of file containing Mercurial committer ID to Bugzilla user ID |
86 If specified, the file should contain one mapping per line, |
90 mappings. If specified, the file should contain one mapping per |
87 "committer"="Bugzilla user". See also the [usermap] section. |
91 line, "committer"="Bugzilla user". See also the [usermap] section. |
88 |
92 |
89 The [usermap] section is used to specify mappings of Mercurial committer ID to |
93 The [usermap] section is used to specify mappings of Mercurial |
90 Bugzilla user ID. See also [bugzilla].usermap. "committer"="Bugzilla user" |
94 committer ID to Bugzilla user ID. See also [bugzilla].usermap. |
|
95 "committer"="Bugzilla user" |
91 |
96 |
92 Finally, the [web] section supports one entry: |
97 Finally, the [web] section supports one entry: |
93 |
98 |
94 baseurl |
99 baseurl |
95 Base URL for browsing Mercurial repositories. Reference from templates as |
100 Base URL for browsing Mercurial repositories. Reference from |
96 {hgweb}. |
101 templates as {hgweb}. |
97 |
102 |
98 Activating the extension:: |
103 Activating the extension:: |
99 |
104 |
100 [extensions] |
105 [extensions] |
101 hgext.bugzilla = |
106 hgext.bugzilla = |
104 # run bugzilla hook on every change pulled or pushed in here |
109 # run bugzilla hook on every change pulled or pushed in here |
105 incoming.bugzilla = python:hgext.bugzilla.hook |
110 incoming.bugzilla = python:hgext.bugzilla.hook |
106 |
111 |
107 Example configuration: |
112 Example configuration: |
108 |
113 |
109 This example configuration is for a collection of Mercurial repositories in |
114 This example configuration is for a collection of Mercurial |
110 /var/local/hg/repos/ used with a local Bugzilla 3.2 installation in |
115 repositories in /var/local/hg/repos/ used with a local Bugzilla 3.2 |
111 /opt/bugzilla-3.2. :: |
116 installation in /opt/bugzilla-3.2. :: |
112 |
117 |
113 [bugzilla] |
118 [bugzilla] |
114 host=localhost |
119 host=localhost |
115 password=XYZZY |
120 password=XYZZY |
116 version=3.0 |
121 version=3.0 |