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