← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~wgrant/launchpad/productset-branches into lp:launchpad

 

William Grant has proposed merging lp:~wgrant/launchpad/productset-branches into lp:launchpad.

Commit message:
Rename {Product,DistributionSourcePackage}:+branches to +all-branches and +code-index to +branches, unifying default vhost view names.

Requested reviews:
  William Grant (wgrant): code

For more details, see:
https://code.launchpad.net/~wgrant/launchpad/productset-branches/+merge/208067

Once we flatten the vhosts into launchpad.net, the https://code.launchpad.net/FOO shortcut will be gone. So we want some consistency with view names, to keep URLs sensibly guessable: code.launchpad.net is +branches, bugs.launchpad.net is +bugs, etc. This is true today except for two exceptions: Product and DistributionSourcePackage have custom default views named +code-index.

This branch renames {Product,DistributionSourcePackage}:+branches to +all-branches, and +code-index to +branches, leaving all the CodeLayer defaults set to either +index or +branches.
-- 
https://code.launchpad.net/~wgrant/launchpad/productset-branches/+merge/208067
Your team Launchpad code reviewers is subscribed to branch lp:launchpad.
=== modified file 'lib/lp/code/browser/branchlisting.py'
--- lib/lp/code/browser/branchlisting.py	2014-02-19 00:35:25 +0000
+++ lib/lp/code/browser/branchlisting.py	2014-02-25 06:49:33 +0000
@@ -1027,7 +1027,6 @@
     usedfor = IProduct
     facet = 'branches'
     links = [
-        'list_branches',
         'active_reviews',
         'code_import',
         ]
@@ -1035,11 +1034,6 @@
         'active_review_count',
         ]
 
-    def list_branches(self):
-        text = 'List branches'
-        summary = 'List the branches for this project'
-        return Link('+branches', text, summary, icon='add', site='code')
-
     @cachedproperty
     def active_review_count(self):
         """Return the number of active reviews for the user."""
@@ -1133,7 +1127,7 @@
 
     @property
     def form_action(self):
-        return "+branches"
+        return "+all-branches"
 
     @property
     def initial_values(self):

=== modified file 'lib/lp/code/browser/configure.zcml'
--- lib/lp/code/browser/configure.zcml	2014-02-24 06:50:46 +0000
+++ lib/lp/code/browser/configure.zcml	2014-02-25 06:49:33 +0000
@@ -29,10 +29,10 @@
   <browser:defaultView
       for="lp.registry.interfaces.product.IProductSet"
       layer="lp.code.publisher.CodeLayer"
-      name="+project-cloud"/>
+      name="+branches"/>
   <browser:page
       for="lp.registry.interfaces.product.IProductSet"
-      name="+project-cloud"
+      name="+branches"
       class="lp.code.browser.bazaar.BazaarProductView"
       template="../templates/code-in-branches.pt"
       permission="zope.Public"
@@ -692,13 +692,13 @@
         for="lp.registry.interfaces.distributionsourcepackage.IDistributionSourcePackage"
         class="lp.code.browser.branchlisting.DistributionSourcePackageBranchesView"
         permission="zope.Public"
-        name="+branches"
+        name="+all-branches"
         template="../templates/generic-branch-listing.pt"/>
     <browser:page
         for="lp.registry.interfaces.distributionsourcepackage.IDistributionSourcePackage"
         class="lp.code.browser.branchlisting.GroupedDistributionSourcePackageBranchesView"
         permission="zope.Public"
-        name="+code-index"
+        name="+branches"
         template="../templates/distributionsourcepackage-branches-grouped.pt"/>
     <browser:page
         for="lp.registry.interfaces.distributionsourcepackage.IDistributionSourcePackage"
@@ -774,13 +774,13 @@
         for="lp.registry.interfaces.product.IProduct"
         class="lp.code.browser.branchlisting.ProductBranchesView"
         permission="zope.Public"
-        name="+branches"
+        name="+all-branches"
         template="../templates/product-branches.pt"/>
     <browser:page
         for="lp.registry.interfaces.product.IProduct"
         class="lp.code.browser.branchlisting.ProductCodeIndexView"
         permission="zope.Public"
-        name="+code-index"
+        name="+branches"
         template="../templates/product-branches.pt"/>
    <browser:page
       for="lp.registry.interfaces.product.IProduct"
