← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~cjwatson/launchpad/branch-codebrowse-url into lp:launchpad

 

Colin Watson has proposed merging lp:~cjwatson/launchpad/branch-codebrowse-url into lp:launchpad.

Commit message:
Rename the Branch.codebrowse_url method to Branch.getCodebrowseUrl, to comply with LP style and harmonise with GitRepository.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/branch-codebrowse-url/+merge/257063

I originally copied the codebrowse_url method name from Branch to GitRepository, despite it not complying with Launchpad style for method names.  William asked me to change it in https://code.launchpad.net/~cjwatson/launchpad/git-basic-model/+merge/248976.  That was fine, but now it means that I need to cope with both names in the merge proposal code; it would be easier if they were the same.  This brings Branch into line with the newer form.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~cjwatson/launchpad/branch-codebrowse-url into lp:launchpad.
=== modified file 'lib/lp/code/browser/branch.py'
--- lib/lp/code/browser/branch.py	2015-04-21 16:53:45 +0000
+++ lib/lp/code/browser/branch.py	2015-04-22 12:11:06 +0000
@@ -295,7 +295,7 @@
         """Return a link to the branch's revisions on codebrowse."""
         text = 'All revisions'
         enabled = self.context.code_is_browseable
-        url = self.context.codebrowse_url('changes')
+        url = self.context.getCodebrowseUrl('changes')
         return Link(url, text, enabled=enabled)
 
     @enabled_with_permission('launchpad.AnyPerson')
@@ -344,7 +344,7 @@
         """Return a link to the branch's file listing on codebrowse."""
         text = 'Browse the code'
         enabled = self.context.code_is_browseable
-        url = self.context.codebrowse_url('files')
+        url = self.context.getCodebrowseUrl('files')
         return Link(url, text, icon='info', enabled=enabled)
 
     def edit_import(self):
@@ -466,7 +466,7 @@
     @property
     def codebrowse_url(self):
         """Return the link to codebrowse for this branch."""
-        return self.context.codebrowse_url()
+        return self.context.getCodebrowseUrl()
 
     @property
     def pending_writes(self):

=== modified file 'lib/lp/code/browser/branchlisting.py'
--- lib/lp/code/browser/branchlisting.py	2015-04-19 12:56:32 +0000
+++ lib/lp/code/browser/branchlisting.py	2015-04-22 12:11:06 +0000
@@ -208,7 +208,7 @@
 
     @property
     def revision_codebrowse_link(self):
