# HG changeset patch
# User Yuya Nishihara <y...@tcha.org>
# Date 1534041804 -32400
#      Sun Aug 12 11:43:24 2018 +0900
# Node ID 588e5275e29cdd37c49df8f1535ebd52042cd3d4
# Parent  72f91934d88362792e8b6b79ceb51e90d655364e
patchbomb: really use BytesGenerator API

It wraps around Generator type.

diff --git a/hgext/patchbomb.py b/hgext/patchbomb.py
--- a/hgext/patchbomb.py
+++ b/hgext/patchbomb.py
@@ -142,7 +142,7 @@ configitem('patchbomb', 'to',
 if pycompat.ispy3:
     _bytesgenerator = emailgen.BytesGenerator
 else:
-    _bytesgenerator = lambda f: f
+    _bytesgenerator = emailgen.Generator
 
 # Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' 
for
 # extensions which SHIP WITH MERCURIAL. Non-mainline extensions should
@@ -806,8 +806,7 @@ def email(ui, repo, *revs, **opts):
         if opts.get('test'):
             ui.status(_('displaying '), subj, ' ...\n')
             ui.pager('email')
-            generator = emailgen.Generator(_bytesgenerator(ui),
-                                           mangle_from_=False)
+            generator = _bytesgenerator(ui, mangle_from_=False)
             try:
                 generator.flatten(m, 0)
                 ui.write('\n')
@@ -823,8 +822,7 @@ def email(ui, repo, *revs, **opts):
                 # Exim does not remove the Bcc field
                 del m['Bcc']
             fp = stringio()
-            generator = emailgen.Generator(_bytesgenerator(fp),
-                                           mangle_from_=False)
+            generator = _bytesgenerator(fp, mangle_from_=False)
             generator.flatten(m, 0)
             alldests = to + bcc + cc
             alldests = [encoding.strfromlocal(d) for d in alldests]
_______________________________________________
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

Reply via email to