Show More
@@ -1,609 +1,610 | |||
|
1 | 1 | $ cat > $TESTTMP/filter.py <<EOF |
|
2 | > from __future__ import print_function | |
|
3 |
> import |
|
|
2 | > from __future__ import absolute_import, print_function | |
|
3 | > import re | |
|
4 | > import sys | |
|
4 | 5 | > print(re.sub("\n[ \t]", " ", sys.stdin.read()), end="") |
|
5 | 6 | > EOF |
|
6 | 7 | |
|
7 | 8 | $ cat <<EOF >> $HGRCPATH |
|
8 | 9 | > [extensions] |
|
9 | 10 | > notify= |
|
10 | 11 | > |
|
11 | 12 | > [hooks] |
|
12 | 13 | > incoming.notify = python:hgext.notify.hook |
|
13 | 14 | > |
|
14 | 15 | > [notify] |
|
15 | 16 | > sources = pull |
|
16 | 17 | > diffstat = False |
|
17 | 18 | > |
|
18 | 19 | > [usersubs] |
|
19 | 20 | > foo@bar = * |
|
20 | 21 | > |
|
21 | 22 | > [reposubs] |
|
22 | 23 | > * = baz |
|
23 | 24 | > EOF |
|
24 | 25 | $ hg help notify |
|
25 | 26 | notify extension - hooks for sending email push notifications |
|
26 | 27 | |
|
27 | 28 | This extension implements hooks to send email notifications when changesets |
|
28 | 29 | are sent from or received by the local repository. |
|
29 | 30 | |
|
30 | 31 | First, enable the extension as explained in 'hg help extensions', and register |
|
31 | 32 | the hook you want to run. "incoming" and "changegroup" hooks are run when |
|
32 | 33 | changesets are received, while "outgoing" hooks are for changesets sent to |
|
33 | 34 | another repository: |
|
34 | 35 | |
|
35 | 36 | [hooks] |
|
36 | 37 | # one email for each incoming changeset |
|
37 | 38 | incoming.notify = python:hgext.notify.hook |
|
38 | 39 | # one email for all incoming changesets |
|
39 | 40 | changegroup.notify = python:hgext.notify.hook |
|
40 | 41 | |
|
41 | 42 | # one email for all outgoing changesets |
|
42 | 43 | outgoing.notify = python:hgext.notify.hook |
|
43 | 44 | |
|
44 | 45 | This registers the hooks. To enable notification, subscribers must be assigned |
|
45 | 46 | to repositories. The "[usersubs]" section maps multiple repositories to a |
|
46 | 47 | given recipient. The "[reposubs]" section maps multiple recipients to a single |
|
47 | 48 | repository: |
|
48 | 49 | |
|
49 | 50 | [usersubs] |
|
50 | 51 | # key is subscriber email, value is a comma-separated list of repo patterns |
|
51 | 52 | user@host = pattern |
|
52 | 53 | |
|
53 | 54 | [reposubs] |
|
54 | 55 | # key is repo pattern, value is a comma-separated list of subscriber emails |
|
55 | 56 | pattern = user@host |
|
56 | 57 | |
|
57 | 58 | A "pattern" is a "glob" matching the absolute path to a repository, optionally |
|
58 | 59 | combined with a revset expression. A revset expression, if present, is |
|
59 | 60 | separated from the glob by a hash. Example: |
|
60 | 61 | |
|
61 | 62 | [reposubs] |
|
62 | 63 | */widgets#branch(release) = qa-team@example.com |
|
63 | 64 | |
|
64 | 65 | This sends to "qa-team@example.com" whenever a changeset on the "release" |
|
65 | 66 | branch triggers a notification in any repository ending in "widgets". |
|
66 | 67 | |
|
67 | 68 | In order to place them under direct user management, "[usersubs]" and |
|
68 | 69 | "[reposubs]" sections may be placed in a separate "hgrc" file and incorporated |
|
69 | 70 | by reference: |
|
70 | 71 | |
|
71 | 72 | [notify] |
|
72 | 73 | config = /path/to/subscriptionsfile |
|
73 | 74 | |
|
74 | 75 | Notifications will not be sent until the "notify.test" value is set to |
|
75 | 76 | "False"; see below. |
|
76 | 77 | |
|
77 | 78 | Notifications content can be tweaked with the following configuration entries: |
|
78 | 79 | |
|
79 | 80 | notify.test |
|
80 | 81 | If "True", print messages to stdout instead of sending them. Default: True. |
|
81 | 82 | |
|
82 | 83 | notify.sources |
|
83 | 84 | Space-separated list of change sources. Notifications are activated only |
|
84 | 85 | when a changeset's source is in this list. Sources may be: |
|
85 | 86 | |
|
86 | 87 | "serve" changesets received via http or ssh |
|
87 | 88 | "pull" changesets received via "hg pull" |
|
88 | 89 | "unbundle" changesets received via "hg unbundle" |
|
89 | 90 | "push" changesets sent or received via "hg push" |
|
90 | 91 | "bundle" changesets sent via "hg unbundle" |
|
91 | 92 | |
|
92 | 93 | Default: serve. |
|
93 | 94 | |
|
94 | 95 | notify.strip |
|
95 | 96 | Number of leading slashes to strip from url paths. By default, notifications |
|
96 | 97 | reference repositories with their absolute path. "notify.strip" lets you |
|
97 | 98 | turn them into relative paths. For example, "notify.strip=3" will change |
|
98 | 99 | "/long/path/repository" into "repository". Default: 0. |
|
99 | 100 | |
|
100 | 101 | notify.domain |
|
101 | 102 | Default email domain for sender or recipients with no explicit domain. |
|
102 | 103 | |
|
103 | 104 | notify.style |
|
104 | 105 | Style file to use when formatting emails. |
|
105 | 106 | |
|
106 | 107 | notify.template |
|
107 | 108 | Template to use when formatting emails. |
|
108 | 109 | |
|
109 | 110 | notify.incoming |
|
110 | 111 | Template to use when run as an incoming hook, overriding "notify.template". |
|
111 | 112 | |
|
112 | 113 | notify.outgoing |
|
113 | 114 | Template to use when run as an outgoing hook, overriding "notify.template". |
|
114 | 115 | |
|
115 | 116 | notify.changegroup |
|
116 | 117 | Template to use when running as a changegroup hook, overriding |
|
117 | 118 | "notify.template". |
|
118 | 119 | |
|
119 | 120 | notify.maxdiff |
|
120 | 121 | Maximum number of diff lines to include in notification email. Set to 0 to |
|
121 | 122 | disable the diff, or -1 to include all of it. Default: 300. |
|
122 | 123 | |
|
123 | 124 | notify.maxsubject |
|
124 | 125 | Maximum number of characters in email's subject line. Default: 67. |
|
125 | 126 | |
|
126 | 127 | notify.diffstat |
|
127 | 128 | Set to True to include a diffstat before diff content. Default: True. |
|
128 | 129 | |
|
129 | 130 | notify.merge |
|
130 | 131 | If True, send notifications for merge changesets. Default: True. |
|
131 | 132 | |
|
132 | 133 | notify.mbox |
|
133 | 134 | If set, append mails to this mbox file instead of sending. Default: None. |
|
134 | 135 | |
|
135 | 136 | notify.fromauthor |
|
136 | 137 | If set, use the committer of the first changeset in a changegroup for the |
|
137 | 138 | "From" field of the notification mail. If not set, take the user from the |
|
138 | 139 | pushing repo. Default: False. |
|
139 | 140 | |
|
140 | 141 | If set, the following entries will also be used to customize the |
|
141 | 142 | notifications: |
|
142 | 143 | |
|
143 | 144 | email.from |
|
144 | 145 | Email "From" address to use if none can be found in the generated email |
|
145 | 146 | content. |
|
146 | 147 | |
|
147 | 148 | web.baseurl |
|
148 | 149 | Root repository URL to combine with repository paths when making references. |
|
149 | 150 | See also "notify.strip". |
|
150 | 151 | |
|
151 | 152 | no commands defined |
|
152 | 153 | $ hg init a |
|
153 | 154 | $ echo a > a/a |
|
154 | 155 | |
|
155 | 156 | commit |
|
156 | 157 | |
|
157 | 158 | $ hg --cwd a commit -Ama -d '0 0' |
|
158 | 159 | adding a |
|
159 | 160 | |
|
160 | 161 | |
|
161 | 162 | clone |
|
162 | 163 | |
|
163 | 164 | $ hg --traceback clone a b |
|
164 | 165 | updating to branch default |
|
165 | 166 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
166 | 167 | $ echo a >> a/a |
|
167 | 168 | |
|
168 | 169 | commit |
|
169 | 170 | |
|
170 | 171 | $ hg --traceback --cwd a commit -Amb -d '1 0' |
|
171 | 172 | |
|
172 | 173 | on Mac OS X 10.5 the tmp path is very long so would get stripped in the subject line |
|
173 | 174 | |
|
174 | 175 | $ cat <<EOF >> $HGRCPATH |
|
175 | 176 | > [notify] |
|
176 | 177 | > maxsubject = 200 |
|
177 | 178 | > EOF |
|
178 | 179 | |
|
179 | 180 | the python call below wraps continuation lines, which appear on Mac OS X 10.5 because |
|
180 | 181 | of the very long subject line |
|
181 | 182 | pull (minimal config) |
|
182 | 183 | |
|
183 | 184 | $ hg --traceback --cwd b pull ../a | $PYTHON $TESTTMP/filter.py |
|
184 | 185 | pulling from ../a |
|
185 | 186 | searching for changes |
|
186 | 187 | adding changesets |
|
187 | 188 | adding manifests |
|
188 | 189 | adding file changes |
|
189 | 190 | added 1 changesets with 1 changes to 1 files |
|
190 | 191 | Content-Type: text/plain; charset="us-ascii" |
|
191 | 192 | MIME-Version: 1.0 |
|
192 | 193 | Content-Transfer-Encoding: 7bit |
|
193 | 194 | Date: * (glob) |
|
194 | 195 | Subject: changeset in $TESTTMP/b: b |
|
195 | 196 | From: test |
|
196 | 197 | X-Hg-Notification: changeset 0647d048b600 |
|
197 | 198 | Message-Id: <*> (glob) |
|
198 | 199 | To: baz, foo@bar |
|
199 | 200 | |
|
200 | 201 | changeset 0647d048b600 in $TESTTMP/b (glob) |
|
201 | 202 | details: $TESTTMP/b?cmd=changeset;node=0647d048b600 |
|
202 | 203 | description: b |
|
203 | 204 | |
|
204 | 205 | diffs (6 lines): |
|
205 | 206 | |
|
206 | 207 | diff -r cb9a9f314b8b -r 0647d048b600 a |
|
207 | 208 | --- a/a Thu Jan 01 00:00:00 1970 +0000 |
|
208 | 209 | +++ b/a Thu Jan 01 00:00:01 1970 +0000 |
|
209 | 210 | @@ -1,1 +1,2 @@ a |
|
210 | 211 | +a |
|
211 | 212 | (run 'hg update' to get a working copy) |
|
212 | 213 | |
|
213 | 214 | $ cat <<EOF >> $HGRCPATH |
|
214 | 215 | > [notify] |
|
215 | 216 | > config = `pwd`/.notify.conf |
|
216 | 217 | > domain = test.com |
|
217 | 218 | > strip = 42 |
|
218 | 219 | > template = Subject: {desc|firstline|strip}\nFrom: {author}\nX-Test: foo\n\nchangeset {node|short} in {webroot}\ndescription:\n\t{desc|tabindent|strip} |
|
219 | 220 | > |
|
220 | 221 | > [web] |
|
221 | 222 | > baseurl = http://test/ |
|
222 | 223 | > EOF |
|
223 | 224 | |
|
224 | 225 | fail for config file is missing |
|
225 | 226 | |
|
226 | 227 | $ hg --cwd b rollback |
|
227 | 228 | repository tip rolled back to revision 0 (undo pull) |
|
228 | 229 | $ hg --cwd b pull ../a 2>&1 | grep 'error.*\.notify\.conf' > /dev/null && echo pull failed |
|
229 | 230 | pull failed |
|
230 | 231 | $ touch ".notify.conf" |
|
231 | 232 | |
|
232 | 233 | pull |
|
233 | 234 | |
|
234 | 235 | $ hg --cwd b rollback |
|
235 | 236 | repository tip rolled back to revision 0 (undo pull) |
|
236 | 237 | $ hg --traceback --cwd b pull ../a | $PYTHON $TESTTMP/filter.py |
|
237 | 238 | pulling from ../a |
|
238 | 239 | searching for changes |
|
239 | 240 | adding changesets |
|
240 | 241 | adding manifests |
|
241 | 242 | adding file changes |
|
242 | 243 | added 1 changesets with 1 changes to 1 files |
|
243 | 244 | Content-Type: text/plain; charset="us-ascii" |
|
244 | 245 | MIME-Version: 1.0 |
|
245 | 246 | Content-Transfer-Encoding: 7bit |
|
246 | 247 | X-Test: foo |
|
247 | 248 | Date: * (glob) |
|
248 | 249 | Subject: b |
|
249 | 250 | From: test@test.com |
|
250 | 251 | X-Hg-Notification: changeset 0647d048b600 |
|
251 | 252 | Message-Id: <*> (glob) |
|
252 | 253 | To: baz@test.com, foo@bar |
|
253 | 254 | |
|
254 | 255 | changeset 0647d048b600 in b |
|
255 | 256 | description: b |
|
256 | 257 | diffs (6 lines): |
|
257 | 258 | |
|
258 | 259 | diff -r cb9a9f314b8b -r 0647d048b600 a |
|
259 | 260 | --- a/a Thu Jan 01 00:00:00 1970 +0000 |
|
260 | 261 | +++ b/a Thu Jan 01 00:00:01 1970 +0000 |
|
261 | 262 | @@ -1,1 +1,2 @@ a |
|
262 | 263 | +a |
|
263 | 264 | (run 'hg update' to get a working copy) |
|
264 | 265 | |
|
265 | 266 | $ cat << EOF >> $HGRCPATH |
|
266 | 267 | > [hooks] |
|
267 | 268 | > incoming.notify = python:hgext.notify.hook |
|
268 | 269 | > |
|
269 | 270 | > [notify] |
|
270 | 271 | > sources = pull |
|
271 | 272 | > diffstat = True |
|
272 | 273 | > EOF |
|
273 | 274 | |
|
274 | 275 | pull |
|
275 | 276 | |
|
276 | 277 | $ hg --cwd b rollback |
|
277 | 278 | repository tip rolled back to revision 0 (undo pull) |
|
278 | 279 | $ hg --traceback --cwd b pull ../a | $PYTHON $TESTTMP/filter.py |
|
279 | 280 | pulling from ../a |
|
280 | 281 | searching for changes |
|
281 | 282 | adding changesets |
|
282 | 283 | adding manifests |
|
283 | 284 | adding file changes |
|
284 | 285 | added 1 changesets with 1 changes to 1 files |
|
285 | 286 | Content-Type: text/plain; charset="us-ascii" |
|
286 | 287 | MIME-Version: 1.0 |
|
287 | 288 | Content-Transfer-Encoding: 7bit |
|
288 | 289 | X-Test: foo |
|
289 | 290 | Date: * (glob) |
|
290 | 291 | Subject: b |
|
291 | 292 | From: test@test.com |
|
292 | 293 | X-Hg-Notification: changeset 0647d048b600 |
|
293 | 294 | Message-Id: <*> (glob) |
|
294 | 295 | To: baz@test.com, foo@bar |
|
295 | 296 | |
|
296 | 297 | changeset 0647d048b600 in b |
|
297 | 298 | description: b |
|
298 | 299 | diffstat: |
|
299 | 300 | a | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) |
|
300 | 301 | |
|
301 | 302 | diffs (6 lines): |
|
302 | 303 | |
|
303 | 304 | diff -r cb9a9f314b8b -r 0647d048b600 a |
|
304 | 305 | --- a/a Thu Jan 01 00:00:00 1970 +0000 |
|
305 | 306 | +++ b/a Thu Jan 01 00:00:01 1970 +0000 |
|
306 | 307 | @@ -1,1 +1,2 @@ a |
|
307 | 308 | +a |
|
308 | 309 | (run 'hg update' to get a working copy) |
|
309 | 310 | |
|
310 | 311 | test merge |
|
311 | 312 | |
|
312 | 313 | $ cd a |
|
313 | 314 | $ hg up -C 0 |
|
314 | 315 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
315 | 316 | $ echo a >> a |
|
316 | 317 | $ hg ci -Am adda2 -d '2 0' |
|
317 | 318 | created new head |
|
318 | 319 | $ hg merge |
|
319 | 320 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
320 | 321 | (branch merge, don't forget to commit) |
|
321 | 322 | $ hg ci -m merge -d '3 0' |
|
322 | 323 | $ cd .. |
|
323 | 324 | $ hg --traceback --cwd b pull ../a | $PYTHON $TESTTMP/filter.py |
|
324 | 325 | pulling from ../a |
|
325 | 326 | searching for changes |
|
326 | 327 | adding changesets |
|
327 | 328 | adding manifests |
|
328 | 329 | adding file changes |
|
329 | 330 | added 2 changesets with 0 changes to 0 files |
|
330 | 331 | Content-Type: text/plain; charset="us-ascii" |
|
331 | 332 | MIME-Version: 1.0 |
|
332 | 333 | Content-Transfer-Encoding: 7bit |
|
333 | 334 | X-Test: foo |
|
334 | 335 | Date: * (glob) |
|
335 | 336 | Subject: adda2 |
|
336 | 337 | From: test@test.com |
|
337 | 338 | X-Hg-Notification: changeset 0a184ce6067f |
|
338 | 339 | Message-Id: <*> (glob) |
|
339 | 340 | To: baz@test.com, foo@bar |
|
340 | 341 | |
|
341 | 342 | changeset 0a184ce6067f in b |
|
342 | 343 | description: adda2 |
|
343 | 344 | diffstat: |
|
344 | 345 | a | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) |
|
345 | 346 | |
|
346 | 347 | diffs (6 lines): |
|
347 | 348 | |
|
348 | 349 | diff -r cb9a9f314b8b -r 0a184ce6067f a |
|
349 | 350 | --- a/a Thu Jan 01 00:00:00 1970 +0000 |
|
350 | 351 | +++ b/a Thu Jan 01 00:00:02 1970 +0000 |
|
351 | 352 | @@ -1,1 +1,2 @@ a |
|
352 | 353 | +a |
|
353 | 354 | Content-Type: text/plain; charset="us-ascii" |
|
354 | 355 | MIME-Version: 1.0 |
|
355 | 356 | Content-Transfer-Encoding: 7bit |
|
356 | 357 | X-Test: foo |
|
357 | 358 | Date: * (glob) |
|
358 | 359 | Subject: merge |
|
359 | 360 | From: test@test.com |
|
360 | 361 | X-Hg-Notification: changeset 6a0cf76b2701 |
|
361 | 362 | Message-Id: <*> (glob) |
|
362 | 363 | To: baz@test.com, foo@bar |
|
363 | 364 | |
|
364 | 365 | changeset 6a0cf76b2701 in b |
|
365 | 366 | description: merge |
|
366 | 367 | (run 'hg update' to get a working copy) |
|
367 | 368 | |
|
368 | 369 | non-ascii content and truncation of multi-byte subject |
|
369 | 370 | |
|
370 | 371 | $ cat <<EOF >> $HGRCPATH |
|
371 | 372 | > [notify] |
|
372 | 373 | > maxsubject = 4 |
|
373 | 374 | > EOF |
|
374 | 375 | $ echo a >> a/a |
|
375 | 376 | $ hg --cwd a --encoding utf-8 commit -A -d '0 0' \ |
|
376 | 377 | > -m `$PYTHON -c 'print "\xc3\xa0\xc3\xa1\xc3\xa2\xc3\xa3\xc3\xa4"'` |
|
377 | 378 | $ hg --traceback --cwd b --encoding utf-8 pull ../a | \ |
|
378 | 379 | > $PYTHON $TESTTMP/filter.py |
|
379 | 380 | pulling from ../a |
|
380 | 381 | searching for changes |
|
381 | 382 | adding changesets |
|
382 | 383 | adding manifests |
|
383 | 384 | adding file changes |
|
384 | 385 | added 1 changesets with 1 changes to 1 files |
|
385 | 386 | Content-Type: text/plain; charset="us-ascii" |
|
386 | 387 | MIME-Version: 1.0 |
|
387 | 388 | Content-Transfer-Encoding: 8bit |
|
388 | 389 | X-Test: foo |
|
389 | 390 | Date: * (glob) |
|
390 | 391 | Subject: \xc3\xa0... (esc) |
|
391 | 392 | From: test@test.com |
|
392 | 393 | X-Hg-Notification: changeset 7ea05ad269dc |
|
393 | 394 | Message-Id: <*> (glob) |
|
394 | 395 | To: baz@test.com, foo@bar |
|
395 | 396 | |
|
396 | 397 | changeset 7ea05ad269dc in b |
|
397 | 398 | description: \xc3\xa0\xc3\xa1\xc3\xa2\xc3\xa3\xc3\xa4 (esc) |
|
398 | 399 | diffstat: |
|
399 | 400 | a | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) |
|
400 | 401 | |
|
401 | 402 | diffs (7 lines): |
|
402 | 403 | |
|
403 | 404 | diff -r 6a0cf76b2701 -r 7ea05ad269dc a |
|
404 | 405 | --- a/a Thu Jan 01 00:00:03 1970 +0000 |
|
405 | 406 | +++ b/a Thu Jan 01 00:00:00 1970 +0000 |
|
406 | 407 | @@ -1,2 +1,3 @@ a a |
|
407 | 408 | +a |
|
408 | 409 | (run 'hg update' to get a working copy) |
|
409 | 410 | |
|
410 | 411 | long lines |
|
411 | 412 | |
|
412 | 413 | $ cat <<EOF >> $HGRCPATH |
|
413 | 414 | > [notify] |
|
414 | 415 | > maxsubject = 67 |
|
415 | 416 | > test = False |
|
416 | 417 | > mbox = mbox |
|
417 | 418 | > EOF |
|
418 | 419 | $ $PYTHON -c 'file("a/a", "ab").write("no" * 500 + "\n")' |
|
419 | 420 | $ hg --cwd a commit -A -m "long line" |
|
420 | 421 | $ hg --traceback --cwd b pull ../a |
|
421 | 422 | pulling from ../a |
|
422 | 423 | searching for changes |
|
423 | 424 | adding changesets |
|
424 | 425 | adding manifests |
|
425 | 426 | adding file changes |
|
426 | 427 | added 1 changesets with 1 changes to 1 files |
|
427 | 428 | notify: sending 2 subscribers 1 changes |
|
428 | 429 | (run 'hg update' to get a working copy) |
|
429 | 430 | $ $PYTHON $TESTTMP/filter.py < b/mbox |
|
430 | 431 | From test@test.com ... ... .. ..:..:.. .... (re) |
|
431 | 432 | Content-Type: text/plain; charset="us-ascii" |
|
432 | 433 | MIME-Version: 1.0 |
|
433 | 434 | Content-Transfer-Encoding: quoted-printable |
|
434 | 435 | X-Test: foo |
|
435 | 436 | Date: * (glob) |
|
436 | 437 | Subject: long line |
|
437 | 438 | From: test@test.com |
|
438 | 439 | X-Hg-Notification: changeset e0be44cf638b |
|
439 | 440 | Message-Id: <hg.e0be44cf638b.*.*@*> (glob) |
|
440 | 441 | To: baz@test.com, foo@bar |
|
441 | 442 | |
|
442 | 443 | changeset e0be44cf638b in b |
|
443 | 444 | description: long line |
|
444 | 445 | diffstat: |
|
445 | 446 | a | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) |
|
446 | 447 | |
|
447 | 448 | diffs (8 lines): |
|
448 | 449 | |
|
449 | 450 | diff -r 7ea05ad269dc -r e0be44cf638b a |
|
450 | 451 | --- a/a Thu Jan 01 00:00:00 1970 +0000 |
|
451 | 452 | +++ b/a Thu Jan 01 00:00:00 1970 +0000 |
|
452 | 453 | @@ -1,3 +1,4 @@ a a a |
|
453 | 454 | +nonononononononononononononononononononononononononononononononononononono= |
|
454 | 455 | nononononononononononononononononononononononononononononononononononononon= |
|
455 | 456 | ononononononononononononononononononononononononononononononononononononono= |
|
456 | 457 | nononononononononononononononononononononononononononononononononononononon= |
|
457 | 458 | ononononononononononononononononononononononononononononononononononononono= |
|
458 | 459 | nononononononononononononononononononononononononononononononononononononon= |
|
459 | 460 | ononononononononononononononononononononononononononononononononononononono= |
|
460 | 461 | nononononononononononononononononononononononononononononononononononononon= |
|
461 | 462 | ononononononononononononononononononononononononononononononononononononono= |
|
462 | 463 | nononononononononononononononononononononononononononononononononononononon= |
|
463 | 464 | ononononononononononononononononononononononononononononononononononononono= |
|
464 | 465 | nononononononononononononononononononononononononononononononononononononon= |
|
465 | 466 | ononononononononononononononononononononononononononononononononononononono= |
|
466 | 467 | nonononononononononononono |
|
467 | 468 | |
|
468 | 469 | revset selection: send to address that matches branch and repo |
|
469 | 470 | |
|
470 | 471 | $ cat << EOF >> $HGRCPATH |
|
471 | 472 | > [hooks] |
|
472 | 473 | > incoming.notify = python:hgext.notify.hook |
|
473 | 474 | > |
|
474 | 475 | > [notify] |
|
475 | 476 | > sources = pull |
|
476 | 477 | > test = True |
|
477 | 478 | > diffstat = False |
|
478 | 479 | > maxdiff = 0 |
|
479 | 480 | > |
|
480 | 481 | > [reposubs] |
|
481 | 482 | > */a#branch(test) = will_no_be_send@example.com |
|
482 | 483 | > */b#branch(test) = notify@example.com |
|
483 | 484 | > EOF |
|
484 | 485 | $ hg --cwd a branch test |
|
485 | 486 | marked working directory as branch test |
|
486 | 487 | (branches are permanent and global, did you want a bookmark?) |
|
487 | 488 | $ echo a >> a/a |
|
488 | 489 | $ hg --cwd a ci -m test -d '1 0' |
|
489 | 490 | $ hg --traceback --cwd b pull ../a | $PYTHON $TESTTMP/filter.py |
|
490 | 491 | pulling from ../a |
|
491 | 492 | searching for changes |
|
492 | 493 | adding changesets |
|
493 | 494 | adding manifests |
|
494 | 495 | adding file changes |
|
495 | 496 | added 1 changesets with 1 changes to 1 files |
|
496 | 497 | Content-Type: text/plain; charset="us-ascii" |
|
497 | 498 | MIME-Version: 1.0 |
|
498 | 499 | Content-Transfer-Encoding: 7bit |
|
499 | 500 | X-Test: foo |
|
500 | 501 | Date: * (glob) |
|
501 | 502 | Subject: test |
|
502 | 503 | From: test@test.com |
|
503 | 504 | X-Hg-Notification: changeset fbbcbc516f2f |
|
504 | 505 | Message-Id: <hg.fbbcbc516f2f.*.*@*> (glob) |
|
505 | 506 | To: baz@test.com, foo@bar, notify@example.com |
|
506 | 507 | |
|
507 | 508 | changeset fbbcbc516f2f in b |
|
508 | 509 | description: test |
|
509 | 510 | (run 'hg update' to get a working copy) |
|
510 | 511 | |
|
511 | 512 | revset selection: don't send to address that waits for mails |
|
512 | 513 | from different branch |
|
513 | 514 | |
|
514 | 515 | $ hg --cwd a update default |
|
515 | 516 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
516 | 517 | $ echo a >> a/a |
|
517 | 518 | $ hg --cwd a ci -m test -d '1 0' |
|
518 | 519 | $ hg --traceback --cwd b pull ../a | $PYTHON $TESTTMP/filter.py |
|
519 | 520 | pulling from ../a |
|
520 | 521 | searching for changes |
|
521 | 522 | adding changesets |
|
522 | 523 | adding manifests |
|
523 | 524 | adding file changes |
|
524 | 525 | added 1 changesets with 0 changes to 0 files (+1 heads) |
|
525 | 526 | Content-Type: text/plain; charset="us-ascii" |
|
526 | 527 | MIME-Version: 1.0 |
|
527 | 528 | Content-Transfer-Encoding: 7bit |
|
528 | 529 | X-Test: foo |
|
529 | 530 | Date: * (glob) |
|
530 | 531 | Subject: test |
|
531 | 532 | From: test@test.com |
|
532 | 533 | X-Hg-Notification: changeset 38b42fa092de |
|
533 | 534 | Message-Id: <hg.38b42fa092de.*.*@*> (glob) |
|
534 | 535 | To: baz@test.com, foo@bar |
|
535 | 536 | |
|
536 | 537 | changeset 38b42fa092de in b |
|
537 | 538 | description: test |
|
538 | 539 | (run 'hg heads' to see heads) |
|
539 | 540 | |
|
540 | 541 | default template: |
|
541 | 542 | |
|
542 | 543 | $ grep -v '^template =' $HGRCPATH > "$HGRCPATH.new" |
|
543 | 544 | $ mv "$HGRCPATH.new" $HGRCPATH |
|
544 | 545 | $ echo a >> a/a |
|
545 | 546 | $ hg --cwd a commit -m 'default template' |
|
546 | 547 | $ hg --cwd b pull ../a -q | $PYTHON $TESTTMP/filter.py |
|
547 | 548 | Content-Type: text/plain; charset="us-ascii" |
|
548 | 549 | MIME-Version: 1.0 |
|
549 | 550 | Content-Transfer-Encoding: 7bit |
|
550 | 551 | Date: * (glob) |
|
551 | 552 | Subject: changeset in b: default template |
|
552 | 553 | From: test@test.com |
|
553 | 554 | X-Hg-Notification: changeset 3548c9e294b6 |
|
554 | 555 | Message-Id: <hg.3548c9e294b6.*.*@*> (glob) |
|
555 | 556 | To: baz@test.com, foo@bar |
|
556 | 557 | |
|
557 | 558 | changeset 3548c9e294b6 in $TESTTMP/b (glob) |
|
558 | 559 | details: http://test/b?cmd=changeset;node=3548c9e294b6 |
|
559 | 560 | description: default template |
|
560 | 561 | |
|
561 | 562 | with style: |
|
562 | 563 | |
|
563 | 564 | $ cat <<EOF > notifystyle.map |
|
564 | 565 | > changeset = "Subject: {desc|firstline|strip} |
|
565 | 566 | > From: {author} |
|
566 | 567 | > {""} |
|
567 | 568 | > changeset {node|short}" |
|
568 | 569 | > EOF |
|
569 | 570 | $ cat <<EOF >> $HGRCPATH |
|
570 | 571 | > [notify] |
|
571 | 572 | > style = $TESTTMP/notifystyle.map |
|
572 | 573 | > EOF |
|
573 | 574 | $ echo a >> a/a |
|
574 | 575 | $ hg --cwd a commit -m 'with style' |
|
575 | 576 | $ hg --cwd b pull ../a -q | $PYTHON $TESTTMP/filter.py |
|
576 | 577 | Content-Type: text/plain; charset="us-ascii" |
|
577 | 578 | MIME-Version: 1.0 |
|
578 | 579 | Content-Transfer-Encoding: 7bit |
|
579 | 580 | Date: * (glob) |
|
580 | 581 | Subject: with style |
|
581 | 582 | From: test@test.com |
|
582 | 583 | X-Hg-Notification: changeset e917dbd961d3 |
|
583 | 584 | Message-Id: <hg.e917dbd961d3.*.*@*> (glob) |
|
584 | 585 | To: baz@test.com, foo@bar |
|
585 | 586 | |
|
586 | 587 | changeset e917dbd961d3 |
|
587 | 588 | |
|
588 | 589 | with template (overrides style): |
|
589 | 590 | |
|
590 | 591 | $ cat <<EOF >> $HGRCPATH |
|
591 | 592 | > template = Subject: {node|short}: {desc|firstline|strip} |
|
592 | 593 | > From: {author} |
|
593 | 594 | > {""} |
|
594 | 595 | > {desc} |
|
595 | 596 | > EOF |
|
596 | 597 | $ echo a >> a/a |
|
597 | 598 | $ hg --cwd a commit -m 'with template' |
|
598 | 599 | $ hg --cwd b pull ../a -q | $PYTHON $TESTTMP/filter.py |
|
599 | 600 | Content-Type: text/plain; charset="us-ascii" |
|
600 | 601 | MIME-Version: 1.0 |
|
601 | 602 | Content-Transfer-Encoding: 7bit |
|
602 | 603 | Date: * (glob) |
|
603 | 604 | Subject: a09743fd3edd: with template |
|
604 | 605 | From: test@test.com |
|
605 | 606 | X-Hg-Notification: changeset a09743fd3edd |
|
606 | 607 | Message-Id: <hg.a09743fd3edd.*.*@*> (glob) |
|
607 | 608 | To: baz@test.com, foo@bar |
|
608 | 609 | |
|
609 | 610 | with template |
General Comments 0
You need to be logged in to leave comments.
Login now