← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~ttx/launchpad/lp690712 into lp:launchpad

 

Thierry Carrez has proposed merging lp:~ttx/launchpad/lp690712 into lp:launchpad.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)
Related bugs:
  #690712 Need to export blueprint-branch links
  https://bugs.launchpad.net/bugs/690712

For more details, see:
https://code.launchpad.net/~ttx/launchpad/lp690712/+merge/45400

Exposes the missing linked_branches in the blueprint API (version='devel' only), fixes LP: #690712
-- 
https://code.launchpad.net/~ttx/launchpad/lp690712/+merge/45400
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~ttx/launchpad/lp690712 into lp:launchpad.
=== modified file 'lib/canonical/launchpad/interfaces/_schema_circular_imports.py'
--- lib/canonical/launchpad/interfaces/_schema_circular_imports.py	2010-12-21 09:34:17 +0000
+++ lib/canonical/launchpad/interfaces/_schema_circular_imports.py	2011-01-06 15:33:54 +0000
@@ -525,6 +525,7 @@
 
 # ISpecification
 patch_collection_property(ISpecification, 'dependencies', ISpecification)
+patch_collection_property(ISpecification, 'linked_branches', ISpecificationBranch)
 
 # ISpecificationTarget
 patch_entry_return_type(

=== modified file 'lib/lp/blueprints/interfaces/specification.py'
--- lib/lp/blueprints/interfaces/specification.py	2010-12-08 01:20:51 +0000
+++ lib/lp/blueprints/interfaces/specification.py	2011-01-06 15:33:54 +0000
@@ -399,8 +399,13 @@
         "All the dependencies, including dependencies of dependencies.")
     all_blocked = Attribute(
         "All specs blocked on this, and those blocked on the blocked ones.")
-    linked_branches = Attribute(
-        'The entries that link the branches to the spec.')
+    linked_branches = exported(
+        CollectionField(
+            title=_("Branches associated with this spec, usually "
+            "branches on which this spec is being implemented."),
+            value_type=Reference(schema=Interface), # ISpecificationBranch
+            readonly=True),
+        ('devel', dict(exported=True)), exported=False)
 
     # emergent properties
     informational = Attribute('Is True if this spec is purely informational '

=== modified file 'lib/lp/blueprints/tests/test_webservice.py'
--- lib/lp/blueprints/tests/test_webservice.py	2010-12-17 23:59:00 +0000
+++ lib/lp/blueprints/tests/test_webservice.py	2011-01-06 15:33:54 +0000
@@ -154,6 +154,14 @@
         self.assertEqual(1, spec_webservice.dependencies.total_size)
         self.assertEqual(spec2.name, spec_webservice.dependencies[0].name)
 
+    def test_representation_contains_linked_branches(self):
+        spec = self.factory.makeSpecification()
+        branch = self.factory.makeBranch()
+        person = self.factory.makePerson()
+        spec.linkBranch(branch, person)
+        spec_webservice = self.getSpecOnWebservice(spec)
+        self.assertEqual(1, spec_webservice.linked_branches.total_size)
+
     def test_representation_contains_bug_links(self):
         spec = self.factory.makeSpecification()
         bug = self.factory.makeBug()