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