launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #27875
[Merge] ~cjwatson/launchpad:fix-bmp-resubmit into launchpad:master
Colin Watson has proposed merging ~cjwatson/launchpad:fix-bmp-resubmit into launchpad:master.
Commit message:
Fix BranchMergeProposal:+resubmit for status report changes
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/413614
It now needs to define `show_status_reports` for the Git case.
--
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:fix-bmp-resubmit into launchpad:master.
diff --git a/lib/lp/code/browser/tests/test_branchmergeproposal.py b/lib/lp/code/browser/tests/test_branchmergeproposal.py
index 979927c..a2d0bb3 100644
--- a/lib/lp/code/browser/tests/test_branchmergeproposal.py
+++ b/lib/lp/code/browser/tests/test_branchmergeproposal.py
@@ -1312,6 +1312,7 @@ class TestResubmitBrowserBzr(BrowserTestCase):
def test_resubmit_text(self):
"""The text of the resubmit page is as expected."""
bmp = self.factory.makeBranchMergeProposal(registrant=self.user)
+ self.factory.makeRevisionsForBranch(bmp.source_branch, count=2)
text = self.getMainText(bmp, '+resubmit')
expected = (
'Resubmit proposal to merge.*'
@@ -1325,6 +1326,7 @@ class TestResubmitBrowserBzr(BrowserTestCase):
def test_resubmit_controls(self):
"""Proposals can be resubmitted using the browser."""
bmp = self.factory.makeBranchMergeProposal(registrant=self.user)
+ self.factory.makeRevisionsForBranch(bmp.source_branch, count=2)
browser = self.getViewBrowser(bmp, '+resubmit')
browser.getControl('Description').value = 'flibble'
browser.getControl('Resubmit').click()
@@ -1337,9 +1339,30 @@ class TestResubmitBrowserGit(GitHostingClientMixin, BrowserTestCase):
layer = DatabaseFunctionalLayer
+ def makeCommits(self, count):
+ author = self.factory.makePerson()
+ with person_logged_in(author):
+ author_email = author.preferredemail.email
+ author_date = datetime(2015, 1, 1, tzinfo=pytz.UTC)
+ sha1s = [
+ hashlib.sha1(("commit %d" % i).encode()).hexdigest()
+ for i in range(count)]
+ self.git_hosting_fixture.getLog.result = [
+ {
+ "sha1": sha1,
+ "message": "commit message",
+ "author": {
+ "name": author.displayname,
+ "email": author_email,
+ "time": int(seconds_since_epoch(author_date)),
+ },
+ }
+ for sha1 in sha1s]
+
def test_resubmit_text(self):
"""The text of the resubmit page is as expected."""
bmp = self.factory.makeBranchMergeProposalForGit(registrant=self.user)
+ self.makeCommits(2)
text = self.getMainText(bmp, '+resubmit')
self.assertTextMatchesExpressionIgnoreWhitespace(r"""
Resubmit proposal to merge.*
@@ -1356,6 +1379,7 @@ class TestResubmitBrowserGit(GitHostingClientMixin, BrowserTestCase):
def test_resubmit_controls(self):
"""Proposals can be resubmitted using the browser."""
bmp = self.factory.makeBranchMergeProposalForGit(registrant=self.user)
+ self.makeCommits(2)
browser = self.getViewBrowser(bmp, '+resubmit')
browser.getControl('Commit message').value = 'dribble'
browser.getControl('Description').value = 'flibble'
diff --git a/lib/lp/code/templates/branchmergeproposal-resubmit.pt b/lib/lp/code/templates/branchmergeproposal-resubmit.pt
index 2ff187c..359ab37 100644
--- a/lib/lp/code/templates/branchmergeproposal-resubmit.pt
+++ b/lib/lp/code/templates/branchmergeproposal-resubmit.pt
@@ -40,7 +40,8 @@
</tal:bzr-revisions>
<tal:git-revisions condition="context/source_git_ref">
<tal:history-available define="ref context/source_git_ref;
- commit_infos view/unlanded_revisions"
+ commit_infos view/unlanded_revisions;
+ show_status_reports python:False"
condition="commit_infos">
<h2>Unmerged commits</h2>
<metal:commits use-macro="ref/@@+macros/ref-commits"/>
diff --git a/lib/lp/code/templates/git-macros.pt b/lib/lp/code/templates/git-macros.pt
index 836409d..e579ecb 100644
--- a/lib/lp/code/templates/git-macros.pt
+++ b/lib/lp/code/templates/git-macros.pt
@@ -137,6 +137,7 @@
ref - the ref that has the commits
commit_infos - a list of dicts of commit information (sha1, author,
author_date, commit_message, merge_proposal)
+ show_status_reports - whether to show related revision status reports
</tal:comment>
<style type="text/css">
.subordinate {
@@ -191,6 +192,7 @@
commit_info - a dict of the commit information (sha1, author,
author_date, commit_message, merge_proposal) to be
displayed
+ show_status_reports - whether to show related revision status reports
It is expected that this macro is called from within a definition list
(<dl></dl>).