##// END OF EJS Templates
test-notify: fix fix for line continuation in long mail header lines...
Mads Kiilerich -
r12646:624859bf default
parent child Browse files
Show More
@@ -1,305 +1,304 b''
1 1
2 2 $ cat <<EOF >> $HGRCPATH
3 3 > [extensions]
4 4 > notify=
5 5 >
6 6 > [hooks]
7 7 > incoming.notify = python:hgext.notify.hook
8 8 >
9 9 > [notify]
10 10 > sources = pull
11 11 > diffstat = False
12 12 >
13 13 > [usersubs]
14 14 > foo@bar = *
15 15 >
16 16 > [reposubs]
17 17 > * = baz
18 18 > EOF
19 19 $ hg help notify
20 20 notify extension - hooks for sending email notifications at commit/push time
21 21
22 22 Subscriptions can be managed through a hgrc file. Default mode is to print
23 23 messages to stdout, for testing and configuring.
24 24
25 25 To use, configure the notify extension and enable it in hgrc like this:
26 26
27 27 [extensions]
28 28 notify =
29 29
30 30 [hooks]
31 31 # one email for each incoming changeset
32 32 incoming.notify = python:hgext.notify.hook
33 33 # batch emails when many changesets incoming at one time
34 34 changegroup.notify = python:hgext.notify.hook
35 35
36 36 [notify]
37 37 # config items go here
38 38
39 39 Required configuration items:
40 40
41 41 config = /path/to/file # file containing subscriptions
42 42
43 43 Optional configuration items:
44 44
45 45 test = True # print messages to stdout for testing
46 46 strip = 3 # number of slashes to strip for url paths
47 47 domain = example.com # domain to use if committer missing domain
48 48 style = ... # style file to use when formatting email
49 49 template = ... # template to use when formatting email
50 50 incoming = ... # template to use when run as incoming hook
51 51 changegroup = ... # template when run as changegroup hook
52 52 maxdiff = 300 # max lines of diffs to include (0=none, -1=all)
53 53 maxsubject = 67 # truncate subject line longer than this
54 54 diffstat = True # add a diffstat before the diff content
55 55 sources = serve # notify if source of incoming changes in this list
56 56 # (serve == ssh or http, push, pull, bundle)
57 57 merge = False # send notification for merges (default True)
58 58 [email]
59 59 from = user@host.com # email address to send as if none given
60 60 [web]
61 61 baseurl = http://hgserver/... # root of hg web site for browsing commits
62 62
63 63 The notify config file has same format as a regular hgrc file. It has two
64 64 sections so you can express subscriptions in whatever way is handier for you.
65 65
66 66 [usersubs]
67 67 # key is subscriber email, value is ","-separated list of glob patterns
68 68 user@host = pattern
69 69
70 70 [reposubs]
71 71 # key is glob pattern, value is ","-separated list of subscriber emails
72 72 pattern = user@host
73 73
74 74 Glob patterns are matched against path to repository root.
75 75
76 76 If you like, you can put notify config file in repository that users can push
77 77 changes to, they can manage their own subscriptions.
78 78
79 79 no commands defined
80 80 $ hg init a
81 81 $ echo a > a/a
82 82
83 83 commit
84 84
85 85 $ hg --cwd a commit -Ama -d '0 0'
86 86 adding a
87 87
88 88
89 89 clone
90 90
91 91 $ hg --traceback clone a b
92 92 updating to branch default
93 93 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
94 94 $ echo a >> a/a
95 95
96 96 commit
97 97
98 98 $ hg --traceback --cwd a commit -Amb -d '1 0'
99 99
100 100 on Mac OS X 10.5 the tmp path is very long so would get stripped in the subject line
101 101
102 102 $ cat <<EOF >> $HGRCPATH
103 103 > [notify]
104 104 > maxsubject = 200
105 105 > EOF
106 106
107 107 the python call below wraps continuation lines, which appear on Mac OS X 10.5 because
108 108 of the very long subject line
109 109 pull (minimal config)
110 110
111 111 $ hg --traceback --cwd b pull ../a | \
112 > python -c 'import sys,re; print re.sub("\n\t", " ", sys.stdin.read()),'
112 > python -c 'import sys,re; print re.sub("\n[\t ]", " ", sys.stdin.read()),'
113 113 pulling from ../a
114 114 searching for changes
115 115 adding changesets
116 116 adding manifests
117 117 adding file changes
118 118 added 1 changesets with 1 changes to 1 files
119 119 Content-Type: text/plain; charset="us-ascii"
120 120 MIME-Version: 1.0
121 121 Content-Transfer-Encoding: 7bit
122 122 Date: * (glob)
123 123 Subject: changeset in $TESTTMP/b: b
124 124 From: test
125 125 X-Hg-Notification: changeset 0647d048b600
126 126 Message-Id: <*> (glob)
127 127 To: baz, foo@bar
128 128
129 129 changeset 0647d048b600 in $TESTTMP/b
130 130 details: $TESTTMP/b?cmd=changeset;node=0647d048b600
131 131 description: b
132 132
133 133 diffs (6 lines):
134 134
135 135 diff -r cb9a9f314b8b -r 0647d048b600 a
136 136 --- a/a Thu Jan 01 00:00:00 1970 +0000
137 137 +++ b/a Thu Jan 01 00:00:01 1970 +0000
138 @@ -1,1 +1,2 @@
139 a
138 @@ -1,1 +1,2 @@ a
140 139 +a
141 140 (run 'hg update' to get a working copy)
142 141 $ cat <<EOF >> $HGRCPATH
143 142 > [notify]
144 143 > config = `pwd`/.notify.conf
145 144 > domain = test.com
146 145 > strip = 42
147 146 > template = Subject: {desc|firstline|strip}\nFrom: {author}\nX-Test: foo\n\nchangeset {node|short} in {webroot}\ndescription:\n\t{desc|tabindent|strip}
148 147 >
149 148 > [web]
150 149 > baseurl = http://test/
151 150 > EOF
152 151
153 152 fail for config file is missing
154 153
155 154 $ hg --cwd b rollback
156 155 rolling back to revision 0 (undo pull)
157 156 $ hg --cwd b pull ../a 2>&1 | grep 'error.*\.notify\.conf' > /dev/null && echo pull failed
158 157 pull failed
159 158 $ touch ".notify.conf"
160 159
161 160 pull
162 161
163 162 $ hg --cwd b rollback
164 163 rolling back to revision 0 (undo pull)
165 164 $ hg --traceback --cwd b pull ../a | \
166 165 > python -c 'import sys,re; print re.sub("\n\t", " ", sys.stdin.read()),'
167 166 pulling from ../a
168 167 searching for changes
169 168 adding changesets
170 169 adding manifests
171 170 adding file changes
172 171 added 1 changesets with 1 changes to 1 files
173 172 Content-Type: text/plain; charset="us-ascii"
174 173 MIME-Version: 1.0
175 174 Content-Transfer-Encoding: 7bit
176 175 X-Test: foo
177 176 Date: * (glob)
178 177 Subject: b
179 178 From: test@test.com
180 179 X-Hg-Notification: changeset 0647d048b600
181 180 Message-Id: <*> (glob)
182 181 To: baz@test.com, foo@bar
183 182
184 183 changeset 0647d048b600 in b
185 184 description: b
186 185 diffs (6 lines):
187 186
188 187 diff -r cb9a9f314b8b -r 0647d048b600 a
189 188 --- a/a Thu Jan 01 00:00:00 1970 +0000
190 189 +++ b/a Thu Jan 01 00:00:01 1970 +0000
191 190 @@ -1,1 +1,2 @@
192 191 a
193 192 +a
194 193 (run 'hg update' to get a working copy)
195 194
196 195 $ cat << EOF >> $HGRCPATH
197 196 > [hooks]
198 197 > incoming.notify = python:hgext.notify.hook
199 198 >
200 199 > [notify]
201 200 > sources = pull
202 201 > diffstat = True
203 202 > EOF
204 203
205 204 pull
206 205
207 206 $ hg --cwd b rollback
208 207 rolling back to revision 0 (undo pull)
209 208 $ hg --traceback --cwd b pull ../a | \
210 209 > python -c 'import sys,re; print re.sub("\n\t", " ", sys.stdin.read()),'
211 210 pulling from ../a
212 211 searching for changes
213 212 adding changesets
214 213 adding manifests
215 214 adding file changes
216 215 added 1 changesets with 1 changes to 1 files
217 216 Content-Type: text/plain; charset="us-ascii"
218 217 MIME-Version: 1.0
219 218 Content-Transfer-Encoding: 7bit
220 219 X-Test: foo
221 220 Date: * (glob)
222 221 Subject: b
223 222 From: test@test.com
224 223 X-Hg-Notification: changeset 0647d048b600
225 224 Message-Id: <*> (glob)
226 225 To: baz@test.com, foo@bar
227 226
228 227 changeset 0647d048b600 in b
229 228 description: b
230 229 diffstat:
231 230
232 231 a | 1 +
233 232 1 files changed, 1 insertions(+), 0 deletions(-)
234 233
235 234 diffs (6 lines):
236 235
237 236 diff -r cb9a9f314b8b -r 0647d048b600 a
238 237 --- a/a Thu Jan 01 00:00:00 1970 +0000
239 238 +++ b/a Thu Jan 01 00:00:01 1970 +0000
240 239 @@ -1,1 +1,2 @@
241 240 a
242 241 +a
243 242 (run 'hg update' to get a working copy)
244 243
245 244 test merge
246 245
247 246 $ cd a
248 247 $ hg up -C 0
249 248 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
250 249 $ echo a >> a
251 250 $ hg ci -Am adda2 -d '2 0'
252 251 created new head
253 252 $ hg merge
254 253 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
255 254 (branch merge, don't forget to commit)
256 255 $ hg ci -m merge -d '3 0'
257 256 $ cd ..
258 257 $ hg --traceback --cwd b pull ../a | \
259 258 > python -c 'import sys,re; print re.sub("\n\t", " ", sys.stdin.read()),'
260 259 pulling from ../a
261 260 searching for changes
262 261 adding changesets
263 262 adding manifests
264 263 adding file changes
265 264 added 2 changesets with 0 changes to 0 files
266 265 Content-Type: text/plain; charset="us-ascii"
267 266 MIME-Version: 1.0
268 267 Content-Transfer-Encoding: 7bit
269 268 X-Test: foo
270 269 Date: * (glob)
271 270 Subject: adda2
272 271 From: test@test.com
273 272 X-Hg-Notification: changeset 0a184ce6067f
274 273 Message-Id: <*> (glob)
275 274 To: baz@test.com, foo@bar
276 275
277 276 changeset 0a184ce6067f in b
278 277 description: adda2
279 278 diffstat:
280 279
281 280 a | 1 +
282 281 1 files changed, 1 insertions(+), 0 deletions(-)
283 282
284 283 diffs (6 lines):
285 284
286 285 diff -r cb9a9f314b8b -r 0a184ce6067f a
287 286 --- a/a Thu Jan 01 00:00:00 1970 +0000
288 287 +++ b/a Thu Jan 01 00:00:02 1970 +0000
289 288 @@ -1,1 +1,2 @@
290 289 a
291 290 +a
292 291 Content-Type: text/plain; charset="us-ascii"
293 292 MIME-Version: 1.0
294 293 Content-Transfer-Encoding: 7bit
295 294 X-Test: foo
296 295 Date: * (glob)
297 296 Subject: merge
298 297 From: test@test.com
299 298 X-Hg-Notification: changeset 22c88b85aa27
300 299 Message-Id: <*> (glob)
301 300 To: baz@test.com, foo@bar
302 301
303 302 changeset 22c88b85aa27 in b
304 303 description: merge
305 304 (run 'hg update' to get a working copy)
General Comments 0
You need to be logged in to leave comments. Login now