Merge lp:~james-w/launchpad/register-code-import into lp:launchpad
| Status: | Merged |
|---|---|
| Approved by: | Aaron Bentley on 2010-04-08 |
| Approved revision: | no longer in the source branch. |
| Merged at revision: | not available |
| Proposed branch: | lp:~james-w/launchpad/register-code-import |
| Merge into: | lp:launchpad |
| Prerequisite: | lp:~james-w/launchpad/code-imports-for-source-packages |
| Diff against target: |
732 lines (+302/-35) 18 files modified
lib/canonical/launchpad/interfaces/_schema_circular_imports.py (+5/-1) lib/lp/code/errors.py (+1/-0) lib/lp/code/interfaces/branch.py (+8/-1) lib/lp/code/interfaces/branchtarget.py (+3/-1) lib/lp/code/interfaces/codeimport.py (+5/-1) lib/lp/code/interfaces/hasbranches.py (+49/-5) lib/lp/code/interfaces/webservice.py (+6/-1) lib/lp/code/mail/tests/test_codeimport.py (+1/-1) lib/lp/code/model/branchtarget.py (+20/-2) lib/lp/code/model/codeimport.py (+6/-3) lib/lp/code/model/hasbranches.py (+15/-1) lib/lp/code/model/tests/test_codeimport.py (+40/-0) lib/lp/code/stories/webservice/xx-branchmergeproposal.txt (+1/-1) lib/lp/code/stories/webservice/xx-code-import.txt (+129/-7) lib/lp/registry/interfaces/product.py (+4/-2) lib/lp/registry/interfaces/sourcepackage.py (+3/-2) lib/lp/registry/model/product.py (+3/-3) lib/lp/registry/model/sourcepackage.py (+3/-3) |
| To merge this branch: | bzr merge lp:~james-w/launchpad/register-code-import |
| Related bugs: |
| Reviewer | Review Type | Date Requested | Status |
|---|---|---|---|
| Aaron Bentley (community) | 2010-04-01 | Approve on 2010-04-08 | |
|
Review via email:
|
|||
Commit Message
There is now a newCodeImport method on Product and SourcePackage in the API.
Description of the Change
Hi,
This exposes the creation of code imports over the API.
It first adds an "owner" argument, so that we can specify
this through the API, with associated tests.
It then exposes the IBranchTarget.
over the API using a small interface and mixin, due to it being
on an adapter.
It then adds a bunch of tests for this, including error cases
where the user may specify bad information.
For the last bit I used webservice_error so that they would get
400 not 500 responses, and there won't be OOPSes generated for them.
To do this I had to add the exception classes that have the decorator
to the interfaces/
views for them.
Doing this I discovered that the existing webservice_error in lp.code
wasn't working, and in fact had a test asserting it wasn't working,
so I fixed that along the way.
Thanks,
James
| James Westby (james-w) wrote : | # |
| Aaron Bentley (abentley) wrote : | # |
It's nice of you to defer requesting a review until all tests are passing, but I think a lot of us don't observe that.
Was there a preimplementation call?
Was there any lint?
AIUI PEP8 requires that items within a class definition be separated by a single blank line, so a bunch of your webservice_
Why are you using export_
On IHasCodeImports, you claim that newCodeImport returns BranchMergeProp
What would you think about expressing xx-code-
| James Westby (james-w) wrote : | # |
> It's nice of you to defer requesting a review until all tests are passing, but
> I think a lot of us don't observe that.
>
> Was there a preimplementation call?
No, but I chatted with wgrant about the strategy.
> Was there any lint?
I don't know, running "make lint" runs it on lots of unexpected files.
> AIUI PEP8 requires that items within a class definition be separated by a
> single blank line, so a bunch of your webservice_
> line in front of them.
Done.
> Why are you using export_
> on branchtarget?
That's not supposed to be there any more, deleted.
> On IHasCodeImports, you claim that newCodeImport returns BranchMergeProp
> I think this is inaccurate.
Fixed.
> What would you think about expressing xx-code-
> heading as a unit test? Failing that, it needs two blank lines separating it
> from the previous section.
I don't know how to do webservice tests as unit tests, if you can point me to
examples I will convert them.
Blank lines issue fixed anyway, and I updated the text to make the intent of
the tests clearer as well.
Thanks,
James
| Aaron Bentley (abentley) wrote : | # |
On 04/05/2010 05:39 PM, James Westby wrote:
>> Was there any lint?
>
> I don't know, running "make lint" runs it on lots of unexpected files.
When there are no uncommitted changes, "make lint" compares your tree to
the parent branch to determine which files it runs against. This means
it will also lint files changed by your prerequisite branch. You parent
branch may also be out of date.
You can also run bin/lint.sh with the list of files you modified. If
you use pipelines and have the lp-review-body plugin installed, you can
use lp-propose (formerly lp-submit) and it will use the previous pipe to
determine which files to lint.
Anyhow, there was lots of lint:
$ make lint
= Launchpad lint =
Checking for conflicts. and issues in doctests and templates.
Running jslint, xmllint, pyflakes, and pylint.
Using normal rules.
Linting changed files:
lib/
lib/
lib/
lib/
lib/
lib/
lib/
lib/
lib/
lib/
lib/
lib/
lib/
lib/
lib/
lib/
lib/
== Pyflakes notices ==
lib/canonical/
43: 'IBranchTarget' imported but unused
lib/lp/
11: undefined name 'UnknownBranchT
lib/lp/
8: 'BranchMergePro
9: 'BranchCreatorN
9: 'IBranchSet' imported but unused
9: 'IBranch' imported but unused
9: 'BranchExists' imported but unused
9: 'BranchCreatorN
12: 'IBranchMergePr
13: 'IBranchSubscri
14: 'ICodeImport' imported but unused
15: 'ICodeReviewCom
16: 'ICodeReviewVot
17: 'IStaticDiff' imported but unused
17: 'IDiff' imported but unused
17: 'IPreviewDiff' imported but unused
lib/lp/
684: local variable 'displayname' is assigned to but never used
== Pylint notices ==
lib/canonical/
18: [F0401] Unable to import 'lazr.restful.
43: [W0611] Unused import IBranchTarget
lib/lp/
20: [F0401] Unable to import 'lazr.restful.
lib/lp/
442: [C0322, IBranch.setOwner] Operator not preceded by a space
title=_("The new owner of the branch."),
^
schema=
@export_
def setOwner(new_owner, user):
451: [C0322, IBranch.setTarget] Opera...
| James Westby (james-w) wrote : | # |
On Tue, 06 Apr 2010 15:33:31 -0000, Aaron Bentley <email address hidden> wrote:
> On 04/05/2010 05:39 PM, James Westby wrote:
>
> >> Was there any lint?
> >
> > I don't know, running "make lint" runs it on lots of unexpected files.
>
> When there are no uncommitted changes, "make lint" compares your tree to
> the parent branch to determine which files it runs against. This means
> it will also lint files changed by your prerequisite branch. You parent
> branch may also be out of date.
I am using pipelines, so I would have thought it would run against the
previous pipe?
> You can also run bin/lint.sh with the list of files you modified. If
> you use pipelines and have the lp-review-body plugin installed, you can
> use lp-propose (formerly lp-submit) and it will use the previous pipe to
> determine which files to lint.
That's what I used (at least for one of these proposals,) but I didn't
have the extra plugin installed.
> lib/canonical/
> 43: 'IBranchTarget' imported but unused
Fixed.
> lib/lp/
> 11: undefined name 'UnknownBranchT
Fixed.
> lib/lp/
> 8: 'BranchMergePro
> 9: 'BranchCreatorN
> 9: 'IBranchSet' imported but unused
> 9: 'IBranch' imported but unused
> 9: 'BranchExists' imported but unused
> 9: 'BranchCreatorN
> 12: 'IBranchMergePr
> 13: 'IBranchSubscri
> 14: 'ICodeImport' imported but unused
> 15: 'ICodeReviewCom
> 16: 'ICodeReviewVot
> 17: 'IStaticDiff' imported but unused
> 17: 'IDiff' imported but unused
> 17: 'IPreviewDiff' imported but unused
Noise. This file is purely for importing.
> lib/lp/
> 684: local variable 'displayname' is assigned to but never used
Fixed.
> lib/lp/
> 442: [C0322, IBranch.setOwner] Operator not preceded by a space
> title=_("The new owner of the branch."),
> ^
> schema=IPerson))
> @export_
> def setOwner(new_owner, user):
> 451: [C0322, IBranch.setTarget] Operator not preceded by a space
> title=_("The project the branch belongs to."),
> ^
> schema=Interface, required=False), # Really IProduct
> source_
> title=_("The source package the branch belongs to."),
> schema=Interface, required=False)) # Really ISourcePackage
> @export_
> def setTarget(user, project=None, source_
> 511: [C0322, IBranch.
> by a space
> title=_("A person for which the reviewer status is in question."),
> ^
> schema=IPerson))
> @export_
> def isPersonTrusted
> 760: [C0322, IBranch.
> a space
> needs_review=
> ...
| Aaron Bentley (abentley) wrote : | # |
On 04/07/2010 10:06 AM, James Westby wrote:
> On Tue, 06 Apr 2010 15:33:31 -0000, Aaron Bentley<email address hidden> wrote:
>> When there are no uncommitted changes, "make lint" compares your tree to
>> the parent branch to determine which files it runs against. This means
>> it will also lint files changed by your prerequisite branch. You parent
>> branch may also be out of date.
>
> I am using pipelines, so I would have thought it would run against the
> previous pipe?
No, I did not design it and it predates pipelines.
>> lib/lp/
>> 8: 'BranchMergePro
>> 9: 'BranchCreatorN
>> 9: 'IBranchSet' imported but unused
>> 9: 'IBranch' imported but unused
>> 9: 'BranchExists' imported but unused
>> 9: 'BranchCreatorN
>> 12: 'IBranchMergePr
>> 13: 'IBranchSubscri
>> 14: 'ICodeImport' imported but unused
>> 15: 'ICodeReviewCom
>> 16: 'ICodeReviewVot
>> 17: 'IStaticDiff' imported but unused
>> 17: 'IDiff' imported but unused
>> 17: 'IPreviewDiff' imported but unused
>
> Noise. This file is purely for importing.
It seems really weird to me. If it's there for external users, why isn't there an __all__? I'll chat with Leonard, but it doesn't need to block you.

Passes ec2, so requesting a review.
Thanks,
James