-        return self.context.codebrowse_url(
+        return self.context.getCodebrowseUrl(
             'revision', str(self.context.revision_count))
 
     def __repr__(self):

=== modified file 'lib/lp/code/browser/branchmergeproposal.py'
--- lib/lp/code/browser/branchmergeproposal.py	2015-04-22 12:06:22 +0000
+++ lib/lp/code/browser/branchmergeproposal.py	2015-04-22 12:11:06 +0000
@@ -355,7 +355,7 @@
     @property
     def codebrowse_url(self):
         """Return the link to codebrowse for this branch."""
-        return self.context.source_branch.codebrowse_url()
+        return self.context.source_branch.getCodebrowseUrl()
 
 
 class BranchMergeProposalRevisionIdMixin:
@@ -570,7 +570,7 @@
     @property
     def codebrowse_url(self):
         """Return the link to codebrowse for this branch."""
-        return self.context.branch.codebrowse_url()
+        return self.context.branch.getCodebrowseUrl()
 
 
 class BranchMergeProposalView(LaunchpadFormView, UnmergedRevisionsMixin,

=== modified file 'lib/lp/code/feed/branch.py'
--- lib/lp/code/feed/branch.py	2015-01-28 16:38:13 +0000
+++ lib/lp/code/feed/branch.py	2015-04-22 12:11:06 +0000
@@ -445,7 +445,7 @@
     def itemToFeedEntry(self, rev):
         """See `IFeed`."""
         title = FeedTypedData("Revision %d" % rev.sequence)
-        url = self.context.codebrowse_url('revision', str(rev.sequence))
+        url = self.context.getCodebrowseUrl('revision', str(rev.sequence))
         content_view = BranchFeedContentView(rev, self.request, self,
                                              'templates/branch-revision.pt')
         content = FeedTypedData(content=content_view.render(),

=== modified file 'lib/lp/code/feed/templates/branch.pt'
--- lib/lp/code/feed/templates/branch.pt	2009-07-17 17:59:07 +0000
+++ lib/lp/code/feed/templates/branch.pt	2015-04-22 12:11:06 +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/codebrowse_url}/revision/${rev_no/sequence}"
+        <a tal:attributes="href string:${context/getCodebrowseUrl}/revision/${rev_no/sequence}"
            tal:content="rev_no/sequence"
            tal:condition="context/code_is_browseable">
           1

=== modified file 'lib/lp/code/interfaces/branch.py'
--- lib/lp/code/interfaces/branch.py	2015-04-22 12:06:22 +0000
+++ lib/lp/code/interfaces/branch.py	2015-04-22 12:11:06 +0000
@@ -678,7 +678,7 @@
     code_is_browseable = Attribute(
         "Is the code in this branch accessable through codebrowse?")
 
-    def codebrowse_url(*extras):
+    def getCodebrowseUrl(*extras):
         """Construct a URL for this branch in codebrowse.
 
         :param extras: Zero or more path segments that will be joined onto the

=== modified file 'lib/lp/code/model/branch.py'
--- lib/lp/code/model/branch.py	2015-04-21 16:53:45 +0000
+++ lib/lp/code/model/branch.py	2015-04-22 12:11:06 +0000
@@ -646,7 +646,7 @@
         """See `IBranch`."""
         return (self.revision_count > 0 or self.last_mirrored != None)
 
-    def codebrowse_url(self, *extras):
+    def getCodebrowseUrl(self, *extras):
         """See `IBranch`."""
         if self.private:
             root = config.codehosting.secure_codebrowse_root
@@ -656,7 +656,7 @@
 
     @property
     def browse_source_url(self):
-        return self.codebrowse_url('files')
+        return self.getCodebrowseUrl('files')
 
     def composePublicURL(self, scheme='http'):
         """See `IBranch`."""

=== modified file 'lib/lp/code/model/tests/test_branch.py'
--- lib/lp/code/model/tests/test_branch.py	2015-04-19 12:56:32 +0000
+++ lib/lp/code/model/tests/test_branch.py	2015-04-22 12:11:06 +0000
@@ -2223,7 +2223,7 @@
         branch = self.factory.makeAnyBranch()
         self.assertEqual(
             'http://bazaar.launchpad.dev/' + branch.unique_name,
-            branch.codebrowse_url())
+            branch.getCodebrowseUrl())
 
     def test_private(self):
         # The codebrowse URL for a private branch is a 'https' url.
@@ -2233,21 +2233,21 @@
         login_person(owner)
         self.assertEqual(
             'https://bazaar.launchpad.dev/' + branch.unique_name,
-            branch.codebrowse_url())
+            branch.getCodebrowseUrl())
 
     def test_extra_args(self):
-        # Any arguments to codebrowse_url are appended to the URL.
+        # Any arguments to getCodebrowseUrl are appended to the URL.
         branch = self.factory.makeAnyBranch()
         self.assertEqual(
             'http://bazaar.launchpad.dev/' + branch.unique_name + '/a/b',
-            branch.codebrowse_url('a', 'b'))
+            branch.getCodebrowseUrl('a', 'b'))
 
     def test_source_code_url(self):
         # The source code URL points to the codebrowse URL where you can
         # actually browse the source code.
         branch = self.factory.makeAnyBranch()
         self.assertEqual(
-            branch.browse_source_url, branch.codebrowse_url('files'))
+            branch.browse_source_url, branch.getCodebrowseUrl('files'))
 
     def test_no_revisions_not_browseable(self):
         # A branch with no revisions is not browseable.

=== modified file 'lib/lp/code/model/tests/test_branchcollection.py'
--- lib/lp/code/model/tests/test_branchcollection.py	2015-01-29 16:28:30 +0000
+++ lib/lp/code/model/tests/test_branchcollection.py	2015-04-22 12:11:06 +0000
@@ -1165,7 +1165,7 @@
         # branch with that URL, then you get a single result with that branch.
         branch = self.factory.makeAnyBranch()
         self.factory.makeAnyBranch()
-        search_results = self.collection.search(branch.codebrowse_url())
+        search_results = self.collection.search(branch.getCodebrowseUrl())
         self.assertEqual([branch], list(search_results))
 
     def test_exact_match_with_lp_colon_url(self):
@@ -1224,7 +1224,8 @@
         # queries. Rather bravely, we refuse to explode in this case.
         branch = self.factory.makeAnyBranch()
         self.factory.makeAnyBranch()
-        search_results = self.collection.search(branch.codebrowse_url() + '/')
+        search_results = self.collection.search(
+            branch.getCodebrowseUrl() + '/')
         self.assertEqual([branch], list(search_results))
 
     def test_match_exact_branch_name(self):


Follow ups