launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #20336
[Merge] lp:~cjwatson/launchpad/branch-macros-generalise-codebrowse into lp:launchpad
Colin Watson has proposed merging lp:~cjwatson/launchpad/branch-macros-generalise-codebrowse into lp:launchpad.
Commit message:
Use Branch.getCodebrowseUrlForRevision rather than composing the same URL directly.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/branch-macros-generalise-codebrowse/+merge/294060
Use Branch.getCodebrowseUrlForRevision rather than composing the same URL directly. As well as requiring fewer lines of code, this prepares for extending branch-revisions support to Git.
While I was in the area, I removed a now-unreferenced template which I apparently missed in r17439.
--
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~cjwatson/launchpad/branch-macros-generalise-codebrowse into lp:launchpad.
=== modified file 'lib/lp/code/browser/branch.py'
--- lib/lp/code/browser/branch.py 2016-02-04 04:39:30 +0000
+++ lib/lp/code/browser/branch.py 2016-05-07 00:52:41 +0000
@@ -1,4 +1,4 @@
-# Copyright 2009-2015 Canonical Ltd. This software is licensed under the
+# Copyright 2009-2016 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
"""Branch views."""
@@ -468,11 +468,6 @@
return self.context.control_format is None
@property
- def codebrowse_url(self):
- """Return the link to codebrowse for this branch."""
- return self.context.getCodebrowseUrl()
-
- @property
def pending_writes(self):
"""Whether or not there are pending writes for this branch."""
return self.context.pending_writes
=== modified file 'lib/lp/code/browser/branchmergeproposal.py'
--- lib/lp/code/browser/branchmergeproposal.py 2015-10-04 01:28:19 +0000
+++ lib/lp/code/browser/branchmergeproposal.py 2016-05-07 00:52:41 +0000
@@ -1,4 +1,4 @@
-# Copyright 2009-2015 Canonical Ltd. This software is licensed under the
+# Copyright 2009-2016 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
"""Views, navigation and actions for BranchMergeProposals."""
@@ -350,11 +350,6 @@
"""Needed to make the branch-revisions metal macro work."""
return False
- @property
- def codebrowse_url(self):
- """Return the link to codebrowse for this branch."""
- return self.context.merge_source.getCodebrowseUrl()
-
class BranchMergeProposalRevisionIdMixin:
"""A mixin class to provide access to the revision ids."""
@@ -564,15 +559,6 @@
pass
-class CodeReviewNewRevisionsView(LaunchpadView):
- """The view for rendering the new revisions."""
-
- @property
- def codebrowse_url(self):
- """Return the link to codebrowse for this branch."""
- return self.context.branch.getCodebrowseUrl()
-
-
@implementer(IBranchMergeProposalActionMenu)
class BranchMergeProposalView(LaunchpadFormView, UnmergedRevisionsMixin,
BranchMergeProposalRevisionIdMixin,
=== modified file 'lib/lp/code/browser/configure.zcml'
--- lib/lp/code/browser/configure.zcml 2016-01-12 15:27:50 +0000
+++ lib/lp/code/browser/configure.zcml 2016-05-07 00:52:41 +0000
@@ -566,7 +566,7 @@
<browser:pages
for="lp.code.browser.branchmergeproposal.ICodeReviewNewRevisions"
- class="lp.code.browser.branchmergeproposal.CodeReviewNewRevisionsView"
+ class="lp.services.webapp.LaunchpadView"
permission="zope.Public">
<browser:page
name="+comment-header"
=== modified file 'lib/lp/code/feed/templates/branch.pt'
--- lib/lp/code/feed/templates/branch.pt 2015-04-22 12:03:05 +0000
+++ lib/lp/code/feed/templates/branch.pt 2016-05-07 00:52:41 +0000
@@ -32,7 +32,7 @@
has no whitespace between the elements as we do not want any
space between the number and the fullstop.
</tal:comment>
- <a tal:attributes="href string:${context/getCodebrowseUrl}/revision/${rev_no/sequence}"
+ <a tal:attributes="href python: context.getCodebrowseUrlForRevision(rev_no.sequence)"
tal:content="rev_no/sequence"
tal:condition="context/code_is_browseable">
1
=== modified file 'lib/lp/code/templates/branch-macros.pt'
--- lib/lp/code/templates/branch-macros.pt 2015-09-10 08:47:06 +0000
+++ lib/lp/code/templates/branch-macros.pt 2016-05-07 00:52:41 +0000
@@ -188,7 +188,6 @@
<dl class="revision">
<!-- Display the extended revision listing -->
<tal:revision repeat="rev_info revision_info"
- define="codebrowse view/codebrowse_url"
condition="revision_info | nothing">
<div tal:define="rev_no python:rev_info['revision']">
<metal:landing-target use-macro="branch/@@+macros/revision-text"/>
@@ -196,7 +195,6 @@
</tal:revision>
<!-- Display the standard revision listing -->
<tal:revision repeat="rev_no revisions"
- define="codebrowse view/codebrowse_url"
condition="revisions | nothing">
<metal:landing-target use-macro="branch/@@+macros/revision-text"/>
</tal:revision>
@@ -229,7 +227,6 @@
or
rev_info - a dict of the branch revision information (revision,
merge_proposal, linked_bugtasks) to be displayed.
- codebrowse - the branch's codebrowse root.
It is expected that this macro is called from within a definition
list (<dl></dl>)
@@ -240,7 +237,7 @@
has no whitespace between the elements as we do not want any
space between the number and the fullstop.
</tal:comment>
- <a tal:attributes="href string:${codebrowse}/revision/${rev_no/sequence}"
+ <a tal:attributes="href python: branch.getCodebrowseUrlForRevision(rev_no.sequence)"
tal:content="rev_no/sequence"
tal:condition="rev_no/branch/code_is_browseable">
1
=== removed file 'lib/lp/code/templates/branchmergeproposal-enqueue.pt'
--- lib/lp/code/templates/branchmergeproposal-enqueue.pt 2011-03-04 00:39:17 +0000
+++ lib/lp/code/templates/branchmergeproposal-enqueue.pt 1970-01-01 00:00:00 +0000
@@ -1,33 +0,0 @@
-<html
- xmlns="http://www.w3.org/1999/xhtml"
- xmlns:tal="http://xml.zope.org/namespaces/tal"
- xmlns:metal="http://xml.zope.org/namespaces/metal"
- xmlns:i18n="http://xml.zope.org/namespaces/i18n"
- metal:use-macro="view/macro:page/main_only"
- i18n:domain="launchpad">
-
-<body>
-
-<div metal:fill-slot="main">
-
- <div metal:use-macro="context/@@launchpad_form/form">
- </div>
-
- <div id="source-revisions" style="clear: both">
- <h2>Unmerged revisions</h2>
-
- <tal:history-available condition="context/source_branch/revision_count"
- define="branch context/source_branch;
- revisions view/unlanded_revisions">
- <metal:landing-target use-macro="branch/@@+macros/branch-revisions"/>
- </tal:history-available>
-
- <tal:remote-branch condition="context/source_branch/branch_type/enumvalue:REMOTE">
- <p>Recent revisions are not available due to the source branch being remote.</p>
- </tal:remote-branch>
- </div>
-
-</div>
-
-</body>
-</html>
Follow ups