Merge lp:~stevenk/launchpad/branch-use-information_type into lp:launchpad
| Status: | Merged |
|---|---|
| Approved by: | Steve Kowalik on 2012-05-23 |
| Approved revision: | no longer in the source branch. |
| Merged at revision: | 15289 |
| Proposed branch: | lp:~stevenk/launchpad/branch-use-information_type |
| Merge into: | lp:launchpad |
| Diff against target: |
355 lines (+102/-34) 9 files modified
lib/lp/code/browser/tests/test_branch.py (+6/-3) lib/lp/code/browser/tests/test_branchmergeproposal.py (+2/-1) lib/lp/code/errors.py (+5/-0) lib/lp/code/model/branch.py (+32/-11) lib/lp/code/model/tests/test_branch.py (+28/-2) lib/lp/code/model/tests/test_branchmergeproposal.py (+3/-2) lib/lp/code/model/tests/test_branchvisibility.py (+4/-7) lib/lp/code/xmlrpc/tests/test_branch.py (+4/-2) lib/lp/testing/factory.py (+18/-6) |
| To merge this branch: | bzr merge lp:~stevenk/launchpad/branch-use-information_type |
| Related bugs: |
| Reviewer | Review Type | Date Requested | Status |
|---|---|---|---|
| William Grant | code | 2012-05-17 | Approve on 2012-05-23 |
|
Review via email:
|
|||
Commit Message
Switch Branch to using information_type by default.
Description of the Change
Switch Branch to using information_type by default. I have also moved the code from setPrivate to transitionToInf
I have changed the factory method makeBranch to take an information_type argument, and have also made it call IBranch.
This necessitated changing a fair number of tests, which naively just set explicitly_private by hand. I've converted them to setting information_type, but am willing to make use of IBranch.
| William Grant (wgrant) wrote : | # |
121 + if (self.stacked_on and self.stacked_
122 + PRIVATE_
123 + PUBLIC_
This linebreaking is still a capital offence in several jurisdictions. One legal spelling is this:
if (self.stacked on
and self.stacked_
and information_type in PUBLIC_INFORMATION TYPES):
157 + # If the branch we are stacking on is not public, and we are,
158 + # set our information_type to the stacked on's.
This comment should explain why.
159 + if (self.stacked_on and self.stacked_
160 + PUBLIC_
161 + PUBLIC_
Another capital offence.
273 + branch = self.factory.
274 + name='branch_%s' % x, private=x > 2)
That linebreak is probably no longer required.

32 +def convert_ to_information_ type(private) : .USERDATA .PUBLIC
33 + if private:
34 + return InformationType
35 + else:
36 + return InformationType
I'd put this in model rather than adapters. It's not useful outside model.
101 +class BranchCannotCha ngeInformationT ype(Exception) :
102 + """The branch cannot change its information type."""
Of course it can't -- a branch isn't an actor. Do you mean that its information type can't be changed?
116 +from lazr.restful. interface import copy_field
Unused?
159 + @property ly_private n_type in PRIVATE_ INFORMATION_ TYPES
160 def private(self):
161 - return self.transitive
162 + return self.informatio
Doesn't this need to defer to transitively_ private if information_type? Depending on the way information_type is populated later, we may even need to ignore information_type completely until the migration is done.
174 + if ( on.information_ type != .PUBLIC and information_type != on.information_ type):
175 + self.stacked_on and self.stacked_
176 + InformationType
177 + self.stacked_
That is the worst line wrapping in the history of the universe.
211 + if ( on.information_ type != .PUBLIC) : n_type = self.stacked_ on.information_ type
212 + self.stacked_on and self.stacked_
213 + InformationType
214 + self.informatio
This could do with one fewer line breaks, and possibly a comment.
327 + if information_type: roxy(branch) .information_ type = information_type roxy(branch) .explicitly_ private = True roxy(branch) .transitively_ private = True roxy(branch) .information_ type = ( .USERDATA)
328 + removeSecurityP
329 if private:
330 removeSecurityP
331 removeSecurityP
332 + if not information_type:
333 + removeSecurityP
334 + InformationType
Should you perhaps merge the two information_type bits? And how close are we to eliminating makeBranch( private) ?