@@ -813,7 +813,7 @@
     <browser:defaultView
         for="lp.registry.interfaces.distributionsourcepackage.IDistributionSourcePackage"
         layer="lp.code.publisher.CodeLayer"
-        name="+code-index"/>
+        name="+branches"/>
 
     <browser:defaultView
         for="lp.registry.interfaces.distribution.IDistribution"

=== modified file 'lib/lp/code/browser/tests/test_branchlisting.py'
--- lib/lp/code/browser/tests/test_branchlisting.py	2014-01-30 15:04:06 +0000
+++ lib/lp/code/browser/tests/test_branchlisting.py	2014-02-25 06:49:33 +0000
@@ -133,28 +133,30 @@
 
 
 class AjaxBatchNavigationMixin:
-    def _test_search_batch_request(self, context, user=None):
+    def _test_search_batch_request(self, context, user=None,
+                                   view_name='+branches'):
         # A search request with a 'batch_request' query parameter causes the
         # view to just render the next batch of results.
         view = create_initialized_view(
-            context, name="+branches", rootsite='code',
+            context, name=view_name, rootsite='code',
             principal=user, query_string='batch_request=True')
         content = view()
         self.assertIsNone(find_main_content(content))
         self.assertIsNotNone(
             find_tag_by_id(content, 'branches-table-listing'))
 
-    def _test_ajax_batch_navigation_feature_flag(self, context, user=None):
+    def _test_ajax_batch_navigation_feature_flag(self, context, user=None,
+                                                 view_name='+branches'):
         # The Javascript to wire up the ajax batch navigation behaviour is
         # correctly hidden behind a feature flag.
         flags = {u"ajax.batch_navigator.enabled": u"true"}
         with FeatureFixture(flags):
             view = create_initialized_view(
-                context, name="+branches", rootsite='code', principal=user)
+                context, name=view_name, rootsite='code', principal=user)
             self.assertTrue(
                 'Y.lp.app.batchnavigator.BatchNavigatorHooks' in view())
         view = create_initialized_view(
-            context, name="+branches", rootsite='code', principal=user)
+            context, name=view_name, rootsite='code', principal=user)
         self.assertFalse(
             'Y.lp.app.batchnavigator.BatchNavigatorHooks' in view())
 
@@ -610,8 +612,7 @@
         dsp = source_package.distribution.getSourcePackage(
             source_package.sourcepackagename)
         branch = self.factory.makeBranch(sourcepackage=source_package)
-        view = create_initialized_view(
-            dsp, name='+code-index', rootsite='code')
+        view = create_initialized_view(dsp, name='+branches', rootsite='code')
         root = html.fromstring(view())
         [series_branches_table] = root.cssselect("table#series-branches")
         series_branches_last_row = series_branches_table.cssselect("tr")[-1]
@@ -725,7 +726,7 @@
     def test_branch_listing_last_modified(self):
         branch = self.factory.makeProductBranch()
         view = create_initialized_view(
-            branch.product, name="+branches", rootsite='code')
+            branch.product, name="+all-branches", rootsite='code')
         self.assertIn('a moment ago', view())
 
     def test_no_branch_message_escaped(self):
@@ -777,7 +778,7 @@
         # A search request with a 'batch_request' query parameter causes the
         # view to just render the next batch of results.
         product = self.factory.makeProduct(project=self.project)
-        self._test_search_batch_request(product)
+        self._test_search_batch_request(product, view_name='+all-branches')
 
     def test_ajax_batch_navigation_feature_flag(self):
         # The Javascript to wire up the ajax batch navigation behaviour is
@@ -785,7 +786,8 @@
         product = self.factory.makeProduct(project=self.project)
         for i in range(10):
             self.factory.makeProductBranch(product=product)
-        self._test_ajax_batch_navigation_feature_flag(product)
+        self._test_ajax_batch_navigation_feature_flag(
+            product, view_name='+all-branches')
 
     def test_non_batch_template(self):
         # The correct template is used for non batch requests.

=== modified file 'lib/lp/code/browser/tests/test_product.py'
--- lib/lp/code/browser/tests/test_product.py	2014-02-19 04:01:46 +0000
+++ lib/lp/code/browser/tests/test_product.py	2014-02-25 06:49:33 +0000
@@ -103,7 +103,7 @@
     def test_product_code_page_visible_with_private_dev_focus(self):
         # If a user cannot see the product's development focus branch but can
         # see at least one branch for the product they can still see the
