##// END OF EJS Templates
patchbomb: minor refactoring of mbox functionality, preparing for move...
Mads Kiilerich -
r15559:1830d0cc default
parent child Browse files
Show More
@@ -533,14 +533,13 b' def patchbomb(ui, repo, *revs, **opts):'
533 if fp is not ui:
533 if fp is not ui:
534 fp.close()
534 fp.close()
535 elif mbox:
535 elif mbox:
536 ui.status(_('Writing '), subj, ' ...\n')
536 ui.status(_('Sending '), subj, ' ...\n')
537 ui.progress(_('writing'), i, item=subj, total=len(msgs))
537 ui.progress(_('sending'), i, item=subj, total=len(msgs))
538 fp = open(mbox, 'In-Reply-To' in m and 'ab+' or 'wb+')
538 fp = open(mbox, i > 0 and 'ab+' or 'wb+')
539 generator = email.Generator.Generator(fp, mangle_from_=True)
539 generator = email.Generator.Generator(fp, mangle_from_=True)
540 # Should be time.asctime(), but Windows prints 2-characters day
540 # Should be time.asctime(), but Windows prints 2-characters day
541 # of month instead of one. Make them print the same thing.
541 # of month instead of one. Make them print the same thing.
542 date = time.strftime('%a %b %d %H:%M:%S %Y',
542 date = time.strftime('%a %b %d %H:%M:%S %Y', time.localtime())
543 time.localtime(start_time[0]))
544 fp.write('From %s %s\n' % (sender_addr, date))
543 fp.write('From %s %s\n' % (sender_addr, date))
545 generator.flatten(m, 0)
544 generator.flatten(m, 0)
546 fp.write('\n\n')
545 fp.write('\n\n')
@@ -555,7 +554,7 b' def patchbomb(ui, repo, *revs, **opts):'
555 fp = cStringIO.StringIO()
554 fp = cStringIO.StringIO()
556 generator = email.Generator.Generator(fp, mangle_from_=False)
555 generator = email.Generator.Generator(fp, mangle_from_=False)
557 generator.flatten(m, 0)
556 generator.flatten(m, 0)
558 sendmail(sender, to + bcc + cc, fp.getvalue())
557 sendmail(sender_addr, to + bcc + cc, fp.getvalue())
559
558
560 ui.progress(_('writing'), None)
559 ui.progress(_('writing'), None)
561 ui.progress(_('sending'), None)
560 ui.progress(_('sending'), None)
@@ -161,20 +161,20 b''
161 Write the introductory message for the patch series.
161 Write the introductory message for the patch series.
162
162
163
163
164 writing [ ] 0/3
164 sending [ ] 0/3
165 writing [ ] 0/3
165 sending [ ] 0/3
166
166
167
167
168 writing [==============> ] 1/3
168 sending [==============> ] 1/3
169 writing [==============> ] 1/3
169 sending [==============> ] 1/3
170
170
171
171
172 writing [=============================> ] 2/3
172 sending [=============================> ] 2/3
173 writing [=============================> ] 2/3
173 sending [=============================> ] 2/3
174 \r (esc)
174 \r (esc)
175 Writing [PATCH 0 of 2] test ...
175 Sending [PATCH 0 of 2] test ...
176 Writing [PATCH 1 of 2] a ...
176 Sending [PATCH 1 of 2] a ...
177 Writing [PATCH 2 of 2] b ...
177 Sending [PATCH 2 of 2] b ...
178
178
179
179
180 $ cd ..
180 $ cd ..
@@ -279,14 +279,14 b' no mime encoding for email --test:'
279
279
280
280
281 mime encoded mbox (base64):
281 mime encoded mbox (base64):
282 $ hg email --date '1970-1-1 0:4' -f quux -t foo -c bar -r tip -m mbox
282 $ hg email --date '1970-1-1 0:4' -f 'Q <quux>' -t foo -c bar -r tip -m mbox
283 This patch series consists of 1 patches.
283 This patch series consists of 1 patches.
284
284
285
285
286 Writing [PATCH] utf-8 content ...
286 Sending [PATCH] utf-8 content ...
287
287
288 $ cat mbox
288 $ cat mbox
289 From quux Thu Jan 01 00:04:01 1970
289 From quux ... ... .. ..:..:.. .... (re)
290 Content-Type: text/plain; charset="utf-8"
290 Content-Type: text/plain; charset="utf-8"
291 MIME-Version: 1.0
291 MIME-Version: 1.0
292 Content-Transfer-Encoding: base64
292 Content-Transfer-Encoding: base64
@@ -295,7 +295,7 b' mime encoded mbox (base64):'
295 Message-Id: <909a00e13e9d78b575ae.240@*> (glob)
295 Message-Id: <909a00e13e9d78b575ae.240@*> (glob)
296 User-Agent: Mercurial-patchbomb/* (glob)
296 User-Agent: Mercurial-patchbomb/* (glob)
297 Date: Thu, 01 Jan 1970 00:04:00 +0000
297 Date: Thu, 01 Jan 1970 00:04:00 +0000
298 From: quux
298 From: Q <quux>
299 To: foo
299 To: foo
300 Cc: bar
300 Cc: bar
301
301
@@ -391,9 +391,9 b' mime encoded mbox (quoted-printable):'
391 This patch series consists of 1 patches.
391 This patch series consists of 1 patches.
392
392
393
393
394 Writing [PATCH] long line ...
394 Sending [PATCH] long line ...
395 $ cat mbox
395 $ cat mbox
396 From quux Thu Jan 01 00:04:01 1970
396 From quux ... ... .. ..:..:.. .... (re)
397 Content-Type: text/plain; charset="us-ascii"
397 Content-Type: text/plain; charset="us-ascii"
398 MIME-Version: 1.0
398 MIME-Version: 1.0
399 Content-Transfer-Encoding: quoted-printable
399 Content-Transfer-Encoding: quoted-printable
@@ -449,9 +449,9 b' fake ascii mbox:'
449 This patch series consists of 1 patches.
449 This patch series consists of 1 patches.
450
450
451
451
452 Writing [PATCH] isolatin 8-bit encoding ...
452 Sending [PATCH] isolatin 8-bit encoding ...
453 $ cat mbox
453 $ cat mbox
454 From quux Thu Jan 01 00:05:01 1970
454 From quux ... ... .. ..:..:.. .... (re)
455 Content-Type: text/plain; charset="us-ascii"
455 Content-Type: text/plain; charset="us-ascii"
456 MIME-Version: 1.0
456 MIME-Version: 1.0
457 Content-Transfer-Encoding: 8bit
457 Content-Transfer-Encoding: 8bit
@@ -1944,9 +1944,9 b' test multi-address parsing:'
1944 This patch series consists of 1 patches.
1944 This patch series consists of 1 patches.
1945
1945
1946
1946
1947 Writing [PATCH] test ...
1947 Sending [PATCH] test ...
1948 $ cat < tmp.mbox
1948 $ cat < tmp.mbox
1949 From quux Tue Jan 01 00:01:01 1980
1949 From quux ... ... .. ..:..:.. .... (re)
1950 Content-Type: text/plain; charset="us-ascii"
1950 Content-Type: text/plain; charset="us-ascii"
1951 MIME-Version: 1.0
1951 MIME-Version: 1.0
1952 Content-Transfer-Encoding: 7bit
1952 Content-Transfer-Encoding: 7bit
@@ -1984,10 +1984,10 b' test multi-byte domain parsing:'
1984
1984
1985 Cc:
1985 Cc:
1986
1986
1987 Writing [PATCH] test ...
1987 Sending [PATCH] test ...
1988
1988
1989 $ cat tmp.mbox
1989 $ cat tmp.mbox
1990 From quux Tue Jan 01 00:01:01 1980
1990 From quux ... ... .. ..:..:.. .... (re)
1991 Content-Type: text/plain; charset="us-ascii"
1991 Content-Type: text/plain; charset="us-ascii"
1992 MIME-Version: 1.0
1992 MIME-Version: 1.0
1993 Content-Transfer-Encoding: 7bit
1993 Content-Transfer-Encoding: 7bit
General Comments 0
You need to be logged in to leave comments. Login now