Show More
@@ -108,6 +108,11 b' notify.merge' | |||
|
108 | 108 | notify.mbox |
|
109 | 109 | If set, append mails to this mbox file instead of sending. Default: None. |
|
110 | 110 | |
|
111 | notify.fromauthor | |
|
112 | If set, use the first committer of the changegroup for the "From" field of | |
|
113 | the notification mail. If not set, take the user from the pushing repo. | |
|
114 | Default: False. | |
|
115 | ||
|
111 | 116 | If set, the following entries will also be used to customize the notifications: |
|
112 | 117 | |
|
113 | 118 | email.from |
@@ -338,11 +343,14 b' def hook(ui, repo, hooktype, node=None, ' | |||
|
338 | 343 | ui.pushbuffer() |
|
339 | 344 | data = '' |
|
340 | 345 | count = 0 |
|
346 | author = '' | |
|
341 | 347 | if hooktype == 'changegroup' or hooktype == 'outgoing': |
|
342 | 348 | start, end = ctx.rev(), len(repo) |
|
343 | 349 | for rev in xrange(start, end): |
|
344 | 350 | if n.node(repo[rev]): |
|
345 | 351 | count += 1 |
|
352 | if not author: | |
|
353 | author = repo[rev].user() | |
|
346 | 354 | else: |
|
347 | 355 | data += ui.popbuffer() |
|
348 | 356 | ui.note(_('notify: suppressing notification for merge %d:%s\n') % |
@@ -360,5 +368,9 b' def hook(ui, repo, hooktype, node=None, ' | |||
|
360 | 368 | n.diff(ctx) |
|
361 | 369 | |
|
362 | 370 | data += ui.popbuffer() |
|
371 | fromauthor = ui.config('notify', 'fromauthor') | |
|
372 | if author and fromauthor: | |
|
373 | data = '\n'.join(['From: %s' % author, data]) | |
|
374 | ||
|
363 | 375 | if count: |
|
364 | 376 | n.send(ctx, count, data) |
@@ -124,3 +124,91 b' unbundle with correct source' | |||
|
124 | 124 | +a |
|
125 | 125 | +a |
|
126 | 126 | (run 'hg update' to get a working copy) |
|
127 | ||
|
128 | Check that using the first committer as the author of a changeset works: | |
|
129 | Check that the config option works. | |
|
130 | Check that the first committer is indeed used for "From:". | |
|
131 | Check that the merge user is NOT used for "From:" | |
|
132 | ||
|
133 | Create new file | |
|
134 | ||
|
135 | $ echo a > b/b | |
|
136 | $ echo b >> b/b | |
|
137 | $ echo c >> b/b | |
|
138 | $ hg --traceback --cwd b commit -Amnewfile -u committer_1 | |
|
139 | adding b | |
|
140 | ||
|
141 | commit as one user | |
|
142 | ||
|
143 | $ echo x > b/b | |
|
144 | $ echo b >> b/b | |
|
145 | $ echo c >> b/b | |
|
146 | $ hg --traceback --cwd b commit -Amx -u committer_2 | |
|
147 | ||
|
148 | commit as other user, change file so we can do an (automatic) merge | |
|
149 | ||
|
150 | $ hg --cwd b up 2 | |
|
151 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
|
152 | $ echo a > b/b | |
|
153 | $ echo b >> b/b | |
|
154 | $ echo y >> b/b | |
|
155 | $ hg --traceback --cwd b commit -Amy -u committer_3 | |
|
156 | created new head | |
|
157 | ||
|
158 | merge as a different user | |
|
159 | ||
|
160 | $ hg --cwd b merge --config notify.fromauthor=True | |
|
161 | merging b | |
|
162 | 0 files updated, 1 files merged, 0 files removed, 0 files unresolved | |
|
163 | (branch merge, don't forget to commit) | |
|
164 | ||
|
165 | $ hg --traceback --cwd b commit -Am "merged" | |
|
166 | ||
|
167 | push | |
|
168 | ||
|
169 | $ hg --traceback --cwd b --config notify.fromauthor=True push ../a 2>&1 | | |
|
170 | > python -c 'import sys,re; print re.sub("\n\t", " ", sys.stdin.read()),' | |
|
171 | pushing to ../a | |
|
172 | searching for changes | |
|
173 | adding changesets | |
|
174 | adding manifests | |
|
175 | adding file changes | |
|
176 | added 4 changesets with 4 changes to 1 files | |
|
177 | Content-Type: text/plain; charset="us-ascii" | |
|
178 | MIME-Version: 1.0 | |
|
179 | Content-Transfer-Encoding: 7bit | |
|
180 | Date: * (glob) | |
|
181 | Subject: * (glob) | |
|
182 | From: committer_1 | |
|
183 | X-Hg-Notification: changeset 84e487dddc58 | |
|
184 | Message-Id: <*> (glob) | |
|
185 | To: baz, foo@bar | |
|
186 | ||
|
187 | changeset 84e487dddc58 in $TESTTMP/a | |
|
188 | details: $TESTTMP/a?cmd=changeset;node=84e487dddc58 | |
|
189 | summary: newfile | |
|
190 | ||
|
191 | changeset b29c7a2b6b0c in $TESTTMP/a | |
|
192 | details: $TESTTMP/a?cmd=changeset;node=b29c7a2b6b0c | |
|
193 | summary: x | |
|
194 | ||
|
195 | changeset 0957c7d64886 in $TESTTMP/a | |
|
196 | details: $TESTTMP/a?cmd=changeset;node=0957c7d64886 | |
|
197 | summary: y | |
|
198 | ||
|
199 | changeset 485b4e6b0249 in $TESTTMP/a | |
|
200 | details: $TESTTMP/a?cmd=changeset;node=485b4e6b0249 | |
|
201 | summary: merged | |
|
202 | ||
|
203 | diffs (7 lines): | |
|
204 | ||
|
205 | diff -r ba677d0156c1 -r 485b4e6b0249 b | |
|
206 | --- /dev/null Thu Jan 01 00:00:00 1970 +0000 | |
|
207 | +++ b/b Thu Jan 01 00:00:00 1970 +0000 | |
|
208 | @@ -0,0 +1,3 @@ | |
|
209 | +x | |
|
210 | +b | |
|
211 | +y | |
|
212 | $ hg --cwd a rollback | |
|
213 | repository tip rolled back to revision 1 (undo push) | |
|
214 |
@@ -116,6 +116,11 b'' | |||
|
116 | 116 | notify.mbox |
|
117 | 117 | If set, append mails to this mbox file instead of sending. Default: None. |
|
118 | 118 | |
|
119 | notify.fromauthor | |
|
120 | If set, use the first committer of the changegroup for the "From" field of | |
|
121 | the notification mail. If not set, take the user from the pushing repo. | |
|
122 | Default: False. | |
|
123 | ||
|
119 | 124 | If set, the following entries will also be used to customize the |
|
120 | 125 | notifications: |
|
121 | 126 |
General Comments 0
You need to be logged in to leave comments.
Login now