-        # +code-index page.
+        # +branches page.
         product, branch = self.makeProductAndDevelopmentFocusBranch(
             information_type=InformationType.USERDATA)
         self.factory.makeProductBranch(product=product)
@@ -113,7 +113,7 @@
     def test_initial_branches_contains_dev_focus_branch(self):
         product, branch = self.makeProductAndDevelopmentFocusBranch()
         view = create_initialized_view(
-            product, '+code-index', rootsite='code')
+            product, '+branches', rootsite='code')
         self.assertIn(branch, view.initial_branches)
 
     def test_initial_branches_does_not_contain_private_dev_focus_branch(self):
@@ -121,7 +121,7 @@
             information_type=InformationType.USERDATA)
         login(ANONYMOUS)
         view = create_initialized_view(
-            product, '+code-index', rootsite='code')
+            product, '+branches', rootsite='code')
         self.assertNotIn(branch, view.initial_branches)
 
     def test_committer_count_with_revision_authors(self):
@@ -137,8 +137,7 @@
             date_generator=date_generator)
         getUtility(IRevisionSet).updateRevisionCacheForBranch(branch)
 
-        view = create_initialized_view(product, '+code-index',
-                                       rootsite='code')
+        view = create_initialized_view(product, '+branches', rootsite='code')
         self.assertEqual(view.committer_count, 1)
 
     def test_committers_count_private_branch(self):
@@ -156,7 +155,7 @@
             date_generator=date_generator)
         getUtility(IRevisionSet).updateRevisionCacheForBranch(branch)
 
