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