← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] ~lgp171188/launchpad:remove-codebrowse-links-for-bzr-branches into launchpad:master

 

Guruprasad has proposed merging ~lgp171188/launchpad:remove-codebrowse-links-for-bzr-branches into launchpad:master.

Commit message:
Remove the codebrowse links for bzr branches

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~lgp171188/launchpad/+git/launchpad/+merge/487188
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of ~lgp171188/launchpad:remove-codebrowse-links-for-bzr-branches into launchpad:master.
diff --git a/lib/lp/code/browser/tests/test_branch.py b/lib/lp/code/browser/tests/test_branch.py
index c658936..4384ad8 100644
--- a/lib/lp/code/browser/tests/test_branch.py
+++ b/lib/lp/code/browser/tests/test_branch.py
@@ -605,10 +605,10 @@ class TestBranchView(BrowserTestCase):
         self.assertTextMatchesExpressionIgnoreWhitespace(expected_text, text)
 
         links = revision_content.find_all("a")
-        self.assertEqual(mp_url, links[2]["href"])
-        self.assertEqual(branch_url, links[3]["href"])
-        self.assertEqual(linked_bug_urls[0], links[4]["href"])
-        self.assertEqual(linked_bug_urls[1], links[5]["href"])
+        self.assertEqual(mp_url, links[0]["href"])
+        self.assertEqual(branch_url, links[1]["href"])
+        self.assertEqual(linked_bug_urls[0], links[2]["href"])
+        self.assertEqual(linked_bug_urls[1], links[3]["href"])
 
     def test_view_for_user_with_artifact_grant(self):
         # Users with an artifact grant for a branch related to a private
diff --git a/lib/lp/code/browser/tests/test_product.py b/lib/lp/code/browser/tests/test_product.py
index 864f3bf..6520421 100644
--- a/lib/lp/code/browser/tests/test_product.py
+++ b/lib/lp/code/browser/tests/test_product.py
@@ -66,12 +66,12 @@ class TestProductBranchesView(ProductTestBase):
         else:
             self.fail("Browse link present when it should not have been.")
 
-    def test_browsable_branch_has_link(self):
-        # If the product's development focus branch is browsable, there is a
-        # 'browse code' link.
+    def test_branch_is_not_browsable_and_has_no_link(self):
+        # If the product has a development focus branch, it is no
+        # browsable, abd there is no 'browse code' link.
         product, branch = self.makeProductAndDevelopmentFocusBranch()
         branch.updateScannedDetails(self.factory.makeRevision(), 1)
-        self.assertTrue(branch.code_is_browsable)
+        self.assertFalse(branch.code_is_browsable)
 
         link = self.getBranchSummaryBrowseLinkForProduct(product)
         login(ANONYMOUS)
diff --git a/lib/lp/code/model/branch.py b/lib/lp/code/model/branch.py
index ab07555..44453e6 100644
--- a/lib/lp/code/model/branch.py
+++ b/lib/lp/code/model/branch.py
@@ -841,7 +841,7 @@ class Branch(StormBase, WebhookTargetMixin, BzrIdentityMixin):
     @property
     def code_is_browsable(self):
         """See `IBranch`."""
-        return self.revision_count > 0 or self.last_mirrored != None
+        return False
 
     def getCodebrowseUrl(self, *extras):
         """See `IBranch`."""
diff --git a/lib/lp/code/model/tests/test_branch.py b/lib/lp/code/model/tests/test_branch.py
index 7930891..91a98f2 100644
--- a/lib/lp/code/model/tests/test_branch.py
+++ b/lib/lp/code/model/tests/test_branch.py
@@ -2595,16 +2595,14 @@ class TestCodebrowse(TestCaseWithFactory):
             branch.browse_source_url, branch.getCodebrowseUrl("files")
         )
 
-    def test_no_revisions_not_browsable(self):
-        # A branch with no revisions is not browsable.
+    def test_not_browsable(self):
+        # For the upcoming decommissioning of bzr codehosting on
+        # Launchpad, we are disabling the codebrowse feature. So
+        # code is always not browsable.
         branch = self.factory.makeBranch()
         self.assertFalse(branch.code_is_browsable)
-
-    def test_revisions_means_browsable(self):
-        # A branch that has revisions is browsable.
-        branch = self.factory.makeBranch()
         self.factory.makeRevisionsForBranch(branch, count=5)
-        self.assertTrue(branch.code_is_browsable)
+        self.assertFalse(branch.code_is_browsable)
 
 
 class TestBranchNamespace(TestCaseWithFactory):
diff --git a/lib/lp/code/stories/branches/xx-branch-index.rst b/lib/lp/code/stories/branches/xx-branch-index.rst
index bdab297..7e7530d 100644
--- a/lib/lp/code/stories/branches/xx-branch-index.rst
+++ b/lib/lp/code/stories/branches/xx-branch-index.rst
@@ -89,13 +89,14 @@ than the text of the revision author.
     2. By Eric on 2007-01-02
     1. By Eric on 2007-01-01
 
-Each of the revision numbers are anchors to codebrowse.
+Each of the revision numbers are no longer anchors to codebrowse and
+link to the user's profile instead.
 
     >>> revision = find_tags_by_class(
     ...     user_browser.contents, "revision-details", only_first=True
     ... )
     >>> print(revision.a)
-    <a href="https://bazaar.launchpad.test/~eric/fooix/trunk/revision/5";>5</a>
+    <a class="sprite person" href="http://launchpad.test/~eric";>Eric</a>
 
 
 Commit messages
@@ -218,7 +219,6 @@ the URL for the branch's canonical location.
     >>> print(extract_text(get_branch_management_portlet()))
     Only Sample Person can upload to this branch.
     If you are Sample Person please log in for upload directions.
-    Browse the code
 
 For mirrored branches, the table has a link to the branch's project, the
 location of the original branch, the mirror on Launchpad, information
@@ -308,7 +308,9 @@ If next_mirror_time is NULL, then mirroring of the branch is disabled.
 Codebrowse link
 ---------------
 
-The codebrowse link only appears for branches that have revisions.
+The codebrowse link does not appear for bzr branches because we are
+shutting down loggerhead as a part of the upcoming bzr codehosting
+decommissioning.
 
     >>> browser.open(
     ...     "http://code.launchpad.test/~name12/gnome-terminal/scanned";
@@ -324,7 +326,9 @@ view in codebrowse.
 
     >>> browser.open("http://code.launchpad.test/~name12/+junk/junk.dev";)
     >>> print(browser.getLink("All revisions").url)
-    https://bazaar.launchpad.test/~name12/+junk/junk.dev/changes
+    Traceback (most recent call last):
+    ...
+    zope.testbrowser.browser.LinkNotFoundError
 
 If the branch is private, the browse code link is not shown. In order to
 see the private branch, we need to log in as a user that is able to see