-        view = create_initialized_view(product, '+code-index',
+        view = create_initialized_view(product, '+branches',
                                        rootsite='code', principal=fsm)
         self.assertEqual(view.committer_count, 1)
 
@@ -180,7 +179,7 @@
 
         observer = self.factory.makePerson()
         login_person(observer)
-        view = create_initialized_view(product, '+code-index',
+        view = create_initialized_view(product, '+branches',
                                        rootsite='code', principal=observer)
         self.assertEqual(view.branch_count, 0)
         self.assertEqual(view.committer_count, 1)
@@ -190,12 +189,12 @@
     def test_initial_branches_contains_push_instructions(self):
         product, branch = self.makeProductAndDevelopmentFocusBranch()
         view = create_initialized_view(
-            product, '+code-index', rootsite='code', principal=product.owner)
+            product, '+branches', rootsite='code', principal=product.owner)
         content = view()
         self.assertIn('bzr push lp:~', content)
 
     def test_product_code_index_with_private_imported_branch(self):
-        # Product:+code-index will not crash if the devfoocs is a private
+        # Product:+branches will not crash if the devfoocs is a private
         # imported branch.
         product, branch = self.makeProductAndDevelopmentFocusBranch(
             information_type=InformationType.USERDATA,
@@ -203,7 +202,7 @@
         user = self.factory.makePerson()
         with person_logged_in(user):
             view = create_initialized_view(
-                product, '+code-index', rootsite='code', principal=user)
+                product, '+branches', rootsite='code', principal=user)
             html = view()
         expected = 'There are no branches for %s' % product.displayname
         self.assertIn(expected, html)
@@ -317,7 +316,7 @@
         url = "http://example.com/mybranch";
         product, branch = self.makeProductAndDevelopmentFocusBranch(
             branch_type=BranchType.MIRRORED, url=url)
-        view = create_initialized_view(product, '+code-index', rootsite='code')
+        view = create_initialized_view(product, '+branches', rootsite='code')
         self.assertEqual(url, view.mirror_location)
 
 
@@ -369,8 +368,7 @@
         login_person(product.owner)
         product.development_focus.branch = branch
         view = create_initialized_view(
-            product, '+code-index', rootsite='code',
-            principal=product.owner)
+            product, '+branches', rootsite='code', principal=product.owner)
         text = extract_text(find_tag_by_id(view.render(), 'privacy'))
         expected = (
             "New branches for %(name)s are Proprietary.*"
@@ -397,11 +395,11 @@
 
     def test_cannot_configure_branches_product_no_edit_permission(self):
         product = self.factory.makeProduct()
-        view = create_view(product, '+branches')
+        view = create_view(product, '+all-branches')
         self.assertEqual(False, view.can_configure_branches())
 
     def test_can_configure_branches_product_with_edit_permission(self):
         product = self.factory.makeProduct()
         login_person(product.owner)
-        view = create_view(product, '+branches')
+        view = create_view(product, '+all-branches')
         self.assertTrue(view.can_configure_branches())

=== modified file 'lib/lp/code/stories/branches/xx-branch-listings-merge-proposal-badge.txt'
--- lib/lp/code/stories/branches/xx-branch-listings-merge-proposal-badge.txt	2009-08-14 18:02:29 +0000
+++ lib/lp/code/stories/branches/xx-branch-listings-merge-proposal-badge.txt	2014-02-25 06:49:33 +0000
@@ -24,7 +24,7 @@
     >>> proposal = source.addLandingTarget(bob, target)
     >>> logout()
 
-    >>> browser.open('http://code.launchpad.dev/firefox/+branches')
+    >>> browser.open('http://code.launchpad.dev/firefox/+all-branches')
     >>> branchSummary(browser)
     /~bob/firefox/review
     Has a merge proposal

=== modified file 'lib/lp/code/stories/branches/xx-branch-listings.txt'
--- lib/lp/code/stories/branches/xx-branch-listings.txt	2012-11-08 23:58:19 +0000
+++ lib/lp/code/stories/branches/xx-branch-listings.txt	2014-02-25 06:49:33 +0000
@@ -217,7 +217,7 @@
     ...         for img in cells[1].findAll('img'):
     ...             print img['title']
 
-    >>> browser.open('http://code.launchpad.dev/firefox/+branches')
+    >>> browser.open('http://code.launchpad.dev/firefox/+all-branches')
     >>> branchSummary(browser)
     /~mark/firefox/release--0.9.1
     /~mark/firefox/release-0.8
@@ -236,7 +236,7 @@
 
 Now the badge is still shown for Sample Person...
 
-    >>> browser.open('http://code.launchpad.dev/firefox/+branches')
+    >>> browser.open('http://code.launchpad.dev/firefox/+all-branches')
     >>> branchSummary(browser)
     /~mark/firefox/release--0.9.1
     /~mark/firefox/release-0.8
@@ -248,7 +248,7 @@
 
 ... but not for an anonymous user.
 
-    >>> anon_browser.open('http://code.launchpad.dev/firefox/+branches')
+    >>> anon_browser.open('http://code.launchpad.dev/firefox/+all-branches')
     >>> branchSummary(anon_browser)
     /~mark/firefox/release--0.9.1
     /~mark/firefox/release-0.8
@@ -285,7 +285,7 @@
 is to sort by lifecycle status, and product name is not one of the
 options that can be selected.
 
-    >>> browser.open('http://code.launchpad.dev/gnome-terminal/+branches')
+    >>> browser.open('http://code.launchpad.dev/gnome-terminal/+all-branches')
     >>> sort_by_control = browser.getControl(name='field.sort_by')
     >>> sort_by_control.value
     ['by status']
@@ -307,7 +307,7 @@
 If you filter by a specific lifecycle status then ordering by
 lifecycle ceases to be relevant, and the default is to sort by registrant.
 
-    >>> browser.open('http://code.launchpad.dev/gnome-terminal/+branches')
+    >>> browser.open('http://code.launchpad.dev/gnome-terminal/+all-branches')
     >>> status_control = browser.getControl(name='field.lifecycle')
     >>> status_control.value = ['MATURE']
     >>> browser.getControl('Filter').click()
@@ -324,7 +324,7 @@
 
 Finally, sorting by a particular criterion has the desired effect.
 
-    >>> browser.open('http://code.launchpad.dev/gnome-terminal/+branches')
+    >>> browser.open('http://code.launchpad.dev/gnome-terminal/+all-branches')
     >>> table = find_tag_by_id(browser.contents, 'branchtable')
     >>> for row in table.tbody.fetch('tr'):
     ...     print extract_text(row)
@@ -463,7 +463,7 @@
 shown in the column after the last commit to allow the user to sort on
 the revision author column.
 
-    >>> browser.open('http://code.launchpad.dev/firefox/+branches')
+    >>> browser.open('http://code.launchpad.dev/firefox/+all-branches')
     >>> for commit in find_tags_by_class(browser.contents, 'lastCommit'):
     ...     print extract_text(commit)
     1.  Import of Mozilla Firefox 0.9.1

=== modified file 'lib/lp/code/stories/branches/xx-private-branch-listings.txt'
--- lib/lp/code/stories/branches/xx-private-branch-listings.txt	2012-09-18 18:36:09 +0000
+++ lib/lp/code/stories/branches/xx-private-branch-listings.txt	2014-02-25 06:49:33 +0000
@@ -103,7 +103,7 @@
 listing tab.
 
     >>> def print_landscape_code_listing(browser):
-    ...     browser.open('http://code.launchpad.dev/landscape/+branches')
+    ...     browser.open('http://code.launchpad.dev/landscape/+all-branches')
     ...     table = find_tag_by_id(browser.contents, 'branchtable')
     ...     # If there are no branches, the table is not shown.
     ...     # So print the text shown in the application summary.

=== modified file 'lib/lp/code/stories/branches/xx-product-branches.txt'
--- lib/lp/code/stories/branches/xx-product-branches.txt	2012-11-08 03:55:11 +0000
+++ lib/lp/code/stories/branches/xx-product-branches.txt	2014-02-25 06:49:33 +0000
@@ -320,7 +320,7 @@
 we are given a different message.
 
     >>> browser.open(
-    ...     'http://code.launchpad.dev/firefox/+branches'
+    ...     'http://code.launchpad.dev/firefox/+all-branches'
     ...     '?field.lifecycle=Mature')
     >>> message = find_tag_by_id(browser.contents, 'no-branch-message')
     >>> print extract_text(message)

=== modified file 'lib/lp/code/stories/branches/xx-source-package-branches-listing.txt'
--- lib/lp/code/stories/branches/xx-source-package-branches-listing.txt	2011-08-03 11:00:11 +0000
+++ lib/lp/code/stories/branches/xx-source-package-branches-listing.txt	2014-02-25 06:49:33 +0000
@@ -60,7 +60,7 @@
     ...     distribution=distro, sourcepackagename=branch1.sourcepackagename)
     >>> transaction.commit()
     >>> distro_source_package_listing = canonical_url(
-    ...     distro_source_package, view_name="+branches", rootsite='code')
+    ...     distro_source_package, view_name="+all-branches", rootsite='code')
     >>> logout()
 
     >>> browser.open(distro_source_package_listing)

