Merge lp:~jteh/bzr-email/fix0difflimit into lp:bzr-email

Proposed by James Teh
Status: Merged
Approved by: Jelmer Vernooij
Approved revision: 42
Merged at revision: 43
Proposed branch: lp:~jteh/bzr-email/fix0difflimit
Merge into: lp:bzr-email
Diff against target: 50 lines (+14/-8)
2 files modified
__init__.py (+4/-4)
emailer.py (+10/-4)
To merge this branch: bzr merge lp:~jteh/bzr-email/fix0difflimit
Reviewer Review Type Date Requested Status
Robert Collins (community) Approve
Review via email: mp+20053@code.launchpad.net

Commit message

Gracefully handle (and clarify documentation about) difflimit being set to 0 to indicate that diffs should not be included.

To post a comment you must log in.
Revision history for this message
Robert Collins (lifeless) wrote :

 review: approve

review: Approve
Revision history for this message
Jelmer Vernooij (jelmer) wrote :

I'll merge this, as Rob has already approved it earlier.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file '__init__.py'
--- __init__.py 2008-12-09 20:09:15 +0000
+++ __init__.py 2010-02-24 12:41:16 +0000
@@ -22,10 +22,10 @@
22``post_commit_sender`` (if not supplied defaults to the email address reported22``post_commit_sender`` (if not supplied defaults to the email address reported
23by ``bzr whoami``).23by ``bzr whoami``).
2424
25By default, the diff for the commit will be included in the email, if the25By default, the diff for the commit will be included in the email if the
26length is less than 1000 lines. This limit can be changed (for instance, to 026length is less than 1000 lines. This limit can be changed by setting the
27to disable the feature) by setting the configuration option27configuration option 'post_commit_difflimit' to the number of lines you wish
28'post_commit_difflimit' to the number of lines you wish it to be limited to.28it to be limited to. Set it to 0 to unconditionally disable sending of diffs.
2929
30By default bzr-email only emails when a commit occurs, not when a push or30By default bzr-email only emails when a commit occurs, not when a push or
31pull operation occurs. To email on push or pull set post_commit_push_pull=True31pull operation occurs. To email on push or pull set post_commit_push_pull=True
3232
=== modified file 'emailer.py'
--- emailer.py 2008-12-09 20:09:15 +0000
+++ emailer.py 2010-02-24 12:41:16 +0000
@@ -195,7 +195,10 @@
195 process = subprocess.Popen(self._command_line(),195 process = subprocess.Popen(self._command_line(),
196 stdin=subprocess.PIPE)196 stdin=subprocess.PIPE)
197 try:197 try:
198 message = self.body().encode('utf8') + self.get_diff()198 message = self.body().encode('utf8')
199 diff = self.get_diff()
200 if diff:
201 message += diff
199 result = process.communicate(message)[0]202 result = process.communicate(message)[0]
200 if process.returncode is None:203 if process.returncode is None:
201 process.wait()204 process.wait()
@@ -227,9 +230,12 @@
227 to_addrs = [to_addrs]230 to_addrs = [to_addrs]
228231
229 smtp = self._smtplib_implementation(self.config)232 smtp = self._smtplib_implementation(self.config)
230 smtp.send_text_and_attachment_email(from_addr, to_addrs,233 if diff:
231 subject, body, diff,234 smtp.send_text_and_attachment_email(from_addr, to_addrs,
232 self.diff_filename())235 subject, body, diff,
236 self.diff_filename())
237 else:
238 smtp.send_text_email(from_addr, to_addrs, subject, body)
233239
234 def should_send(self):240 def should_send(self):
235 result = self.config.get_user_option('post_commit_difflimit')241 result = self.config.get_user_option('post_commit_difflimit')

Subscribers

People subscribed via source and target branches

to all changes: