← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~wallyworld/launchpad/mp-commit-message-1017293 into lp:launchpad

 

Ian Booth has proposed merging lp:~wallyworld/launchpad/mp-commit-message-1017293 into lp:launchpad.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)
Related bugs:
  Bug #1017293 in Launchpad itself: "Commit message is not shown on the initial merge proposal email"
  https://bugs.launchpad.net/launchpad/+bug/1017293

For more details, see:
https://code.launchpad.net/~wallyworld/launchpad/mp-commit-message-1017293/+merge/124841

== Implementation ==

Add the commit message to the initial bmp email. If no commit message is specified, use "None specified."

== Tests == 

Update and add a new test to the branch merge proposal mail tests.


== Lint ==

Checking for conflicts and issues in changed files.

Linting changed files:
  lib/lp/code/emailtemplates/branch-merge-proposal-created.txt
  lib/lp/code/mail/branchmergeproposal.py
  lib/lp/code/mail/tests/test_branchmergeproposal.py

-- 
https://code.launchpad.net/~wallyworld/launchpad/mp-commit-message-1017293/+merge/124841
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~wallyworld/launchpad/mp-commit-message-1017293 into lp:launchpad.
=== modified file 'lib/lp/code/emailtemplates/branch-merge-proposal-created.txt'
--- lib/lp/code/emailtemplates/branch-merge-proposal-created.txt	2011-12-18 22:31:46 +0000
+++ lib/lp/code/emailtemplates/branch-merge-proposal-created.txt	2012-09-18 04:37:21 +0000
@@ -1,5 +1,8 @@
 %(proposal_registrant)s has proposed merging %(source_branch)s into %(target_branch)s%(prerequisite)s.
 
+Commit message:
+%(commit_message)s
+
 %(reviews)s%(related_bugtasks)s
 For more details, see:
 %(proposal_url)s%(gap)s%(comment)s

=== modified file 'lib/lp/code/mail/branchmergeproposal.py'
--- lib/lp/code/mail/branchmergeproposal.py	2012-01-01 02:58:52 +0000
+++ lib/lp/code/mail/branchmergeproposal.py	2012-09-18 04:37:21 +0000
@@ -141,6 +141,7 @@
             'proposal_registrant': proposal.registrant.displayname,
             'source_branch': proposal.source_branch.bzr_identity,
             'target_branch': proposal.target_branch.bzr_identity,
+            'commit_message': proposal.commit_message or 'None specified.',
             'prerequisite': '',
             'proposal_title': proposal.title,
             'proposal_url': canonical_url(proposal),

=== modified file 'lib/lp/code/mail/tests/test_branchmergeproposal.py'
--- lib/lp/code/mail/tests/test_branchmergeproposal.py	2012-07-02 20:07:06 +0000
+++ lib/lp/code/mail/tests/test_branchmergeproposal.py	2012-09-18 04:37:21 +0000
@@ -92,6 +92,7 @@
         bmp.source_branch.name = 'fix-foo-for-bar'
         bmp.target_branch.owner.name = 'mary'
         bmp.target_branch.name = 'bar'
+        bmp.commit_message = 'commit message'
         # Call the function that is normally called through the event system
         # to auto reload the fields updated by the db triggers.
         update_trigger_modified_fields(bmp.source_branch)
@@ -112,6 +113,9 @@
         expected = dedent("""\
         Baz Qux has proposed merging %(source)s into %(target)s.
 
+        Commit message:
+        %(commit_message)s
+
         Requested reviews:
           %(reviewer)s
 
@@ -123,6 +127,7 @@
         """) % {
             'source': bmp.source_branch.bzr_identity,
             'target': bmp.target_branch.bzr_identity,
+            'commit_message': bmp.commit_message,
             'reviewer': reviewer.unique_displayname,
             'bmp': canonical_url(bmp),
             'reason': reason.getReason()}
@@ -143,6 +148,17 @@
         self.assertEqual(set([reviewer_id, bmp.address]), set(ctrl.to_addrs))
         mailer.sendAll()
 
+    def test_forCreation_without_commit_message(self):
+        """If there is no commit message, email should say 'None Specified.'"""
+        bmp, subscriber = self.makeProposalWithSubscriber()
+        bmp.commit_message = None
+        mailer = BMPMailer.forCreation(bmp, bmp.registrant)
+        ctrl = mailer.generateEmail('baz.quxx@xxxxxxxxxxx', subscriber)
+        expected = (
+            'Commit message:\n'
+            'None specified.\n')
+        self.assertIn(expected, ctrl.body)
+
     def test_forCreation_with_bugs(self):
         """If there are related bugs, include 'Related bugs'."""
         bmp, subscriber = self.makeProposalWithSubscriber()


Follow ups