=== modified file 'lib/lp/code/templates/distributionsourcepackage-branches-grouped.pt'
--- lib/lp/code/templates/distributionsourcepackage-branches-grouped.pt	2011-07-04 23:45:43 +0000
+++ lib/lp/code/templates/distributionsourcepackage-branches-grouped.pt	2014-02-25 06:49:33 +0000
@@ -103,7 +103,7 @@
         </li>
       </tal:series-branches>
     </tal:distro-series>
-    <li><a tal:attributes="href context/fmt:url:code/+branches">
+    <li><a tal:attributes="href context/fmt:url:code/+all-branches">
       All branches for the <tal:name replace="context/title"/>
     </a></li>
     </ul>

=== modified file 'lib/lp/code/templates/project-branches.pt'
--- lib/lp/code/templates/project-branches.pt	2012-10-08 01:55:25 +0000
+++ lib/lp/code/templates/project-branches.pt	2014-02-25 06:49:33 +0000
@@ -25,7 +25,7 @@
           </p>
             <ul id="product-list" tal:repeat="product products">
               <li>
-                <a tal:attributes="href product/@@+code-index/configure_codehosting/fmt:url"
+                <a tal:attributes="href product/@@+branches/configure_codehosting/fmt:url"
                    tal:content="product/title" />
               </li>
             </ul>

=== modified file 'lib/lp/registry/browser/configure.zcml'
--- lib/lp/registry/browser/configure.zcml	2013-02-13 23:00:21 +0000
+++ lib/lp/registry/browser/configure.zcml	2014-02-25 06:49:33 +0000
@@ -1345,7 +1345,7 @@
         name="+index"/>
     <browser:defaultView
         for="lp.registry.interfaces.product.IProduct"
-        name="+code-index"
+        name="+branches"
         layer="lp.code.publisher.CodeLayer"/>
     <browser:defaultView
         for="lp.registry.interfaces.product.IProduct"


References