Merge lp:~thumper/launchpad/branch-api-expose-package-bits into lp:launchpad

Proposed by Tim Penhey
Status: Merged
Approved by: Michael Hudson-Doyle
Approved revision: not available
Merged at revision: 10331
Proposed branch: lp:~thumper/launchpad/branch-api-expose-package-bits
Merge into: lp:launchpad
Diff against target: 64 lines (+16/-9)
3 files modified
lib/canonical/launchpad/interfaces/_schema_circular_imports.py (+7/-5)
lib/lp/code/interfaces/branch.py (+8/-4)
lib/lp/code/stories/webservice/xx-branch.txt (+1/-0)
To merge this branch: bzr merge lp:~thumper/launchpad/branch-api-expose-package-bits
Reviewer Review Type Date Requested Status
Michael Hudson-Doyle Approve
Review via email: mp+19550@code.launchpad.net

Commit message

Expose the sourcepackage for a branch over the API.

To post a comment you must log in.
Revision history for this message
Tim Penhey (thumper) wrote :

A simple branch to expose the sourcepackage for a package branch. Exposing the sourcepackage gives the caller access to both the name of the source package and the distro series.

Revision history for this message
Michael Hudson-Doyle (mwhudson) wrote :

Woop woop.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/canonical/launchpad/interfaces/_schema_circular_imports.py'
2--- lib/canonical/launchpad/interfaces/_schema_circular_imports.py 2010-02-11 00:54:32 +0000
3+++ lib/canonical/launchpad/interfaces/_schema_circular_imports.py 2010-02-17 22:45:22 +0000
4@@ -84,11 +84,13 @@
5 IBranch['linkSpecification'].queryTaggedValue(
6 LAZR_WEBSERVICE_EXPORTED)['params']['spec'].schema= ISpecification
7 IBranch['product'].schema = IProduct
8-IBranch['setTarget'].queryTaggedValue(
9- LAZR_WEBSERVICE_EXPORTED)['params']['project'].schema= IProduct
10-IBranch['setTarget'].queryTaggedValue(
11- LAZR_WEBSERVICE_EXPORTED)['params']['source_package'].schema= \
12- ISourcePackage
13+
14+patch_plain_parameter_type(
15+ IBranch, 'setTarget', 'project', IProduct)
16+patch_plain_parameter_type(
17+ IBranch, 'setTarget', 'source_package', ISourcePackage)
18+patch_reference_property(IBranch, 'sourcepackage', ISourcePackage)
19+
20 IBranch['spec_links'].value_type.schema = ISpecificationBranch
21 IBranch['subscribe'].queryTaggedValue(
22 LAZR_WEBSERVICE_EXPORTED)['return_type'].schema = IBranchSubscription
23
24=== modified file 'lib/lp/code/interfaces/branch.py'
25--- lib/lp/code/interfaces/branch.py 2010-01-22 06:03:19 +0000
26+++ lib/lp/code/interfaces/branch.py 2010-02-17 22:45:22 +0000
27@@ -460,7 +460,8 @@
28 "that is responsible for reviewing proposals and "
29 "merging into this branch.")))
30
31- # XXX: JonathanLange 2008-11-24: Export these.
32+ # Distroseries and sourcepackagename are exported together as
33+ # the sourcepackage.
34 distroseries = Choice(
35 title=_("Distribution Series"), required=False,
36 vocabulary='DistroSeries',
37@@ -480,9 +481,12 @@
38 "The IDistribution that this branch belongs to. None if not a "
39 "package branch.")
40
41- sourcepackage = Attribute(
42- "The ISourcePackage that this branch belongs to. None if not a "
43- "package branch.")
44+ # Really an ISourcePackage.
45+ sourcepackage = exported(
46+ Reference(
47+ title=_("The ISourcePackage that this branch belongs to. "
48+ "None if not a package branch."),
49+ schema=Interface, required=False, readonly=True))
50
51 code_reviewer = Attribute(
52 "The reviewer if set, otherwise the owner of the branch.")
53
54=== modified file 'lib/lp/code/stories/webservice/xx-branch.txt'
55--- lib/lp/code/stories/webservice/xx-branch.txt 2010-02-07 23:45:16 +0000
56+++ lib/lp/code/stories/webservice/xx-branch.txt 2010-02-17 22:45:22 +0000
57@@ -133,6 +133,7 @@
58 reviewer_link: None
59 revision_count: 0
60 self_link: u'.../~eric/fooix/trunk'
61+ sourcepackage_link: None
62 spec_links_collection_link: u'.../~eric/fooix/trunk/spec_links'
63 subscribers_collection_link: u'http://.../~eric/fooix/trunk/subscribers'
64 subscriptions_collection_link: u'http://.../~eric/fooix/trunk/subscriptions'