Merge lp:~stevenk/launchpad/branch-information_type-factory into lp:launchpad

Proposed by Steve Kowalik
Status: Merged
Approved by: Steve Kowalik
Approved revision: no longer in the source branch.
Merged at revision: 15347
Proposed branch: lp:~stevenk/launchpad/branch-information_type-factory
Merge into: lp:launchpad
Diff against target: 1850 lines (+334/-186)
38 files modified
lib/lp/app/browser/tests/test_launchpad.py (+6/-3)
lib/lp/bugs/model/tests/test_bug.py (+2/-1)
lib/lp/bugs/tests/test_bugchanges.py (+4/-2)
lib/lp/code/browser/tests/test_bazaar.py (+8/-4)
lib/lp/code/browser/tests/test_branchmergeproposal.py (+5/-3)
lib/lp/code/browser/tests/test_branchmergeproposallisting.py (+4/-2)
lib/lp/code/browser/tests/test_branchmergequeuelisting.py (+5/-3)
lib/lp/code/browser/tests/test_product.py (+6/-5)
lib/lp/code/browser/tests/test_sourcepackagerecipe.py (+7/-3)
lib/lp/code/model/tests/test_branch.py (+22/-13)
lib/lp/code/model/tests/test_branchcollection.py (+13/-11)
lib/lp/code/model/tests/test_branchlookup.py (+13/-7)
lib/lp/code/model/tests/test_branchmergeproposal.py (+2/-1)
lib/lp/code/model/tests/test_branchmergequeuecollection.py (+15/-11)
lib/lp/code/model/tests/test_branchpuller.py (+4/-2)
lib/lp/code/model/tests/test_branchset.py (+6/-3)
lib/lp/code/model/tests/test_branchtarget.py (+6/-3)
lib/lp/code/model/tests/test_branchvisibility.py (+15/-5)
lib/lp/code/model/tests/test_revision.py (+12/-7)
lib/lp/code/model/tests/test_sourcepackagerecipe.py (+7/-4)
lib/lp/code/stories/branches/xx-private-branch-listings.txt (+2/-1)
lib/lp/code/tests/helpers.py (+8/-2)
lib/lp/code/tests/test_branch.py (+26/-13)
lib/lp/code/tests/test_branch_webservice.py (+3/-1)
lib/lp/code/xmlrpc/tests/test_branch.py (+6/-3)
lib/lp/code/xmlrpc/tests/test_codehosting.py (+22/-9)
lib/lp/codehosting/codeimport/tests/test_worker.py (+5/-3)
lib/lp/codehosting/inmemory.py (+18/-11)
lib/lp/codehosting/puller/tests/test_acceptance.py (+7/-2)
lib/lp/codehosting/tests/test_rewrite.py (+9/-6)
lib/lp/registry/browser/tests/test_pillar_sharing.py (+2/-1)
lib/lp/registry/services/tests/test_sharingservice.py (+4/-2)
lib/lp/registry/tests/test_distro_webservice.py (+4/-2)
lib/lp/registry/tests/test_private_team_visibility.py (+16/-3)
lib/lp/registry/tests/test_productjob.py (+12/-10)
lib/lp/testing/factory.py (+17/-18)
lib/lp/translations/browser/tests/test_productserieslanguage_views.py (+8/-5)
lib/lp/translations/stories/productseries/xx-productseries-translations.txt (+3/-1)
To merge this branch: bzr merge lp:~stevenk/launchpad/branch-information_type-factory
Reviewer Review Type Date Requested Status
Ian Booth (community) Approve
Review via email: mp+108094@code.launchpad.net

Commit message

Change factory.make*Branch() to no longer take a private argument, and instead rely on information_type.

Description of the change

Change factory.make*Branch() to no longer take a private argument, and instead rely on information_type, and change all callsites.

To post a comment you must log in.
Revision history for this message
Ian Booth (wallyworld) wrote :

