Merge lp:~jml/launchpad/get-by-urls into lp:launchpad
Proposed by
Jonathan Lange
Status: | Merged |
---|---|
Merged at revision: | not available |
Proposed branch: | lp:~jml/launchpad/get-by-urls |
Merge into: | lp:launchpad |
Diff against target: |
242 lines (+113/-11) 7 files modified
lib/canonical/launchpad/pagetests/webservice/xx-branches.txt (+33/-0) lib/lp/code/interfaces/branch.py (+31/-1) lib/lp/code/interfaces/branchlookup.py (+8/-0) lib/lp/code/model/branch.py (+4/-0) lib/lp/code/model/branchlookup.py (+4/-0) lib/lp/code/model/tests/test_branchlookup.py (+13/-0) lib/lp/code/model/tests/test_branchset.py (+20/-10) |
To merge this branch: | bzr merge lp:~jml/launchpad/get-by-urls |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Jeroen T. Vermeulen (community) | code | Approve | |
Review via email: mp+14773@code.launchpad.net |
Commit message
Add a getByUrls method to IBranchSet and IBranchLookup so that API users can query for multiple branches in a single roundtrip.
To post a comment you must log in.
This branch exposes a convenience API method for getting Bazaar branches based on their URL.
Generally, when you are trying to get the Launchpad object for a Bazaar branch, you cannot be sure which of the many URLs associated with a branch is the correct rule to try. This means you generally want to try multiple URLs. However, this means lots of roundtrips, which means slow code.
The new method getByUrls allows you to query multiple URLs. It returns a list of branch objects in an order that matches the list of URLs. If the branch is not found, None is put in its place.
In an ideal world, it would return a dict mapping URLs to branches, but the API system doesn't support that right now.