/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to breezy/plugins/email/emailer.py

  • Committer: Gustav Hartvigsson
  • Date: 2021-01-09 21:36:27 UTC
  • Revision ID: gustav.hartvigsson@gmail.com-20210109213627-h1xwcutzy9m7a99b
Added 'Case Preserving Working Tree Use Cases' from Canonical Wiki

* Addod a page from the Canonical Bazaar wiki
  with information on the scmeatics of case
  perserving filesystems an a case insensitive
  filesystem works.
  
  * Needs re-work, but this will do as it is the
    same inforamoton as what was on the linked
    page in the currint documentation.

Show diffs side-by-side

added added

removed removed

Lines of Context:
14
14
# along with this program; if not, write to the Free Software
15
15
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
16
16
 
17
 
from __future__ import absolute_import
18
 
 
19
17
import subprocess
20
18
import tempfile
21
19
 
80
78
 
81
79
        # We must use StringIO.StringIO because we want a Unicode string that
82
80
        # we can pass to send_email and have that do the proper encoding.
83
 
        from ...sixish import StringIO
 
81
        from io import StringIO
84
82
        outf = StringIO()
85
83
 
86
84
        _body = self.config.get('post_commit_body')
137
135
 
138
136
        # We can use a StringIO because show_diff_trees should only write
139
137
        # 8-bit strings. It is an error to write a Unicode string here.
140
 
        from ...sixish import StringIO
 
138
        from io import StringIO
141
139
        diff_content = StringIO()
142
140
        diff_options = self.config.get('post_commit_diffoptions')
143
141
        show_diff_trees(tree_old, tree_new, diff_content, None, diff_options)
213
211
        """Spawn a 'mail' subprocess to send the email."""
214
212
        # TODO think up a good test for this, but I think it needs
215
213
        # a custom binary shipped with. RBC 20051021
216
 
        msgfile = tempfile.NamedTemporaryFile()
217
 
        try:
 
214
        with tempfile.NamedTemporaryFile() as msgfile:
218
215
            msgfile.write(self.body().encode('utf8'))
219
216
            diff = self.get_diff()
220
217
            if diff:
229
226
            if rc != 0:
230
227
                raise errors.BzrError(
231
228
                    "Failed to send email: exit status %s" % (rc,))
232
 
        finally:
233
 
            msgfile.close()
234
229
 
235
230
    def _send_using_smtplib(self):
236
231
        """Use python's smtplib to send the email."""