Most of this is purely mechanical and the core factory api changes looks good. I assume the makeBranch call with info type unspecified defaults to public.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/lp/app/browser/tests/test_launchpad.py'
2--- lib/lp/app/browser/tests/test_launchpad.py 2012-05-24 02:16:59 +0000
3+++ lib/lp/app/browser/tests/test_launchpad.py 2012-06-01 02:30:29 +0000
4@@ -173,7 +173,8 @@
5
6 def test_private_branch(self):
7 # If an attempt is made to access a private branch, display an error.
8- branch = self.factory.makeProductBranch(private=True)
9+ branch = self.factory.makeProductBranch(
10+ information_type=InformationType.USERDATA)
11 branch_unique_name = removeSecurityProxy(branch).unique_name
12 login(ANONYMOUS)
13 requiredMessage = "No such branch: '%s'." % branch_unique_name
14@@ -251,7 +252,8 @@
15 # message telling the user there is no linked branch.
16 sourcepackage = self.factory.makeSourcePackage()
17 branch = self.factory.makePackageBranch(
18- sourcepackage=sourcepackage, private=True)
19+ sourcepackage=sourcepackage,
20+ information_type=InformationType.USERDATA)
21 distro_package = sourcepackage.distribution_sourcepackage
22 registrant = distro_package.distribution.owner
23 with person_logged_in(registrant):
24@@ -298,7 +300,8 @@
25 def test_private_branch_for_series(self):
26 # If the development focus of a product series is private, display a
27 # message telling the user there is no linked branch.
28- branch = self.factory.makeBranch(private=True)
29+ branch = self.factory.makeBranch(
30+ information_type=InformationType.USERDATA)
31 series = self.factory.makeProductSeries(branch=branch)
32 login(ANONYMOUS)
33 path = ICanHasLinkedBranch(series).bzr_path
34
35=== modified file 'lib/lp/bugs/model/tests/test_bug.py'
36--- lib/lp/bugs/model/tests/test_bug.py 2012-05-16 09:05:42 +0000
37+++ lib/lp/bugs/model/tests/test_bug.py 2012-06-01 02:30:29 +0000
38@@ -456,7 +456,8 @@
39 bug = self.factory.makeBug()
40 private_branch_owner = self.factory.makePerson()
41 private_branch = self.factory.makeBranch(
42- owner=private_branch_owner, private=True)
43+ owner=private_branch_owner,
44+ information_type=InformationType.USERDATA)
45 with person_logged_in(private_branch_owner):
46 bug.linkBranch(private_branch, private_branch.registrant)
47 public_branch_owner = self.factory.makePerson()
48
49=== modified file 'lib/lp/bugs/tests/test_bugchanges.py'
50--- lib/lp/bugs/tests/test_bugchanges.py 2012-05-08 01:06:31 +0000
51+++ lib/lp/bugs/tests/test_bugchanges.py 2012-06-01 02:30:29 +0000
52@@ -502,7 +502,8 @@
53 def test_link_private_branch(self):
54 # Linking a *private* branch to a bug adds *nothing* to the
55 # activity log and does *not* send an e-mail notification.
56- branch = self.factory.makeBranch(private=True)
57+ branch = self.factory.makeBranch(
58+ information_type=InformationType.USERDATA)
59 self.bug.linkBranch(branch, self.user)
60 self.assertRecordedChange()
61
62@@ -555,7 +556,8 @@
63 def test_unlink_private_branch(self):
64 # Unlinking a *private* branch from a bug adds *nothing* to
65 # the activity log and does *not* send an e-mail notification.
66- branch = self.factory.makeBranch(private=True)
67+ branch = self.factory.makeBranch(
68+ information_type=InformationType.USERDATA)
69 self.bug.linkBranch(branch, self.user)
70 self.saveOldChanges()
71 self.bug.unlinkBranch(branch, self.user)
72
73=== modified file 'lib/lp/code/browser/tests/test_bazaar.py'
74--- lib/lp/code/browser/tests/test_bazaar.py 2012-01-01 02:58:52 +0000
75+++ lib/lp/code/browser/tests/test_bazaar.py 2012-06-01 02:30:29 +0000
76@@ -1,4 +1,4 @@
77-# Copyright 2009 Canonical Ltd. This software is licensed under the
78+# Copyright 2009-2012 Canonical Ltd. This software is licensed under the
79 # GNU Affero General Public License version 3 (see the file LICENSE).
80
81 """Tests for classes in the lp.code.browser.bazaar module."""
82@@ -8,6 +8,7 @@
83 from zope.security.proxy import removeSecurityProxy
84
85 from lp.code.browser.bazaar import BazaarApplicationView
86+from lp.registry.enums import InformationType
87 from lp.services.webapp.authorization import check_permission
88 from lp.services.webapp.servers import LaunchpadTestRequest
89 from lp.testing import (
90@@ -34,7 +35,8 @@
91 def test_recently_registered(self):
92 # Create a some private branches (stacked and unstacked) that the
93 # logged in user would not normally see.
94- private_branch = self.factory.makeAnyBranch(private=True)
95+ private_branch = self.factory.makeAnyBranch(
96+ information_type=InformationType.USERDATA)
97 self.factory.makeAnyBranch(stacked_on=private_branch)
98 branch = self.factory.makeAnyBranch()
99 recent_branches = self.getViewBranches('recently_registered_branches')
100@@ -51,7 +53,8 @@
101 def test_recently_changed(self):
102 # Create a some private branches (stacked and unstacked) that the
103 # logged in user would not normally see.
104- private_branch = self.factory.makeAnyBranch(private=True)
105+ private_branch = self.factory.makeAnyBranch(
106+ information_type=InformationType.USERDATA)
107 stacked_private_branch = self.factory.makeAnyBranch(
108 stacked_on=private_branch)
109 branch = self.factory.makeAnyBranch()
110@@ -65,7 +68,8 @@
111 # Create an import branch that is stacked on a private branch that the
112 # logged in user would not normally see. This would never happen in
113 # reality, but hey, lets test the function actually works.
114- private_branch = self.factory.makeAnyBranch(private=True)
115+ private_branch = self.factory.makeAnyBranch(
116+ information_type=InformationType.USERDATA)
117 # A new code import needs a real user as the sender for the outgoing
118 # email.
119 login_person(self.factory.makePerson())
120
121=== modified file 'lib/lp/code/browser/tests/test_branchmergeproposal.py'
122--- lib/lp/code/browser/tests/test_branchmergeproposal.py 2012-05-24 02:16:59 +0000
123+++ lib/lp/code/browser/tests/test_branchmergeproposal.py 2012-06-01 02:30:29 +0000
124@@ -472,7 +472,8 @@
125
126 # Make a branch the reviewer cannot see.
127 owner = self.factory.makePerson()
128- target_branch = self._makeTargetBranch(owner=owner, private=True)
129+ target_branch = self._makeTargetBranch(
130+ owner=owner, information_type=InformationType.USERDATA)
131 reviewer = self.factory.makePerson()
132 extra = {'HTTP_X_REQUESTED_WITH': 'XMLHttpRequest'}
133 request = LaunchpadTestRequest(
134@@ -498,7 +499,8 @@
135 # Ajax submits where there is a validation error in the submitted data
136 # return the expected json response containing the error info.
137 owner = self.factory.makePerson()
138- target_branch = self._makeTargetBranch(owner=owner, private=True)
139+ target_branch = self._makeTargetBranch(
140+ owner=owner, information_type=InformationType.USERDATA)
141 extra = {'HTTP_X_REQUESTED_WITH': 'XMLHttpRequest'}
142 with person_logged_in(owner):
143 request = LaunchpadTestRequest(
144@@ -670,7 +672,7 @@
145 # notification message is displayed.
146 owner = self.factory.makePerson()
147 target_branch = self._makeTargetBranch(
148- private=True, owner=owner)
149+ owner=owner, information_type=InformationType.USERDATA)
150 reviewer = self.factory.makePerson()
151 with person_logged_in(owner):
152 view = self._createView()
153
154=== modified file 'lib/lp/code/browser/tests/test_branchmergeproposallisting.py'
155--- lib/lp/code/browser/tests/test_branchmergeproposallisting.py 2011-12-30 06:14:56 +0000
156+++ lib/lp/code/browser/tests/test_branchmergeproposallisting.py 2012-06-01 02:30:29 +0000
157@@ -1,4 +1,4 @@
158-# Copyright 2009-2011 Canonical Ltd. This software is licensed under the
159+# Copyright 2009-2012 Canonical Ltd. This software is licensed under the
160 # GNU Affero General Public License version 3 (see the file LICENSE).
161
162 """Unit tests for BranchMergeProposal listing views."""
163@@ -23,6 +23,7 @@
164 BranchMergeProposalStatus,
165 CodeReviewVote,
166 )
167+from lp.registry.enums import InformationType
168 from lp.registry.model.personproduct import PersonProduct
169 from lp.services.database.sqlbase import flush_database_caches
170 from lp.services.webapp.servers import LaunchpadTestRequest
171@@ -380,7 +381,8 @@
172 # Merge proposals against private branches are visible to
173 # the branch owner.
174 product = self.factory.makeProduct()
175- branch = self.factory.makeBranch(private=True, product=product)
176+ branch = self.factory.makeBranch(
177+ product=product, information_type=InformationType.USERDATA)
178 with person_logged_in(removeSecurityProxy(branch).owner):
179 mp = self.factory.makeBranchMergeProposal(target_branch=branch)
180 view = create_initialized_view(
181
182=== modified file 'lib/lp/code/browser/tests/test_branchmergequeuelisting.py'
183--- lib/lp/code/browser/tests/test_branchmergequeuelisting.py 2012-01-01 02:58:52 +0000
184+++ lib/lp/code/browser/tests/test_branchmergequeuelisting.py 2012-06-01 02:30:29 +0000
185@@ -1,4 +1,4 @@
186-# Copyright 2010 Canonical Ltd. This software is licensed under the
187+# Copyright 2010-2012 Canonical Ltd. This software is licensed under the
188 # GNU Affero General Public License version 3 (see the file LICENSE).
189
190 """Tests for branch listing."""
191@@ -11,6 +11,7 @@
192 import soupmatchers
193 from zope.security.proxy import removeSecurityProxy
194
195+from lp.registry.enums import InformationType
196 from lp.services.features.model import (
197 FeatureFlag,
198 getFeatureStore,
199@@ -49,7 +50,7 @@
200 mergequeues = [
201 self.factory.makeBranchMergeQueue(
202 owner=self.branch_owner, branches=self._makeBranches())
203- for i in range(nr_queues-nr_with_private_branches)]
204+ for i in range(nr_queues - nr_with_private_branches)]
205 mergequeues_with_private_branches = [
206 self.factory.makeBranchMergeQueue(
207 owner=self.branch_owner,
208@@ -65,7 +66,8 @@
209
210 private_branches = [
211 self.factory.makeProductBranch(
212- owner=self.branch_owner, private=True)
213+ owner=self.branch_owner,
214+ information_type=InformationType.USERDATA)
215 for i in range(nr_private)]
216
217 branches.extend(private_branches)
218
219=== modified file 'lib/lp/code/browser/tests/test_product.py'
220--- lib/lp/code/browser/tests/test_product.py 2012-03-08 19:25:58 +0000
221+++ lib/lp/code/browser/tests/test_product.py 2012-06-01 02:30:29 +0000
222@@ -1,4 +1,4 @@
223-# Copyright 2009-2010 Canonical Ltd. This software is licensed under the
224+# Copyright 2009-2012 Canonical Ltd. This software is licensed under the
225 # GNU Affero General Public License version 3 (see the file LICENSE).
226
227 """Tests for the product view classes and templates."""
228@@ -21,6 +21,7 @@
229 )
230 from lp.code.interfaces.revision import IRevisionSet
231 from lp.code.publisher import CodeLayer
232+from lp.registry.enums import InformationType
233 from lp.services.webapp import canonical_url
234 from lp.testing import (
235 ANONYMOUS,
236@@ -104,7 +105,7 @@
237 # see at least one branch for the product they can still see the
238 # +code-index page.
239 product, branch = self.makeProductAndDevelopmentFocusBranch(
240- private=True)
241+ information_type=InformationType.USERDATA)
242 self.factory.makeProductBranch(product=product)
243 # This is just "assertNotRaises"
244 self.getUserBrowser(canonical_url(product, rootsite='code'))
245@@ -117,7 +118,7 @@
246
247 def test_initial_branches_does_not_contain_private_dev_focus_branch(self):
248 product, branch = self.makeProductAndDevelopmentFocusBranch(
249- private=True)
250+ information_type=InformationType.USERDATA)
251 view = create_initialized_view(product, '+code-index',
252 rootsite='code')
253 self.assertNotIn(branch, view.initial_branches)
254@@ -144,7 +145,7 @@
255 # for a private branch.
256 fsm = self.factory.makePerson(email='flyingpasta@example.com')
257 product, branch = self.makeProductAndDevelopmentFocusBranch(
258- private=True, owner=fsm)
259+ owner=fsm, information_type=InformationType.USERDATA)
260 date_generator = time_counter(
261 datetime.now(pytz.UTC) - timedelta(days=30),
262 timedelta(days=1))
263@@ -166,7 +167,7 @@
264 # for a private branch.
265 fsm = self.factory.makePerson(email='flyingpasta@example.com')
266 product, branch = self.makeProductAndDevelopmentFocusBranch(
267- private=True, owner=fsm)
268+ owner=fsm, information_type=InformationType.USERDATA)
269 date_generator = time_counter(
270 datetime.now(pytz.UTC) - timedelta(days=30),
271 timedelta(days=1))
272
273=== modified file 'lib/lp/code/browser/tests/test_sourcepackagerecipe.py'
274--- lib/lp/code/browser/tests/test_sourcepackagerecipe.py 2012-02-28 04:24:19 +0000
275+++ lib/lp/code/browser/tests/test_sourcepackagerecipe.py 2012-06-01 02:30:29 +0000
276@@ -35,6 +35,7 @@
277 )
278 from lp.code.interfaces.sourcepackagerecipe import MINIMAL_RECIPE_TEXT
279 from lp.code.tests.helpers import recipe_parser_newest_version
280+from lp.registry.enums import InformationType
281 from lp.registry.interfaces.person import TeamSubscriptionPolicy
282 from lp.registry.interfaces.pocket import PackagePublishingPocket
283 from lp.registry.interfaces.series import SeriesStatus
284@@ -322,7 +323,8 @@
285 def test_create_new_recipe_private_branch(self):
286 # Recipes can't be created on private branches.
287 with person_logged_in(self.chef):
288- branch = self.factory.makeBranch(private=True, owner=self.chef)
289+ branch = self.factory.makeBranch(
290+ owner=self.chef, information_type=InformationType.USERDATA)
291 branch_url = canonical_url(branch)
292
293 browser = self.getUserBrowser(branch_url, user=self.chef)
294@@ -516,7 +518,8 @@
295 def test_create_recipe_private_branch(self):
296 # If a user tries to create source package recipe with a private
297 # base branch, they should get an error.
298- branch = self.factory.makeAnyBranch(private=True, owner=self.user)
299+ branch = self.factory.makeAnyBranch(
300+ owner=self.user, information_type=InformationType.USERDATA)
301 with person_logged_in(self.user):
302 bzr_identity = branch.bzr_identity
303 recipe_text = MINIMAL_RECIPE_TEXT % bzr_identity
304@@ -933,7 +936,8 @@
305 # If a user tries to set source package recipe to use a private
306 # branch, they should get an error.
307 recipe = self.factory.makeSourcePackageRecipe(owner=self.user)
308- branch = self.factory.makeAnyBranch(private=True, owner=self.user)
309+ branch = self.factory.makeAnyBranch(
310+ owner=self.user, information_type=InformationType.USERDATA)
311 with person_logged_in(self.user):
312 bzr_identity = branch.bzr_identity
313 recipe_text = MINIMAL_RECIPE_TEXT % bzr_identity
314
315=== modified file 'lib/lp/code/model/tests/test_branch.py'
316--- lib/lp/code/model/tests/test_branch.py 2012-05-25 01:48:31 +0000
317+++ lib/lp/code/model/tests/test_branch.py 2012-06-01 02:30:29 +0000
318@@ -1125,7 +1125,8 @@
319
320 def test_private_linked_to_product(self):
321 # Private branches also have a short lp:url.
322- branch = self.factory.makeProductBranch(private=True)
323+ branch = self.factory.makeProductBranch(
324+ information_type=InformationType.USERDATA)
325 with celebrity_logged_in('admin'):
326 product = branch.product
327 ICanHasLinkedBranch(product).setBranch(branch)
328@@ -1881,7 +1882,8 @@
329
330 def test_private_branch(self):
331 """landing_candidates works for private branches."""
332- branch = self.factory.makeBranch(private=True)
333+ branch = self.factory.makeBranch(
334+ information_type=InformationType.USERDATA)
335 with person_logged_in(removeSecurityProxy(branch).owner):
336 mp = self.factory.makeBranchMergeProposal(target_branch=branch)
337 self.assertContentEqual([mp], branch.landing_candidates)
338@@ -2162,7 +2164,8 @@
339 def test_private(self):
340 # The codebrowse URL for a private branch is a 'https' url.
341 owner = self.factory.makePerson()
342- branch = self.factory.makeAnyBranch(private=True, owner=owner)
343+ branch = self.factory.makeAnyBranch(
344+ owner=owner, information_type=InformationType.USERDATA)
345 login_person(owner)
346 self.assertEqual(
347 'https://bazaar.launchpad.dev/' + branch.unique_name,
348@@ -2334,9 +2337,9 @@
349
350 def test_public_stacked_on_private_is_private(self):
351 # A public branch stacked on a private branch is private.
352- stacked_on = self.factory.makeBranch(private=True)
353- branch = self.factory.makeBranch(
354- stacked_on=stacked_on, private=False)
355+ stacked_on = self.factory.makeBranch(
356+ information_type=InformationType.USERDATA)
357+ branch = self.factory.makeBranch(stacked_on=stacked_on)
358 self.assertTrue(branch.private)
359 self.assertEqual(
360 stacked_on.information_type, branch.information_type)
361@@ -2345,8 +2348,9 @@
362
363 def test_private_stacked_on_public_is_private(self):
364 # A private branch stacked on a public branch is private.
365- stacked_on = self.factory.makeBranch(private=False)
366- branch = self.factory.makeBranch(stacked_on=stacked_on, private=True)
367+ stacked_on = self.factory.makeBranch()
368+ branch = self.factory.makeBranch(
369+ stacked_on=stacked_on, information_type=InformationType.USERDATA)
370 self.assertTrue(branch.private)
371 self.assertNotEqual(
372 stacked_on.information_type, branch.information_type)
373@@ -2412,7 +2416,8 @@
374
375 def test_private_to_private(self):
376 # Setting a private branch to be private is a no-op.
377- branch = self.factory.makeProductBranch(private=True)
378+ branch = self.factory.makeProductBranch(
379+ information_type=InformationType.USERDATA)
380 self.assertTrue(branch.private)
381 branch.setPrivate(True, branch.owner)
382 self.assertTrue(branch.private)
383@@ -2422,7 +2427,8 @@
384 def test_private_to_public_allowed(self):
385 # If the namespace policy allows public branches, then changing from
386 # private to public is allowed.
387- branch = self.factory.makeProductBranch(private=True)
388+ branch = self.factory.makeProductBranch(
389+ information_type=InformationType.USERDATA)
390 branch.setPrivate(False, branch.owner)
391 self.assertFalse(branch.private)
392 self.assertFalse(removeSecurityProxy(branch).transitively_private)
393@@ -2432,7 +2438,8 @@
394 def test_private_to_public_not_allowed(self):
395 # If the namespace policy does not allow public branches, attempting
396 # to change the branch to be public raises BranchCannotBePublic.
397- branch = self.factory.makeProductBranch(private=True)
398+ branch = self.factory.makeProductBranch(
399+ information_type=InformationType.USERDATA)
400 branch.product.setBranchVisibilityTeamPolicy(
401 None, BranchVisibilityRule.FORBIDDEN)
402 branch.product.setBranchVisibilityTeamPolicy(
403@@ -2445,7 +2452,8 @@
404 def test_cannot_transition_with_private_stacked_on(self):
405 # If a public branch is stacked on a private branch, it can not
406 # change its information_type to public.
407- stacked_on = self.factory.makeBranch(private=True)
408+ stacked_on = self.factory.makeBranch(
409+ information_type=InformationType.USERDATA)
410 branch = self.factory.makeBranch(stacked_on=stacked_on)
411 self.assertRaises(
412 BranchCannotChangeInformationType,
413@@ -2456,7 +2464,8 @@
414 # If a private branch is stacked on a public branch, it can change
415 # its information_type.
416 stacked_on = self.factory.makeBranch()
417- branch = self.factory.makeBranch(stacked_on=stacked_on, private=True)
418+ branch = self.factory.makeBranch(
419+ stacked_on=stacked_on, information_type=InformationType.USERDATA)
420 branch.transitionToInformationType(
421 InformationType.UNEMBARGOEDSECURITY, branch.owner)
422 self.assertEqual(
423
424=== modified file 'lib/lp/code/model/tests/test_branchcollection.py'
425--- lib/lp/code/model/tests/test_branchcollection.py 2012-05-15 08:16:09 +0000
426+++ lib/lp/code/model/tests/test_branchcollection.py 2012-06-01 02:30:29 +0000
427@@ -1,4 +1,4 @@
428-# Copyright 2009-2011 Canonical Ltd. This software is licensed under the
429+# Copyright 2009-2012 Canonical Ltd. This software is licensed under the
430 # GNU Affero General Public License version 3 (see the file LICENSE).
431
432 """Tests for branch collections."""
433@@ -159,7 +159,8 @@
434 for i in range(branch_number):
435 branches.append(
436 self.factory.makeStackedOnBranchChain(
437- owner=person, private=True, depth=depth))
438+ owner=person, depth=depth,
439+ information_type=InformationType.USERDATA))
440 with person_logged_in(person):
441 all_branches = (
442 GenericBranchCollection.preloadVisibleStackedOnBranches(
443@@ -173,8 +174,7 @@
444 branches = []
445 for i in range(branch_number):
446 branches.append(
447- self.factory.makeStackedOnBranchChain(
448- private=False, depth=depth))
449+ self.factory.makeStackedOnBranchChain(depth=depth))
450 all_branches = (
451 GenericBranchCollection.preloadVisibleStackedOnBranches(branches))
452 self.assertEqual(len(all_branches), branch_number * depth)
453@@ -188,7 +188,7 @@
454 for i in range(branch_number):
455 branches.append(
456 self.factory.makeStackedOnBranchChain(
457- owner=person, private=False, depth=depth))
458+ owner=person, depth=depth))
459 with person_logged_in(person):
460 all_branches = (
461 GenericBranchCollection.preloadVisibleStackedOnBranches(
462@@ -222,7 +222,7 @@
463 # IBranchCollection.count() returns the number of branches that
464 # getBranches() yields, even when the visibleByUser filter is applied.
465 branch = self.factory.makeAnyBranch()
466- self.factory.makeAnyBranch(private=True)
467+ self.factory.makeAnyBranch(information_type=InformationType.USERDATA)
468 collection = self.all_branches.visibleByUser(branch.owner)
469 self.assertEqual(1, collection.getBranches().count())
470 self.assertEqual(1, len(list(collection.getBranches())))
471@@ -588,13 +588,13 @@
472 # We make private branch by stacking a public branch on top of a
473 # private one.
474 self.private_stacked_on_branch = self.factory.makeAnyBranch(
475- private=True)
476+ information_type=InformationType.USERDATA)
477 self.public_stacked_on_branch = self.factory.makeAnyBranch(
478 stacked_on=self.private_stacked_on_branch)
479 self.private_branch1 = self.factory.makeAnyBranch(
480 stacked_on=self.public_stacked_on_branch, name='private1')
481 self.private_branch2 = self.factory.makeAnyBranch(
482- private=True, name='private2')
483+ name='private2', information_type=InformationType.USERDATA)
484 self.all_branches = getUtility(IAllBranches)
485
486 def test_all_branches(self):
487@@ -685,7 +685,8 @@
488 # branch, even if it's private.
489 team_owner = self.factory.makePerson()
490 team = self.factory.makeTeam(team_owner)
491- private_branch = self.factory.makeAnyBranch(private=True)
492+ private_branch = self.factory.makeAnyBranch(
493+ information_type=InformationType.USERDATA)
494 # Subscribe the team.
495 removeSecurityProxy(private_branch).subscribe(
496 team, BranchSubscriptionNotificationLevel.NOEMAIL,
497@@ -973,7 +974,8 @@
498 # Don't include proposals if the target branch is private for
499 # anonymous views.
500 reviewer = self.factory.makePerson()
501- target_branch = self.factory.makeAnyBranch(private=True)
502+ target_branch = self.factory.makeAnyBranch(
503+ information_type=InformationType.USERDATA)
504 proposal = self.factory.makeBranchMergeProposal(
505 target_branch=target_branch)
506 proposal.nominateReviewer(reviewer, reviewer)
507@@ -987,7 +989,7 @@
508 reviewer = self.factory.makePerson()
509 product = self.factory.makeProduct()
510 source_branch = self.factory.makeProductBranch(
511- product=product, private=True)
512+ product=product, information_type=InformationType.USERDATA)
513 target_branch = self.factory.makeProductBranch(product=product)
514 proposal = self.factory.makeBranchMergeProposal(
515 source_branch=source_branch, target_branch=target_branch)
516
517=== modified file 'lib/lp/code/model/tests/test_branchlookup.py'
518--- lib/lp/code/model/tests/test_branchlookup.py 2012-05-25 01:48:31 +0000
519+++ lib/lp/code/model/tests/test_branchlookup.py 2012-06-01 02:30:29 +0000
520@@ -1,4 +1,4 @@
521-# Copyright 2009-2011 Canonical Ltd. This software is licensed under the
522+# Copyright 2009-2012 Canonical Ltd. This software is licensed under the
523 # GNU Affero General Public License version 3 (see the file LICENSE).
524
525 """Tests for the IBranchLookup implementation."""
526@@ -25,6 +25,7 @@
527 BRANCH_ID_ALIAS_PREFIX,
528 )
529 from lp.code.interfaces.linkedbranch import ICanHasLinkedBranch
530+from lp.registry.enums import InformationType
531 from lp.registry.errors import (
532 NoSuchDistroSeries,
533 NoSuchSourcePackageName,
534@@ -135,7 +136,8 @@
535 def test_branch_id_alias_private(self):
536 # Private branches are not found at all (this is for anonymous access)
537 owner = self.factory.makePerson()
538- branch = self.factory.makeAnyBranch(owner=owner, private=True)
539+ branch = self.factory.makeAnyBranch(
540+ owner=owner, information_type=InformationType.USERDATA)
541 with person_logged_in(owner):
542 path = branch_id_alias(branch)
543 result = self.branch_set.getIdAndTrailingPath(path)
544@@ -146,7 +148,7 @@
545 # (this is for anonymous access)
546 owner = self.factory.makePerson()
547 private_branch = self.factory.makeAnyBranch(
548- owner=owner, private=True)
549+ owner=owner, information_type=InformationType.USERDATA)
550 branch = self.factory.makeAnyBranch(
551 stacked_on=private_branch, owner=owner)
552 with person_logged_in(owner):
553@@ -547,7 +549,8 @@
554 def test_private_branch(self):
555 # If the unique name refers to an invisible branch, getByLPPath raises
556 # NoSuchBranch, just as if the branch weren't there at all.
557- branch = self.factory.makeAnyBranch(private=True)
558+ branch = self.factory.makeAnyBranch(
559+ information_type=InformationType.USERDATA)
560 path = removeSecurityProxy(branch).unique_name
561 self.assertRaises(
562 NoSuchBranch, self.branch_lookup.getByLPPath, path)
563@@ -555,7 +558,8 @@
564 def test_transitive_private_branch(self):
565 # If the unique name refers to an invisible branch, getByLPPath raises
566 # NoSuchBranch, just as if the branch weren't there at all.
567- private_branch = self.factory.makeAnyBranch(private=True)
568+ private_branch = self.factory.makeAnyBranch(
569+ information_type=InformationType.USERDATA)
570 branch = self.factory.makeAnyBranch(stacked_on=private_branch)
571 path = removeSecurityProxy(branch).unique_name
572 self.assertRaises(
573@@ -642,7 +646,8 @@
574 # If the given path refers to an object with an invisible linked
575 # branch, then getByLPPath raises `NoLinkedBranch`, as if the branch
576 # weren't there at all.
577- branch = self.factory.makeProductBranch(private=True)
578+ branch = self.factory.makeProductBranch(
579+ information_type=InformationType.USERDATA)
580 product = removeSecurityProxy(branch).product
581 removeSecurityProxy(product).development_focus.branch = branch
582 self.assertRaises(
583@@ -652,7 +657,8 @@
584 # If the given path refers to an object with an invisible linked
585 # branch, then getByLPPath raises `NoLinkedBranch`, as if the branch
586 # weren't there at all.
587- private_branch = self.factory.makeProductBranch(private=True)
588+ private_branch = self.factory.makeProductBranch(
589+ information_type=InformationType.USERDATA)
590 branch = self.factory.makeProductBranch(stacked_on=private_branch)
591 product = removeSecurityProxy(branch).product
592 removeSecurityProxy(product).development_focus.branch = branch
593
594=== modified file 'lib/lp/code/model/tests/test_branchmergeproposal.py'
595--- lib/lp/code/model/tests/test_branchmergeproposal.py 2012-05-24 02:16:59 +0000
596+++ lib/lp/code/model/tests/test_branchmergeproposal.py 2012-06-01 02:30:29 +0000
597@@ -1504,7 +1504,8 @@
598 product = self.factory.makeProduct()
599 # We make a source branch stacked on a private one.
600 base_branch = self.factory.makeBranch(
601- owner=owner, private=True, product=product)
602+ owner=owner, product=product,
603+ information_type=InformationType.USERDATA)
604 source_branch = self.factory.makeBranch(
605 stacked_on=base_branch, product=product, owner=owner)
606 target_branch = self.factory.makeBranch(owner=owner, product=product)
607
608=== modified file 'lib/lp/code/model/tests/test_branchmergequeuecollection.py'
609--- lib/lp/code/model/tests/test_branchmergequeuecollection.py 2012-01-01 02:58:52 +0000
610+++ lib/lp/code/model/tests/test_branchmergequeuecollection.py 2012-06-01 02:30:29 +0000
611@@ -1,4 +1,4 @@
612-# Copyright 2009 Canonical Ltd. This software is licensed under the
613+# Copyright 2009-2012 Canonical Ltd. This software is licensed under the
614 # GNU Affero General Public License version 3 (see the file LICENSE).
615
616 """Tests for branch merge queue collections."""
617@@ -18,6 +18,7 @@
618 from lp.code.model.branchmergequeuecollection import (
619 GenericBranchMergeQueueCollection,
620 )
621+from lp.registry.enums import InformationType
622 from lp.services.database.lpstorm import IMasterStore
623 from lp.testing import TestCaseWithFactory
624 from lp.testing.layers import DatabaseFunctionalLayer
625@@ -65,8 +66,8 @@
626 # will be the size of that subset. That is, 'count' respects any
627 # filters that are applied.
628 person = self.factory.makePerson()
629- queue = self.factory.makeBranchMergeQueue(owner=person)
630- queue2 = self.factory.makeAnyBranch()
631+ self.factory.makeBranchMergeQueue(owner=person)
632+ self.factory.makeAnyBranch()
633 collection = GenericBranchMergeQueueCollection(
634 self.store, [BranchMergeQueue.owner == person])
635 self.assertEqual(1, collection.count())
636@@ -84,12 +85,14 @@
637 # IBranchMergeQueueCollection.count() returns the number of queues
638 # that getMergeQueues() yields, even when the visibleByUser filter is
639 # applied.
640- branch = self.factory.makeAnyBranch(private=True)
641+ branch = self.factory.makeAnyBranch(
642+ information_type=InformationType.USERDATA)
643 naked_branch = removeSecurityProxy(branch)
644- queue = self.factory.makeBranchMergeQueue(branches=[naked_branch])
645- branch2 = self.factory.makeAnyBranch(private=True)
646+ self.factory.makeBranchMergeQueue(branches=[naked_branch])
647+ branch2 = self.factory.makeAnyBranch(
648+ information_type=InformationType.USERDATA)
649 naked_branch2 = removeSecurityProxy(branch2)
650- queue2 = self.factory.makeBranchMergeQueue(branches=[naked_branch2])
651+ self.factory.makeBranchMergeQueue(branches=[naked_branch2])
652 collection = self.all_queues.visibleByUser(naked_branch.owner)
653 self.assertEqual(1, len(collection.getMergeQueues()))
654 self.assertEqual(1, collection.count())
655@@ -98,7 +101,7 @@
656 # 'ownedBy' returns a new collection restricted to queues owned by
657 # the given person.
658 queue = self.factory.makeBranchMergeQueue()
659- queue2 = self.factory.makeBranchMergeQueue()
660+ self.factory.makeBranchMergeQueue()
661 collection = self.all_queues.ownedBy(queue.owner)
662 self.assertEqual([queue], collection.getMergeQueues())
663
664@@ -113,13 +116,13 @@
665 self.queue_with_public_branch = self.factory.makeBranchMergeQueue(
666 branches=[removeSecurityProxy(public_branch)])
667 private_branch1 = self.factory.makeAnyBranch(
668- private=True, name='private1')
669+ name='private1', information_type=InformationType.USERDATA)
670 naked_private_branch1 = removeSecurityProxy(private_branch1)
671 self.private_branch1_owner = naked_private_branch1.owner
672 self.queue1_with_private_branch = self.factory.makeBranchMergeQueue(
673 branches=[naked_private_branch1])
674 private_branch2 = self.factory.makeAnyBranch(
675- private=True, name='private2')
676+ name='private2', information_type=InformationType.USERDATA)
677 self.queue2_with_private_branch = self.factory.makeBranchMergeQueue(
678 branches=[removeSecurityProxy(private_branch2)])
679 self.all_queues = getUtility(IAllBranchMergeQueues)
680@@ -162,7 +165,8 @@
681 team_owner = self.factory.makePerson()
682 team = self.factory.makeTeam(team_owner)
683 private_branch = self.factory.makeAnyBranch(
684- owner=team, private=True, name='team')
685+ owner=team, name='team',
686+ information_type=InformationType.USERDATA)
687 queue_with_private_branch = self.factory.makeBranchMergeQueue(
688 branches=[removeSecurityProxy(private_branch)])
689 queues = self.all_queues.visibleByUser(team_owner)
690
691=== modified file 'lib/lp/code/model/tests/test_branchpuller.py'
692--- lib/lp/code/model/tests/test_branchpuller.py 2012-04-06 17:28:25 +0000
693+++ lib/lp/code/model/tests/test_branchpuller.py 2012-06-01 02:30:29 +0000
694@@ -1,4 +1,4 @@
695-# Copyright 2009 Canonical Ltd. This software is licensed under the
696+# Copyright 2009-2012 Canonical Ltd. This software is licensed under the
697 # GNU Affero General Public License version 3 (see the file LICENSE).
698
699 """Tests for the branch puller model code."""
700@@ -17,6 +17,7 @@
701
702 from lp.code.enums import BranchType
703 from lp.code.interfaces.branchpuller import IBranchPuller
704+from lp.registry.enums import InformationType
705 from lp.services.database.constants import UTC_NOW
706 from lp.testing import (
707 login_person,
708@@ -218,7 +219,8 @@
709 # If there is a private branch that needs mirroring,
710 # acquireBranchToPull returns that.
711 branch = self.factory.makeAnyBranch(
712- branch_type=BranchType.MIRRORED, private=True)
713+ branch_type=BranchType.MIRRORED,
714+ information_type=InformationType.USERDATA)
715 removeSecurityProxy(branch).requestMirror()
716 self.assertBranchIsAcquired(branch)
717
718
719=== modified file 'lib/lp/code/model/tests/test_branchset.py'
720--- lib/lp/code/model/tests/test_branchset.py 2012-01-30 06:02:10 +0000
721+++ lib/lp/code/model/tests/test_branchset.py 2012-06-01 02:30:29 +0000
722@@ -1,4 +1,4 @@
723-# Copyright 2009 Canonical Ltd. This software is licensed under the
724+# Copyright 2009-2012 Canonical Ltd. This software is licensed under the
725 # GNU Affero General Public License version 3 (see the file LICENSE).
726
727 """Tests for BranchSet."""
728@@ -10,6 +10,7 @@
729
730 from lp.code.interfaces.branch import IBranchSet
731 from lp.code.model.branch import BranchSet
732+from lp.registry.enums import InformationType
733 from lp.testing import (
734 login_person,
735 logout,
736@@ -74,7 +75,8 @@
737 person = self.factory.makePerson(name='fred')
738 owner = self.factory.makePerson()
739 visible_branch = self.factory.makeBranch()
740- invisible_branch = self.factory.makeBranch(owner=owner, private=True)
741+ invisible_branch = self.factory.makeBranch(
742+ owner=owner, information_type=InformationType.USERDATA)
743 invisible_name = removeSecurityProxy(invisible_branch).unique_name
744 branches = [
745 visible_branch.unique_name,
746@@ -96,7 +98,8 @@
747 person = self.factory.makePerson(name='fred')
748 owner = self.factory.makePerson()
749 visible_branch = self.factory.makeBranch()
750- invisible_branch = self.factory.makeBranch(owner=owner, private=True)
751+ invisible_branch = self.factory.makeBranch(
752+ owner=owner, information_type=InformationType.USERDATA)
753 invisible_name = removeSecurityProxy(invisible_branch).unique_name
754 branches = [
755 visible_branch.unique_name,
756
757=== modified file 'lib/lp/code/model/tests/test_branchtarget.py'
758--- lib/lp/code/model/tests/test_branchtarget.py 2012-04-06 17:28:25 +0000
759+++ lib/lp/code/model/tests/test_branchtarget.py 2012-06-01 02:30:29 +0000
760@@ -1,4 +1,4 @@
761-# Copyright 2009 Canonical Ltd. This software is licensed under the
762+# Copyright 2009-2012 Canonical Ltd. This software is licensed under the
763 # GNU Affero General Public License version 3 (see the file LICENSE).
764
765 """Tests for branch contexts."""
766@@ -19,6 +19,7 @@
767 PersonBranchTarget,
768 ProductBranchTarget,
769 )
770+from lp.registry.enums import InformationType
771 from lp.registry.interfaces.pocket import PackagePublishingPocket
772 from lp.services.webapp import canonical_url
773 from lp.services.webapp.interfaces import IPrimaryContext
774@@ -544,13 +545,15 @@
775 def test_invisible(self):
776 # `check_default_stacked_on` returns None for branches invisible to
777 # the current user.
778- branch = self.factory.makeAnyBranch(private=True)
779+ branch = self.factory.makeAnyBranch(
780+ information_type=InformationType.USERDATA)
781 self.assertIs(None, check_default_stacked_on(branch))
782
783 def test_invisible_been_mirrored(self):
784 # `check_default_stacked_on` returns None for branches invisible to
785 # the current user, even if those branches have already been mirrored.
786- branch = self.factory.makeAnyBranch(private=True)
787+ branch = self.factory.makeAnyBranch(
788+ information_type=InformationType.USERDATA)
789 naked_branch = removeSecurityProxy(branch)
790 naked_branch.branchChanged(
791 '', self.factory.getUniqueString(), None, None, None)
792
793=== modified file 'lib/lp/code/model/tests/test_branchvisibility.py'
794--- lib/lp/code/model/tests/test_branchvisibility.py 2012-05-24 02:16:59 +0000
795+++ lib/lp/code/model/tests/test_branchvisibility.py 2012-06-01 02:30:29 +0000
796@@ -26,6 +26,7 @@
797 CodeReviewNotificationLevel,
798 )
799 from lp.code.interfaces.branch import IBranchSet
800+from lp.registry.enums import InformationType
801 from lp.registry.interfaces.role import IPersonRoles
802 from lp.security import AccessBranch
803 from lp.services.webapp.authorization import (
804@@ -76,7 +77,8 @@
805 # The owners of a branch always have visibility of their own branches.
806
807 owner = self.factory.makePerson()
808- branch = self.factory.makeBranch(owner=owner, private=True)
809+ branch = self.factory.makeBranch(
810+ owner=owner, information_type=InformationType.USERDATA)
811 naked_branch = removeSecurityProxy(branch)
812
813 clear_cache() # Clear authorization cache for check_permission.
814@@ -89,7 +91,8 @@
815 def test_visible_to_administrator(self):
816 # Launchpad administrators often have a need to see private
817 # Launchpad things in order to fix up fubars by users.
818- branch = self.factory.makeBranch(private=True)
819+ branch = self.factory.makeBranch(
820+ information_type=InformationType.USERDATA)
821 naked_branch = removeSecurityProxy(branch)
822 admin = getUtility(ILaunchpadCelebrities).admin.teamowner
823 access = AccessBranch(naked_branch)
824@@ -98,7 +101,8 @@
825 def test_visible_to_subscribers(self):
826 # Branches that are not public are viewable by members of the
827 # visibility_team and to subscribers.
828- branch = self.factory.makeBranch(private=True)
829+ branch = self.factory.makeBranch(
830+ information_type=InformationType.USERDATA)
831 naked_branch = removeSecurityProxy(branch)
832 person = self.factory.makePerson()
833 teamowner = self.factory.makePerson()
834@@ -135,10 +139,16 @@
835 test_branches = []
836 for x in range(5):
837 # We want the first 3 public and the last 3 private.
838- branch = self.factory.makeBranch(private=x > 2)
839+ information_type = InformationType.PUBLIC
840+ if x > 2:
841+ information_type = InformationType.USERDATA
842+ branch = self.factory.makeBranch(
843+ information_type=information_type)
844 test_branches.append(branch)
845 test_branches.append(
846- self.factory.makeBranch(private=True, owner=private_owner))
847+ self.factory.makeBranch(
848+ owner=private_owner,
849+ information_type=InformationType.USERDATA))
850
851 # Anonymous users see just the public branches.
852 branch_info = [(branch, branch.private)
853
854=== modified file 'lib/lp/code/model/tests/test_revision.py'
855--- lib/lp/code/model/tests/test_revision.py 2012-02-28 04:24:19 +0000
856+++ lib/lp/code/model/tests/test_revision.py 2012-06-01 02:30:29 +0000
857@@ -1,4 +1,4 @@
858-# Copyright 2009-2011 Canonical Ltd. This software is licensed under the
859+# Copyright 2009-2012 Canonical Ltd. This software is licensed under the
860 # GNU Affero General Public License version 3 (see the file LICENSE).
861
862 """Tests for Revisions."""
863@@ -26,6 +26,7 @@
864 RevisionCache,
865 RevisionSet,
866 )
867+from lp.registry.enums import InformationType
868 from lp.registry.model.karma import Karma
869 from lp.scripts.garbo import RevisionAuthorEmailLinker
870 from lp.services.database.lpstorm import IMasterObject
871@@ -847,7 +848,8 @@
872 def test_revisions_for_private_branch_marked_private(self):
873 # If the branch is private, then the revisions in the cache will be
874 # marked private too.
875- branch = self.factory.makeAnyBranch(private=True)
876+ branch = self.factory.makeAnyBranch(
877+ information_type=InformationType.USERDATA)
878 revision = self.factory.makeRevision()
879 branch.createBranchRevision(1, revision)
880 RevisionSet.updateRevisionCacheForBranch(branch)
881@@ -858,7 +860,8 @@
882 def test_revisions_for_transitive_private_branch_marked_private(self):
883 # If the branch is stacked on a private branch, then the revisions in
884 # the cache will be marked private too.
885- private_branch = self.factory.makeAnyBranch(private=True)
886+ private_branch = self.factory.makeAnyBranch(
887+ information_type=InformationType.USERDATA)
888 branch = self.factory.makeAnyBranch(stacked_on=private_branch)
889 revision = self.factory.makeRevision()
890 branch.createBranchRevision(1, revision)
891@@ -929,8 +932,9 @@
892 def test_existing_private_revisions_with_public_branch(self):
893 # If a revision is in both public and private branches, there is a
894 # revision cache row for both public and private.
895- private_branch = self.factory.makeAnyBranch(private=True)
896- public_branch = self.factory.makeAnyBranch(private=False)
897+ private_branch = self.factory.makeAnyBranch(
898+ information_type=InformationType.USERDATA)
899+ public_branch = self.factory.makeAnyBranch()
900 revision = self.factory.makeRevision()
901 private_branch.createBranchRevision(1, revision)
902 RevisionSet.updateRevisionCacheForBranch(private_branch)
903@@ -947,10 +951,11 @@
904 # If a revision is in both public and private branches, there is a
905 # revision cache row for both public and private. A branch is private
906 # if it is stacked on a private branch.
907- stacked_on_branch = self.factory.makeAnyBranch(private=True)
908+ stacked_on_branch = self.factory.makeAnyBranch(
909+ information_type=InformationType.USERDATA)
910 private_branch = self.factory.makeAnyBranch(
911 stacked_on=stacked_on_branch)
912- public_branch = self.factory.makeAnyBranch(private=False)
913+ public_branch = self.factory.makeAnyBranch()
914 revision = self.factory.makeRevision()
915 private_branch.createBranchRevision(1, revision)
916 RevisionSet.updateRevisionCacheForBranch(private_branch)
917
918=== modified file 'lib/lp/code/model/tests/test_sourcepackagerecipe.py'
919--- lib/lp/code/model/tests/test_sourcepackagerecipe.py 2012-05-24 02:16:59 +0000
920+++ lib/lp/code/model/tests/test_sourcepackagerecipe.py 2012-06-01 02:30:29 +0000
921@@ -141,7 +141,8 @@
922 """An exception should be raised if the base branch is private."""
923 owner = self.factory.makePerson()
924 with person_logged_in(owner):
925- branch = self.factory.makeAnyBranch(private=True, owner=owner)
926+ branch = self.factory.makeAnyBranch(
927+ owner=owner, information_type=InformationType.USERDATA)
928 components = self.makeRecipeComponents(branches=[branch])
929 recipe_source = getUtility(ISourcePackageRecipeSource)
930 e = self.assertRaises(
931@@ -156,7 +157,7 @@
932 with person_logged_in(owner):
933 base_branch = self.factory.makeAnyBranch(owner=owner)
934 referenced_branch = self.factory.makeAnyBranch(
935- private=True, owner=owner)
936+ owner=owner, information_type=InformationType.USERDATA)
937 branches = [base_branch, referenced_branch]
938 components = self.makeRecipeComponents(branches=branches)
939 recipe_source = getUtility(ISourcePackageRecipeSource)
940@@ -698,7 +699,8 @@
941 source_package_recipe = self.factory.makeSourcePackageRecipe()
942 with person_logged_in(source_package_recipe.owner):
943 branch = self.factory.makeAnyBranch(
944- private=True, owner=source_package_recipe.owner)
945+ owner=source_package_recipe.owner,
946+ information_type=InformationType.USERDATA)
947 recipe_text = self.factory.makeRecipeText(branch)
948 e = self.assertRaises(
949 PrivateBranchRecipe, source_package_recipe.setRecipeText,
950@@ -713,7 +715,8 @@
951 base_branch = self.factory.makeAnyBranch(
952 owner=source_package_recipe.owner)
953 referenced_branch = self.factory.makeAnyBranch(
954- private=True, owner=source_package_recipe.owner)
955+ owner=source_package_recipe.owner,
956+ information_type=InformationType.USERDATA)
957 recipe_text = self.factory.makeRecipeText(
958 base_branch, referenced_branch)
959 e = self.assertRaises(
960
961=== modified file 'lib/lp/code/stories/branches/xx-private-branch-listings.txt'
962--- lib/lp/code/stories/branches/xx-private-branch-listings.txt 2011-12-30 06:14:56 +0000
963+++ lib/lp/code/stories/branches/xx-private-branch-listings.txt 2012-06-01 02:30:29 +0000
964@@ -25,6 +25,7 @@
965 >>> from zope.component import getUtility
966 >>> from lp.services.database.sqlbase import flush_database_updates
967 >>> from lp.code.enums import BranchType
968+ >>> from lp.registry.enums import InformationType
969 >>> from lp.registry.interfaces.person import IPersonSet
970 >>> from lp.registry.interfaces.product import IProductSet
971 >>> login('no-priv@canonical.com')
972@@ -32,7 +33,7 @@
973 >>> landscape = getUtility(IProductSet).getByName('landscape')
974 >>> branch = factory.makePersonalBranch(
975 ... branch_type=BranchType.HOSTED, name='testing-branch',
976- ... owner=no_priv, title='A Private Branch', private=True)
977+ ... owner=no_priv, information_type=InformationType.USERDATA)
978 >>> from zope.security.proxy import removeSecurityProxy
979 >>> removeSecurityProxy(branch).product = landscape
980 >>> flush_database_updates()
981
982=== modified file 'lib/lp/code/tests/helpers.py'
983--- lib/lp/code/tests/helpers.py 2012-01-15 13:32:27 +0000
984+++ lib/lp/code/tests/helpers.py 2012-06-01 02:30:29 +0000
985@@ -1,4 +1,4 @@
986-# Copyright 2009-2011 Canonical Ltd. This software is licensed under the
987+# Copyright 2009-2012 Canonical Ltd. This software is licensed under the
988 # GNU Affero General Public License version 3 (see the file LICENSE).
989
990 """Helper functions for code testing live here."""
991@@ -38,6 +38,7 @@
992 from lp.code.model.seriessourcepackagebranch import (
993 SeriesSourcePackageBranchSet,
994 )
995+from lp.registry.enums import InformationType
996 from lp.registry.interfaces.pocket import PackagePublishingPocket
997 from lp.registry.interfaces.series import SeriesStatus
998 from lp.services.database.sqlbase import cursor
999@@ -266,7 +267,12 @@
1000 """Make a new branch with revisions."""
1001 if revision_count is None:
1002 revision_count = 5
1003- branch = factory.makeProductBranch(product=product, private=private)
1004+ if private:
1005+ information_type = InformationType.USERDATA
1006+ else:
1007+ information_type = InformationType.PUBLIC
1008+ branch = factory.makeProductBranch(
1009+ product=product, information_type=information_type)
1010 naked_branch = removeSecurityProxy(branch)
1011 factory.makeRevisionsForBranch(
1012 naked_branch, count=revision_count, date_generator=date_generator)
1013
1014=== modified file 'lib/lp/code/tests/test_branch.py'
1015--- lib/lp/code/tests/test_branch.py 2012-01-01 02:58:52 +0000
1016+++ lib/lp/code/tests/test_branch.py 2012-06-01 02:30:29 +0000
1017@@ -1,4 +1,4 @@
1018-# Copyright 2009-2010 Canonical Ltd. This software is licensed under the
1019+# Copyright 2009-2012 Canonical Ltd. This software is licensed under the
1020 # GNU Affero General Public License version 3 (see the file LICENSE).
1021
1022 """Unit tests for methods of Branch and BranchSet."""
1023@@ -14,6 +14,7 @@
1024 )
1025 from lp.code.interfaces.codehosting import SUPPORTED_SCHEMES
1026 from lp.code.tests.helpers import make_official_package_branch
1027+from lp.registry.enums import InformationType
1028 from lp.services.webapp.authorization import check_permission
1029 from lp.soyuz.interfaces.archivepermission import IArchivePermissionSet
1030 from lp.testing import (
1031@@ -106,13 +107,15 @@
1032
1033 def test_privateBranchUnauthenticated(self):
1034 # Private branches cannot be accessed without authentication.
1035- branch = self.factory.makeAnyBranch(private=True)
1036+ branch = self.factory.makeAnyBranch(
1037+ information_type=InformationType.USERDATA)
1038 self.assertUnauthenticatedView(branch, False)
1039
1040 def test_privateBranchOwner(self):
1041 # The owner of a branch can always access it.
1042 owner = self.factory.makePerson()
1043- branch = self.factory.makeAnyBranch(private=True, owner=owner)
1044+ branch = self.factory.makeAnyBranch(
1045+ owner=owner, information_type=InformationType.USERDATA)
1046 self.assertAuthenticatedView(branch, owner, True)
1047
1048 def test_privateBranchOwnerMember(self):
1049@@ -121,18 +124,21 @@
1050 team = self.factory.makeTeam(team_owner)
1051 person = self.factory.makePerson()
1052 removeSecurityProxy(team).addMember(person, team_owner)
1053- branch = self.factory.makeAnyBranch(private=True, owner=team)
1054+ branch = self.factory.makeAnyBranch(
1055+ owner=team, information_type=InformationType.USERDATA)
1056 self.assertAuthenticatedView(branch, person, True)
1057
1058 def test_privateBranchAdmins(self):
1059 # Launchpad admins can access any branch.
1060 celebs = getUtility(ILaunchpadCelebrities)
1061- branch = self.factory.makeAnyBranch(private=True)
1062+ branch = self.factory.makeAnyBranch(
1063+ information_type=InformationType.USERDATA)
1064 self.assertAuthenticatedView(branch, celebs.admin.teamowner, True)
1065
1066 def test_privateBranchSubscriber(self):
1067 # If you are subscribed to a branch, you can access it.
1068- branch = self.factory.makeAnyBranch(private=True)
1069+ branch = self.factory.makeAnyBranch(
1070+ information_type=InformationType.USERDATA)
1071 person = self.factory.makePerson()
1072 removeSecurityProxy(branch).subscribe(
1073 person, BranchSubscriptionNotificationLevel.NOEMAIL,
1074@@ -142,14 +148,16 @@
1075
1076 def test_privateBranchAnyoneElse(self):
1077 # In general, you can't access a private branch.
1078- branch = self.factory.makeAnyBranch(private=True)
1079+ branch = self.factory.makeAnyBranch(
1080+ information_type=InformationType.USERDATA)
1081 person = self.factory.makePerson()
1082 self.assertAuthenticatedView(branch, person, False)
1083
1084 def test_stackedOnPrivateBranchUnauthenticated(self):
1085 # If a branch is stacked on a private branch, then you cannot access
1086 # it when unauthenticated.
1087- stacked_on_branch = self.factory.makeAnyBranch(private=True)
1088+ stacked_on_branch = self.factory.makeAnyBranch(
1089+ information_type=InformationType.USERDATA)
1090 stacked_branch = self.factory.makeAnyBranch(
1091 stacked_on=stacked_on_branch)
1092 self.assertUnauthenticatedView(stacked_branch, False)
1093@@ -157,7 +165,8 @@
1094 def test_stackedOnPrivateBranchAuthenticated(self):
1095 # If a branch is stacked on a private branch, you can only access it
1096 # if you can access both branches.
1097- stacked_on_branch = self.factory.makeAnyBranch(private=True)
1098+ stacked_on_branch = self.factory.makeAnyBranch(
1099+ information_type=InformationType.USERDATA)
1100 stacked_branch = self.factory.makeAnyBranch(
1101 stacked_on=stacked_on_branch)
1102 person = self.factory.makePerson()
1103@@ -166,7 +175,8 @@
1104 def test_manyLevelsOfStackingUnauthenticated(self):
1105 # If a branch is stacked on a branch stacked on a private branch, you
1106 # still can't access it when unauthenticated.
1107- stacked_on_branch = self.factory.makeAnyBranch(private=True)
1108+ stacked_on_branch = self.factory.makeAnyBranch(
1109+ information_type=InformationType.USERDATA)
1110 branch_a = self.factory.makeAnyBranch(stacked_on=stacked_on_branch)
1111 branch_b = self.factory.makeAnyBranch(stacked_on=branch_a)
1112 self.assertUnauthenticatedView(branch_b, False)
1113@@ -174,7 +184,8 @@
1114 def test_manyLevelsOfStackingAuthenticated(self):
1115 # If a branch is stacked on a branch stacked on a private branch, you
1116 # still can't access it when unauthenticated.
1117- stacked_on_branch = self.factory.makeAnyBranch(private=True)
1118+ stacked_on_branch = self.factory.makeAnyBranch(
1119+ information_type=InformationType.USERDATA)
1120 branch_a = self.factory.makeAnyBranch(stacked_on=stacked_on_branch)
1121 branch_b = self.factory.makeAnyBranch(stacked_on=branch_a)
1122 person = self.factory.makePerson()
1123@@ -195,7 +206,8 @@
1124 # loop. e.g., branch A is stacked on branch B is stacked on branch A.
1125 # If all of these branches are private, then only people who can
1126 # access all of them can get to them.
1127- stacked_branch = self.factory.makeAnyBranch(private=True)
1128+ stacked_branch = self.factory.makeAnyBranch(
1129+ information_type=InformationType.USERDATA)
1130 removeSecurityProxy(stacked_branch).stacked_on = stacked_branch
1131 person = self.factory.makePerson()
1132 self.assertAuthenticatedView(stacked_branch, person, False)
1133@@ -368,7 +380,8 @@
1134
1135 def test_composePublicURL_http_private(self):
1136 # Private branches don't have public http URLs.
1137- branch = self.factory.makeAnyBranch(private=True)
1138+ branch = self.factory.makeAnyBranch(
1139+ information_type=InformationType.USERDATA)
1140 self.assertRaises(AssertionError, branch.composePublicURL, 'http')
1141
1142 def test_composePublicURL_no_https(self):
1143
1144=== modified file 'lib/lp/code/tests/test_branch_webservice.py'
1145--- lib/lp/code/tests/test_branch_webservice.py 2012-02-06 05:33:31 +0000
1146+++ lib/lp/code/tests/test_branch_webservice.py 2012-06-01 02:30:29 +0000
1147@@ -10,6 +10,7 @@
1148
1149 from lp.code.interfaces.branch import IBranchSet
1150 from lp.code.interfaces.linkedbranch import ICanHasLinkedBranch
1151+from lp.registry.enums import InformationType
1152 from lp.registry.interfaces.pocket import PackagePublishingPocket
1153 from lp.testing import (
1154 api_url,
1155@@ -55,7 +56,8 @@
1156 owner = self.factory.makePerson()
1157 visible_branch = self.factory.makeBranch()
1158 visible_name = visible_branch.unique_name
1159- invisible_branch = self.factory.makeBranch(owner=owner, private=True)
1160+ invisible_branch = self.factory.makeBranch(
1161+ owner=owner, information_type=InformationType.USERDATA)
1162 invisible_name = removeSecurityProxy(invisible_branch).unique_name
1163 branches = [
1164 visible_branch.unique_name,
1165
1166=== modified file 'lib/lp/code/xmlrpc/tests/test_branch.py'
1167--- lib/lp/code/xmlrpc/tests/test_branch.py 2012-05-24 02:16:59 +0000
1168+++ lib/lp/code/xmlrpc/tests/test_branch.py 2012-06-01 02:30:29 +0000
1169@@ -303,7 +303,8 @@
1170 # Invisible branches are resolved as if they didn't exist, so that we
1171 # reveal the least possile amount of information about them.
1172 # For fully specified branch names, this means resolving the lp url.
1173- branch = self.factory.makeAnyBranch(private=True)
1174+ branch = self.factory.makeAnyBranch(
1175+ information_type=InformationType.USERDATA)
1176 # Removing security proxy to get at the unique_name attribute of a
1177 # private branch, and tests are currently running as an anonymous
1178 # user.
1179@@ -316,7 +317,8 @@
1180 # Removing security proxy because we need to be able to get at
1181 # attributes of a private branch and these tests are running as an
1182 # anonymous user.
1183- branch = self.factory.makeAnyBranch(private=True)
1184+ branch = self.factory.makeAnyBranch(
1185+ information_type=InformationType.USERDATA)
1186 series = self.factory.makeProductSeries(branch=branch)
1187 lp_path = '%s/%s' % (series.product.name, series.name)
1188 self.assertOnlyWritableResolves(lp_path)
1189@@ -339,7 +341,8 @@
1190 # Create the owner explicitly so that we can get its email without
1191 # resorting to removeSecurityProxy.
1192 owner = self.factory.makePerson()
1193- branch = self.factory.makeAnyBranch(owner=owner, private=True)
1194+ branch = self.factory.makeAnyBranch(
1195+ owner=owner, information_type=InformationType.USERDATA)
1196 path = removeSecurityProxy(branch).unique_name
1197 self.assertOnlyWritableResolves(path)
1198
1199
1200=== modified file 'lib/lp/code/xmlrpc/tests/test_codehosting.py'
1201--- lib/lp/code/xmlrpc/tests/test_codehosting.py 2012-03-27 14:11:03 +0000
1202+++ lib/lp/code/xmlrpc/tests/test_codehosting.py 2012-06-01 02:30:29 +0000
1203@@ -43,6 +43,7 @@
1204 run_with_login,
1205 )
1206 from lp.codehosting.inmemory import InMemoryFrontend
1207+from lp.registry.enums import InformationType
1208 from lp.services.database.constants import UTC_NOW
1209 from lp.services.scripts.interfaces.scriptactivity import IScriptActivitySet
1210 from lp.services.webapp.interfaces import ILaunchBag
1211@@ -580,7 +581,8 @@
1212 # requestMirror can be used to request the mirror of a private branch.
1213 requester = self.factory.makePerson()
1214 branch = self.factory.makeAnyBranch(
1215- owner=requester, private=True, branch_type=BranchType.MIRRORED)
1216+ owner=requester, branch_type=BranchType.MIRRORED,
1217+ information_type=InformationType.USERDATA)
1218 branch = removeSecurityProxy(branch)
1219 self.codehosting_api.requestMirror(requester.id, branch.id)
1220 self.assertSqlAttributeEqualsDate(
1221@@ -690,7 +692,12 @@
1222 :return: The new Product and the new Branch.
1223 """
1224 product = self.factory.makeProduct()
1225- branch = self.factory.makeProductBranch(private=private)
1226+ if private:
1227+ information_type = InformationType.USERDATA
1228+ else:
1229+ information_type = InformationType.PUBLIC
1230+ branch = self.factory.makeProductBranch(
1231+ information_type=information_type)
1232 self.factory.enableDefaultStackingForProduct(product, branch)
1233 target = IBranchTarget(removeSecurityProxy(product))
1234 self.assertEqual(target.default_stacked_on_branch, branch)
1235@@ -793,7 +800,8 @@
1236 requester = self.factory.makePerson()
1237 branch = removeSecurityProxy(
1238 self.factory.makeAnyBranch(
1239- branch_type=BranchType.HOSTED, private=True, owner=requester))
1240+ branch_type=BranchType.HOSTED, owner=requester,
1241+ information_type=InformationType.USERDATA))
1242 path = escape(u'/%s' % branch.unique_name)
1243 translation = self.codehosting_api.translatePath(requester.id, path)
1244 login(ANONYMOUS)
1245@@ -803,7 +811,8 @@
1246
1247 def test_translatePath_cant_see_private_branch(self):
1248 requester = self.factory.makePerson()
1249- branch = removeSecurityProxy(self.factory.makeAnyBranch(private=True))
1250+ branch = removeSecurityProxy(self.factory.makeAnyBranch(
1251+ information_type=InformationType.USERDATA))
1252 path = escape(u'/%s' % branch.unique_name)
1253 self.assertPermissionDenied(requester, path)
1254
1255@@ -814,7 +823,8 @@
1256 self.assertNotFound(requester, path)
1257
1258 def test_translatePath_launchpad_services_private(self):
1259- branch = removeSecurityProxy(self.factory.makeAnyBranch(private=True))
1260+ branch = removeSecurityProxy(self.factory.makeAnyBranch(
1261+ information_type=InformationType.USERDATA))
1262 path = escape(u'/%s' % branch.unique_name)
1263 translation = self.codehosting_api.translatePath(
1264 LAUNCHPAD_SERVICES, path)
1265@@ -824,7 +834,8 @@
1266 translation)
1267
1268 def test_translatePath_anonymous_cant_see_private_branch(self):
1269- branch = removeSecurityProxy(self.factory.makeAnyBranch(private=True))
1270+ branch = removeSecurityProxy(self.factory.makeAnyBranch(
1271+ information_type=InformationType.USERDATA))
1272 path = escape(u'/%s' % branch.unique_name)
1273 self.assertPermissionDenied(LAUNCHPAD_ANONYMOUS, path)
1274
1275@@ -1059,7 +1070,8 @@
1276 requester = self.factory.makePerson()
1277 branch = removeSecurityProxy(
1278 self.factory.makeAnyBranch(
1279- branch_type=BranchType.HOSTED, private=True, owner=requester))
1280+ branch_type=BranchType.HOSTED, owner=requester,
1281+ information_type=InformationType.USERDATA))
1282 path = escape(branch_id_alias(branch))
1283 translation = self.codehosting_api.translatePath(requester.id, path)
1284 self.assertEqual(
1285@@ -1071,7 +1083,8 @@
1286 requester = self.factory.makePerson()
1287 branch = removeSecurityProxy(
1288 self.factory.makeAnyBranch(
1289- branch_type=BranchType.HOSTED, private=True))
1290+ branch_type=BranchType.HOSTED,
1291+ information_type=InformationType.USERDATA))
1292 path = escape(branch_id_alias(branch))
1293 self.assertPermissionDenied(requester, path)
1294
1295@@ -1230,7 +1243,7 @@
1296 # branch.
1297 product = self.factory.makeProduct()
1298 default_branch = self.factory.makeProductBranch(
1299- product=product, private=True)
1300+ product=product, information_type=InformationType.USERDATA)
1301 self.factory.enableDefaultStackingForProduct(product, default_branch)
1302 mirrored_branch = self.factory.makeProductBranch(
1303 branch_type=BranchType.MIRRORED, product=product)
1304
1305=== modified file 'lib/lp/codehosting/codeimport/tests/test_worker.py'
1306--- lib/lp/codehosting/codeimport/tests/test_worker.py 2012-02-27 23:59:14 +0000
1307+++ lib/lp/codehosting/codeimport/tests/test_worker.py 2012-06-01 02:30:29 +0000
1308@@ -1,4 +1,4 @@
1309-# Copyright 2009-2011 Canonical Ltd. This software is licensed under the
1310+# Copyright 2009-2012 Canonical Ltd. This software is licensed under the
1311 # GNU Affero General Public License version 3 (see the file LICENSE).
1312
1313 """Tests for the code import worker."""
1314@@ -87,6 +87,7 @@
1315 SafeBranchOpener,
1316 )
1317 from lp.codehosting.tests.helpers import create_branch_with_one_revision
1318+from lp.registry.enums import InformationType
1319 from lp.services.config import config
1320 from lp.services.log.logger import BufferLogger
1321 from lp.testing import (
1322@@ -1544,7 +1545,7 @@
1323 arguments)
1324
1325 def test_bzr_stacked(self):
1326- devfocus = self.factory.makeAnyBranch(private=False)
1327+ devfocus = self.factory.makeAnyBranch()
1328 code_import = self.factory.makeCodeImport(
1329 bzr_branch_url='bzr://bzr.example.com/foo',
1330 target=devfocus.target)
1331@@ -1559,7 +1560,8 @@
1332
1333 def test_bzr_stacked_private(self):
1334 # Code imports can't be stacked on private branches.
1335- devfocus = self.factory.makeAnyBranch(private=True)
1336+ devfocus = self.factory.makeAnyBranch(
1337+ information_type=InformationType.USERDATA)
1338 code_import = self.factory.makeCodeImport(
1339 target=devfocus.target,
1340 bzr_branch_url='bzr://bzr.example.com/foo')
1341
1342=== modified file 'lib/lp/codehosting/inmemory.py'
1343--- lib/lp/codehosting/inmemory.py 2011-12-30 06:14:56 +0000
1344+++ lib/lp/codehosting/inmemory.py 2012-06-01 02:30:29 +0000
1345@@ -1,4 +1,4 @@
1346-# Copyright 2009-2011 Canonical Ltd. This software is licensed under the
1347+# Copyright 2009-2012 Canonical Ltd. This software is licensed under the
1348 # GNU Affero General Public License version 3 (see the file LICENSE).
1349
1350 """In-memory doubles of core codehosting objects."""
1351@@ -50,6 +50,11 @@
1352 ProductBranchTarget,
1353 )
1354 from lp.code.xmlrpc.codehosting import datetime_from_tuple
1355+from lp.registry.enums import (
1356+ InformationType,
1357+ PRIVATE_INFORMATION_TYPES,
1358+ PUBLIC_INFORMATION_TYPES,
1359+ )
1360 from lp.registry.errors import InvalidName
1361 from lp.registry.interfaces.pocket import PackagePublishingPocket
1362 from lp.services.database.constants import UTC_NOW
1363@@ -214,8 +219,8 @@
1364 """Fake branch object."""
1365
1366 def __init__(self, branch_type, name, owner, url=None, product=None,
1367- stacked_on=None, private=False, registrant=None,
1368- distroseries=None, sourcepackagename=None):
1369+ stacked_on=None, information_type=InformationType.PUBLIC,
1370+ registrant=None, distroseries=None, sourcepackagename=None):
1371 self.branch_type = branch_type
1372 self.last_mirror_attempt = None
1373 self.last_mirrored = None
1374@@ -228,7 +233,7 @@
1375 self.stacked_on = None
1376 self.mirror_status_message = None
1377 self.stacked_on = stacked_on
1378- self.private = private
1379+ self.information_type = information_type
1380 self.product = product
1381 self.registrant = registrant
1382 self._mirrored = False
1383@@ -395,7 +400,8 @@
1384 self._distroseries_set = distroseries_set
1385 self._sourcepackagename_set = sourcepackagename_set
1386
1387- def makeBranch(self, branch_type=None, stacked_on=None, private=False,
1388+ def makeBranch(self, branch_type=None, stacked_on=None,
1389+ information_type=InformationType.PUBLIC,
1390 product=DEFAULT_PRODUCT, owner=None, name=None,
1391 registrant=None, sourcepackage=None):
1392 if branch_type is None:
1393@@ -421,9 +427,9 @@
1394 IBranch['name'].validate(unicode(name))
1395 branch = FakeBranch(
1396 branch_type, name=name, owner=owner, url=url,
1397- stacked_on=stacked_on, product=product, private=private,
1398- registrant=registrant, distroseries=distroseries,
1399- sourcepackagename=sourcepackagename)
1400+ stacked_on=stacked_on, product=product,
1401+ information_type=information_type, registrant=registrant,
1402+ distroseries=distroseries, sourcepackagename=sourcepackagename)
1403 self._branch_set._add(branch)
1404 return branch
1405
1406@@ -563,7 +569,8 @@
1407 if default_branch is None:
1408 default_branch_name = ''
1409 elif (branch.branch_type == BranchType.MIRRORED
1410- and default_branch.private):
1411+ and default_branch.information_type in
1412+ PRIVATE_INFORMATION_TYPES):
1413 default_branch_name = ''
1414 else:
1415 default_branch_name = '/' + default_branch.unique_name
1416@@ -754,8 +761,8 @@
1417 if person_id == LAUNCHPAD_SERVICES:
1418 return True
1419 if person_id == LAUNCHPAD_ANONYMOUS:
1420- return not branch.private
1421- if not branch.private:
1422+ return branch.information_type in PUBLIC_INFORMATION_TYPES
1423+ if branch.information_type in PUBLIC_INFORMATION_TYPES:
1424 return True
1425 person = self._person_set.get(person_id)
1426 return person.inTeam(branch.owner)
1427
1428=== modified file 'lib/lp/codehosting/puller/tests/test_acceptance.py'
1429--- lib/lp/codehosting/puller/tests/test_acceptance.py 2012-01-01 02:58:52 +0000
1430+++ lib/lp/codehosting/puller/tests/test_acceptance.py 2012-06-01 02:30:29 +0000
1431@@ -1,4 +1,4 @@
1432-# Copyright 2009 Canonical Ltd. This software is licensed under the
1433+# Copyright 2009-2012 Canonical Ltd. This software is licensed under the
1434 # GNU Affero General Public License version 3 (see the file LICENSE).
1435
1436 """End-to-end tests for the branch puller."""
1437@@ -32,6 +32,7 @@
1438 from lp.codehosting.puller.tests import PullerBranchTestCase
1439 from lp.codehosting.tests.helpers import LoomTestMixin
1440 from lp.codehosting.vfs import get_lp_server
1441+from lp.registry.enums import InformationType
1442 from lp.services.config import config
1443 from lp.services.scripts.interfaces.scriptactivity import IScriptActivitySet
1444 from lp.testing.layers import ZopelessAppServerLayer
1445@@ -221,8 +222,12 @@
1446 """
1447 # Make the branch in the database.
1448 product = self.factory.makeProduct()
1449+ if private:
1450+ information_type = InformationType.USERDATA
1451+ else:
1452+ information_type = InformationType.PUBLIC
1453 default_branch = self.factory.makeProductBranch(
1454- product=product, private=private)
1455+ product=product, information_type=information_type)
1456 transaction.commit()
1457 # Create the underlying bzr branch.
1458 lp_server = self.getLPServerForUser(default_branch.owner)
1459
1460=== modified file 'lib/lp/codehosting/tests/test_rewrite.py'
1461--- lib/lp/codehosting/tests/test_rewrite.py 2012-01-01 02:58:52 +0000
1462+++ lib/lp/codehosting/tests/test_rewrite.py 2012-06-01 02:30:29 +0000
1463@@ -1,4 +1,4 @@
1464-# Copyright 2009-2011 Canonical Ltd. This software is licensed under the
1465+# Copyright 2009-2012 Canonical Ltd. This software is licensed under the
1466 # GNU Affero General Public License version 3 (see the file LICENSE).
1467
1468 """Tests for the dynamic RewriteMap used to serve branches over HTTP."""
1469@@ -16,6 +16,7 @@
1470 from lp.code.interfaces.codehosting import branch_id_alias
1471 from lp.codehosting.rewrite import BranchRewriter
1472 from lp.codehosting.vfs import branch_id_to_path
1473+from lp.registry.enums import InformationType
1474 from lp.services.config import config
1475 from lp.services.log.logger import BufferLogger
1476 from lp.testing import (
1477@@ -85,7 +86,8 @@
1478 # rewritten to codebrowse, which will then redirect them to https and
1479 # handle them there.
1480 rewriter = self.makeRewriter()
1481- branch = self.factory.makeAnyBranch(private=True)
1482+ branch = self.factory.makeAnyBranch(
1483+ information_type=InformationType.USERDATA)
1484 unique_name = removeSecurityProxy(branch).unique_name
1485 transaction.commit()
1486 output = [
1487@@ -102,9 +104,9 @@
1488 # branches are served from by ID if they are public.
1489 rewriter = self.makeRewriter()
1490 branches = [
1491- self.factory.makeProductBranch(private=False),
1492- self.factory.makePersonalBranch(private=False),
1493- self.factory.makePackageBranch(private=False)]
1494+ self.factory.makeProductBranch(),
1495+ self.factory.makePersonalBranch(),
1496+ self.factory.makePackageBranch()]
1497 transaction.commit()
1498 output = [
1499 rewriter.rewriteLine(
1500@@ -120,7 +122,8 @@
1501 # All requests for /+branch-id/$id/... for private branches return
1502 # 'NULL'. This is translated by apache to a 404.
1503 rewriter = self.makeRewriter()
1504- branch = self.factory.makeAnyBranch(private=True)
1505+ branch = self.factory.makeAnyBranch(
1506+ information_type=InformationType.USERDATA)
1507 path = branch_id_alias(removeSecurityProxy(branch))
1508 transaction.commit()
1509 output = [
1510
1511=== modified file 'lib/lp/registry/browser/tests/test_pillar_sharing.py'
1512--- lib/lp/registry/browser/tests/test_pillar_sharing.py 2012-05-30 04:59:36 +0000
1513+++ lib/lp/registry/browser/tests/test_pillar_sharing.py 2012-06-01 02:30:29 +0000
1514@@ -88,7 +88,8 @@
1515
1516 if with_branch and self.pillar_type == 'product':
1517 branch = self.factory.makeBranch(
1518- product=self.pillar, owner=self.pillar.owner, private=True)
1519+ product=self.pillar, owner=self.pillar.owner,
1520+ information_type=InformationType.USERDATA)
1521 artifacts.append(
1522 self.factory.makeAccessArtifact(concrete=branch))
1523
1524
1525=== modified file 'lib/lp/registry/services/tests/test_sharingservice.py'
1526--- lib/lp/registry/services/tests/test_sharingservice.py 2012-05-30 20:45:41 +0000
1527+++ lib/lp/registry/services/tests/test_sharingservice.py 2012-06-01 02:30:29 +0000
1528@@ -685,7 +685,8 @@
1529 product = self.factory.makeProduct(owner=owner)
1530 login_person(owner)
1531 branch = self.factory.makeBranch(
1532- product=product, owner=owner, private=True)
1533+ product=product, owner=owner,
1534+ information_type=InformationType.USERDATA)
1535 self._assert_revokeAccessGrants(product, None, [branch])
1536
1537 def _assert_revokeAccessGrantsUnauthorized(self):
1538@@ -741,7 +742,8 @@
1539 branches = []
1540 for x in range(0, 10):
1541 branch = self.factory.makeBranch(
1542- product=product, owner=owner, private=True)
1543+ product=product, owner=owner,
1544+ information_type=InformationType.USERDATA)
1545 branches.append(branch)
1546
1547 # Grant access to grantee as well as the person who will be doing the
1548
1549=== modified file 'lib/lp/registry/tests/test_distro_webservice.py'
1550--- lib/lp/registry/tests/test_distro_webservice.py 2012-01-01 02:58:52 +0000
1551+++ lib/lp/registry/tests/test_distro_webservice.py 2012-06-01 02:30:29 +0000
1552@@ -1,4 +1,4 @@
1553-# Copyright 2011 Canonical Ltd. This software is licensed under the
1554+# Copyright 2011-2012 Canonical Ltd. This software is licensed under the
1555 # GNU Affero General Public License version 3 (see the file LICENSE).
1556
1557 __metaclass__ = type
1558@@ -20,6 +20,7 @@
1559 from lp.code.model.seriessourcepackagebranch import (
1560 SeriesSourcePackageBranchSet,
1561 )
1562+from lp.registry.enums import InformationType
1563 from lp.registry.interfaces.pocket import PackagePublishingPocket
1564 from lp.testing import (
1565 api_url,
1566@@ -147,7 +148,8 @@
1567 series = self.factory.makeDistroSeries(distro)
1568 source_package = self.factory.makeSourcePackage(distroseries=series)
1569 branch = self.factory.makeBranch(
1570- sourcepackage=source_package, private=True, **kwargs)
1571+ sourcepackage=source_package,
1572+ information_type=InformationType.USERDATA, **kwargs)
1573 return branch, distro
1574
1575 def test_private_branch_hidden(self):
1576
1577=== modified file 'lib/lp/registry/tests/test_private_team_visibility.py'
1578--- lib/lp/registry/tests/test_private_team_visibility.py 2012-05-02 05:25:11 +0000
1579+++ lib/lp/registry/tests/test_private_team_visibility.py 2012-06-01 02:30:29 +0000
1580@@ -177,8 +177,12 @@
1581 the branch (and hence team) to be visible.
1582 """
1583 login_person(self.priv_owner)
1584+ if private:
1585+ information_type = InformationType.USERDATA
1586+ else:
1587+ information_type = InformationType.PUBLIC
1588 private_team_branch = self.factory.makeBranch(
1589- owner=self.priv_team, private=private)
1590+ owner=self.priv_team, information_type=information_type)
1591 some_person = self.factory.makePerson()
1592 # All users can see public branches, so in that case, the team is
1593 # now visible, else team is still not visible.
1594@@ -202,8 +206,12 @@
1595 the private team will be granted limited view permission on the team.
1596 """
1597 branch_owner = self.factory.makePerson()
1598+ if private:
1599+ information_type = InformationType.USERDATA
1600+ else:
1601+ information_type = InformationType.PUBLIC
1602 private_branch = self.factory.makeBranch(
1603- owner=branch_owner, private=private)
1604+ owner=branch_owner, information_type=information_type)
1605 some_person = self.factory.makePerson()
1606 # Initially no visibility.
1607 self._check_permission(some_person, False)
1608@@ -236,8 +244,13 @@
1609 # Make the merge proposal.
1610 login_person(self.priv_owner)
1611 product = self.factory.makeProduct()
1612+ if private:
1613+ information_type = InformationType.USERDATA
1614+ else:
1615+ information_type = InformationType.PUBLIC
1616 target_branch = self.factory.makeBranch(
1617- owner=self.priv_owner, private=private, product=product)
1618+ owner=self.priv_owner, product=product,
1619+ information_type=information_type)
1620 source_branch = self.factory.makeBranch(
1621 owner=self.priv_owner, product=product)
1622 self.factory.makeBranchMergeProposal(
1623
1624=== modified file 'lib/lp/registry/tests/test_productjob.py'
1625--- lib/lp/registry/tests/test_productjob.py 2012-05-24 20:25:54 +0000
1626+++ lib/lp/registry/tests/test_productjob.py 2012-06-01 02:30:29 +0000
1627@@ -1,4 +1,4 @@
1628-# Copyright 2010 Canonical Ltd. This software is licensed under the
1629+# Copyright 2010-2012 Canonical Ltd. This software is licensed under the
1630 # GNU Affero General Public License version 3 (see the file LICENSE).
1631
1632 """Tests for ProductJobs."""
1633@@ -19,31 +19,33 @@
1634 from zope.security.proxy import removeSecurityProxy
1635
1636 from lp.app.interfaces.launchpad import ILaunchpadCelebrities
1637-from lp.registry.enums import ProductJobType
1638-from lp.registry.interfaces.product import (
1639- License,
1640+from lp.registry.enums import (
1641+ InformationType,
1642+ ProductJobType,
1643 )
1644+from lp.registry.interfaces.person import TeamSubscriptionPolicy
1645+from lp.registry.interfaces.product import License
1646 from lp.registry.interfaces.productjob import (
1647+ ICommercialExpiredJob,
1648+ ICommercialExpiredJobSource,
1649 IProductJob,
1650 IProductJobSource,
1651 IProductNotificationJobSource,
1652- ICommercialExpiredJob,
1653- ICommercialExpiredJobSource,
1654 ISevenDayCommercialExpirationJob,
1655 ISevenDayCommercialExpirationJobSource,
1656 IThirtyDayCommercialExpirationJob,
1657 IThirtyDayCommercialExpirationJobSource,
1658 )
1659-from lp.registry.interfaces.person import TeamSubscriptionPolicy
1660 from lp.registry.interfaces.teammembership import TeamMembershipStatus
1661 from lp.registry.model.productjob import (
1662+ CommercialExpiredJob,
1663 ProductJob,
1664 ProductJobDerived,
1665 ProductNotificationJob,
1666- CommercialExpiredJob,
1667 SevenDayCommercialExpirationJob,
1668 ThirtyDayCommercialExpirationJob,
1669 )
1670+from lp.services.webapp.publisher import canonical_url
1671 from lp.testing import (
1672 person_logged_in,
1673 TestCaseWithFactory,
1674@@ -53,7 +55,6 @@
1675 LaunchpadZopelessLayer,
1676 )
1677 from lp.testing.mail_helpers import pop_notifications
1678-from lp.services.webapp.publisher import canonical_url
1679
1680
1681 class ProductJobTestCase(TestCaseWithFactory):
1682@@ -529,7 +530,8 @@
1683 public_branch = self.factory.makeBranch(
1684 owner=product.owner, product=product)
1685 private_branch = self.factory.makeBranch(
1686- owner=product.owner, product=product, private=True)
1687+ owner=product.owner, product=product,
1688+ information_type=InformationType.USERDATA)
1689 with person_logged_in(product.owner):
1690 product.setPrivateBugs(True, product.owner)
1691 public_series = product.development_focus
1692
1693=== modified file 'lib/lp/testing/factory.py'
1694--- lib/lp/testing/factory.py 2012-05-31 05:01:06 +0000
1695+++ lib/lp/testing/factory.py 2012-06-01 02:30:29 +0000
1696@@ -1073,7 +1073,7 @@
1697
1698 def makeBranch(self, branch_type=None, owner=None,
1699 name=None, product=_DEFAULT, url=_DEFAULT, registrant=None,
1700- private=None, information_type=None, stacked_on=None,
1701+ information_type=None, stacked_on=None,
1702 sourcepackage=None, reviewer=None, **optional_branch_args):
1703 """Create and return a new, arbitrary Branch of the given type.
1704
1705@@ -1120,12 +1120,6 @@
1706 branch = namespace.createBranch(
1707 branch_type=branch_type, name=name, registrant=registrant,
1708 url=url, **optional_branch_args)
1709- assert information_type is None or private is None, (
1710- "Can not specify both information_type and private")
1711- if private is not None:
1712- information_type = (
1713- InformationType.USERDATA if private else
1714- InformationType.PUBLIC)
1715 if information_type is not None:
1716 removeSecurityProxy(branch).transitionToInformationType(
1717 information_type, registrant, verify_policy=False)
1718@@ -1303,19 +1297,21 @@
1719 series_branch_info = []
1720
1721 # Add some product series
1722- def makeSeriesBranch(name, is_private=False):
1723+ def makeSeriesBranch(name, information_type):
1724 branch = self.makeBranch(
1725 name=name,
1726 product=naked_product, owner=related_branch_owner,
1727- private=is_private)
1728+ information_type=information_type)
1729 series = self.makeProductSeries(
1730 product=naked_product, branch=branch)
1731 return branch, series
1732 for x in range(4):
1733- is_private = x == 0 and with_private_branches
1734+ information_type = InformationType.PUBLIC
1735+ if x == 0 and with_private_branches:
1736+ information_type = InformationType.USERDATA
1737 (branch, series) = makeSeriesBranch(
1738- name=("series_branch_%s" % x), is_private=is_private)
1739- if not is_private:
1740+ ("series_branch_%s" % x), information_type)
1741+ if information_type == InformationType.PUBLIC:
1742 series_branch_info.append((branch, series))
1743
1744 # Sort them
1745@@ -1338,7 +1334,7 @@
1746 # associated with a product.
1747 if naked_product is not None:
1748
1749- def makePackageBranch(name, is_private=False):
1750+ def makePackageBranch(name, information_type):
1751 distro = self.makeDistribution()
1752 distroseries = self.makeDistroSeries(
1753 distribution=distro)
1754@@ -1354,7 +1350,8 @@
1755 branch = self.makePackageBranch(
1756 name=name, owner=related_branch_owner,
1757 sourcepackagename=sourcepackagename,
1758- distroseries=distroseries, private=is_private)
1759+ distroseries=distroseries,
1760+ information_type=information_type)
1761 linked_branch = ICanHasLinkedBranch(naked_sourcepackage)
1762 with celebrity_logged_in('admin'):
1763 linked_branch.setBranch(branch, related_branch_owner)
1764@@ -1366,11 +1363,13 @@
1765 return branch, distroseries
1766
1767 for x in range(5):
1768- is_private = x == 0 and with_private_branches
1769+ information_type = InformationType.PUBLIC
1770+ if x == 0 and with_private_branches:
1771+ information_type = InformationType.USERDATA
1772 branch, distroseries = makePackageBranch(
1773- name=("product_package_branch_%s" % x),
1774- is_private=is_private)
1775- if not is_private:
1776+ ("product_package_branch_%s" % x),
1777+ information_type)
1778+ if information_type == InformationType.PUBLIC:
1779 related_package_branch_info.append(
1780 (branch, distroseries))
1781
1782
1783=== modified file 'lib/lp/translations/browser/tests/test_productserieslanguage_views.py'
1784--- lib/lp/translations/browser/tests/test_productserieslanguage_views.py 2012-01-01 02:58:52 +0000
1785+++ lib/lp/translations/browser/tests/test_productserieslanguage_views.py 2012-06-01 02:30:29 +0000
1786@@ -1,10 +1,11 @@
1787-# Copyright 2009 Canonical Ltd. This software is licensed under the
1788+# Copyright 2009-2012 Canonical Ltd. This software is licensed under the
1789 # GNU Affero General Public License version 3 (see the file LICENSE).
1790
1791 __metaclass__ = type
1792
1793 from zope.security.proxy import removeSecurityProxy
1794
1795+from lp.registry.enums import InformationType
1796 from lp.services.webapp.servers import LaunchpadTestRequest
1797 from lp.testing import (
1798 login_person,
1799@@ -206,7 +207,8 @@
1800 def test_has_imports_enabled_private_branch_non_privileged(self):
1801 # Private branches are hidden from non-privileged users. The view
1802 # pretends that it is not used for imports.
1803- self.productseries.branch = self.factory.makeBranch(private=True)
1804+ self.productseries.branch = self.factory.makeBranch(
1805+ information_type=InformationType.USERDATA)
1806 self.productseries.translations_autoimport_mode = (
1807 TranslationsBranchImportMode.IMPORT_TRANSLATIONS)
1808 view = self._createView()
1809@@ -214,7 +216,8 @@
1810
1811 def test_has_imports_enabled_private_branch_privileged(self):
1812 # Private branches are visible for privileged users.
1813- self.productseries.branch = self.factory.makeBranch(private=True)
1814+ self.productseries.branch = self.factory.makeBranch(
1815+ information_type=InformationType.USERDATA)
1816 self.productseries.translations_autoimport_mode = (
1817 TranslationsBranchImportMode.IMPORT_TRANSLATIONS)
1818 with person_logged_in(self.productseries.branch.owner):
1819@@ -230,14 +233,14 @@
1820 # Private branches are hidden from non-privileged users. The view
1821 # pretends that it is not used for exports.
1822 self.productseries.translations_branch = self.factory.makeBranch(
1823- private=True)
1824+ information_type=InformationType.USERDATA)
1825 view = self._createView()
1826 self.assertFalse(view.has_exports_enabled)
1827
1828 def test_has_exports_enabled_private_branch_privileged(self):
1829 # Private branches are visible for privileged users.
1830 self.productseries.translations_branch = self.factory.makeBranch(
1831- private=True)
1832+ information_type=InformationType.USERDATA)
1833 with person_logged_in(self.productseries.translations_branch.owner):
1834 view = self._createView()
1835 self.assertTrue(view.has_exports_enabled)
1836
1837=== modified file 'lib/lp/translations/stories/productseries/xx-productseries-translations.txt'
1838--- lib/lp/translations/stories/productseries/xx-productseries-translations.txt 2012-01-15 13:32:27 +0000
1839+++ lib/lp/translations/stories/productseries/xx-productseries-translations.txt 2012-06-01 02:30:29 +0000
1840@@ -277,8 +277,10 @@
1841 If the branch is private, though the page pretends to non-privileged users
1842 that no synchronization has been set up.
1843
1844+ >>> from lp.registry.enums import InformationType
1845 >>> login('foo.bar@canonical.com')
1846- >>> private_branch = factory.makeBranch(product=frobnicator, private=True)
1847+ >>> private_branch = factory.makeBranch(
1848+ ... product=frobnicator, information_type=InformationType.USERDATA)
1849 >>> frobnicator_trunk.translations_branch = private_branch
1850 >>> logout()
1851