Merge lp:~rockstar/launchpad/ibranch-upgrade into lp:launchpad

Proposed by Paul Hummer
Status: Merged
Merged at revision: not available
Proposed branch: lp:~rockstar/launchpad/ibranch-upgrade
Merge into: lp:launchpad
Diff against target: 71 lines
4 files modified
lib/lp/code/configure.zcml (+1/-0)
lib/lp/code/interfaces/branch.py (+3/-0)
lib/lp/code/model/branch.py (+5/-0)
lib/lp/code/model/tests/test_branch.py (+12/-0)
To merge this branch: bzr merge lp:~rockstar/launchpad/ibranch-upgrade
Reviewer Review Type Date Requested Status
Michael Hudson-Doyle Approve
Review via email: mp+14201@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Paul Hummer (rockstar) wrote :

Hi Michael-

  This branch just adds IBranch.requestUpgrade to create a BranchUpgradeJob. That's it.

Cheers,
Paul

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

+ self.assertEqual(jobs.count(), 1)

This could be "self.assertEqual([job], list(jobs))" I think?

Otherwise fine.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'lib/lp/code/configure.zcml'
--- lib/lp/code/configure.zcml 2009-10-29 19:55:59 +0000
+++ lib/lp/code/configure.zcml 2009-10-30 16:16:20 +0000
@@ -484,6 +484,7 @@
484 pending_writes484 pending_writes
485 commitsForDays485 commitsForDays
486 needs_upgrading486 needs_upgrading
487 requestUpgrade
487 getUpgradeFormat488 getUpgradeFormat
488 isBranchMergeable489 isBranchMergeable
489 visibleByUser490 visibleByUser
490491
=== modified file 'lib/lp/code/interfaces/branch.py'
--- lib/lp/code/interfaces/branch.py 2009-10-29 19:55:59 +0000
+++ lib/lp/code/interfaces/branch.py 2009-10-30 16:16:20 +0000
@@ -1044,6 +1044,9 @@
10441044
1045 needs_upgrading = Attribute("Whether the branch needs to be upgraded.")1045 needs_upgrading = Attribute("Whether the branch needs to be upgraded.")
10461046
1047 def requestUpgrade():
1048 """Create an IBranchUpgradeJob to upgrade this branch."""
1049
1047 def visibleByUser(user):1050 def visibleByUser(user):
1048 """Can the specified user see this branch?"""1051 """Can the specified user see this branch?"""
10491052
10501053
=== modified file 'lib/lp/code/model/branch.py'
--- lib/lp/code/model/branch.py 2009-10-29 20:48:36 +0000
+++ lib/lp/code/model/branch.py 2009-10-30 16:16:20 +0000
@@ -978,6 +978,11 @@
978 return True978 return True
979 return False979 return False
980980
981 def requestUpgrade(self):
982 """See `IBranch`."""
983 from lp.code.interfaces.branchjob import IBranchUpgradeJobSource
984 return getUtility(IBranchUpgradeJobSource).create(self)
985
981 def _checkBranchVisibleByUser(self, user):986 def _checkBranchVisibleByUser(self, user):
982 """Is *this* branch visible by the user.987 """Is *this* branch visible by the user.
983988
984989
=== modified file 'lib/lp/code/model/tests/test_branch.py'
--- lib/lp/code/model/tests/test_branch.py 2009-10-29 19:55:59 +0000
+++ lib/lp/code/model/tests/test_branch.py 2009-10-30 16:16:20 +0000
@@ -41,6 +41,7 @@
41 BranchCannotBePrivate, BranchCannotBePublic,41 BranchCannotBePrivate, BranchCannotBePublic,
42 BranchCreatorNotMemberOfOwnerTeam, BranchCreatorNotOwner,42 BranchCreatorNotMemberOfOwnerTeam, BranchCreatorNotOwner,
43 BranchTargetError, CannotDeleteBranch, DEFAULT_BRANCH_STATUS_IN_LISTING)43 BranchTargetError, CannotDeleteBranch, DEFAULT_BRANCH_STATUS_IN_LISTING)
44from lp.code.interfaces.branchjob import IBranchUpgradeJobSource
44from lp.code.interfaces.branchlookup import IBranchLookup45from lp.code.interfaces.branchlookup import IBranchLookup
45from lp.code.interfaces.branchnamespace import IBranchNamespaceSet46from lp.code.interfaces.branchnamespace import IBranchNamespaceSet
46from lp.code.interfaces.branchmergeproposal import (47from lp.code.interfaces.branchmergeproposal import (
@@ -395,6 +396,17 @@
395 repository_format=RepositoryFormat.BZR_REPOSITORY_4)396 repository_format=RepositoryFormat.BZR_REPOSITORY_4)
396 self.assertTrue(branch.needs_upgrading)397 self.assertTrue(branch.needs_upgrading)
397398
399 def test_requestUpgrade(self):
400 # A BranchUpgradeJob can be created by calling IBranch.requestUpgrade.
401 branch = self.factory.makeAnyBranch(
402 branch_format=BranchFormat.BZR_BRANCH_6)
403 job = removeSecurityProxy(branch.requestUpgrade())
404
405 jobs = list(getUtility(IBranchUpgradeJobSource).iterReady())
406 self.assertEqual(
407 jobs,
408 [job,])
409
398410
399class TestBzrIdentity(TestCaseWithFactory):411class TestBzrIdentity(TestCaseWithFactory):
400 """Test IBranch.bzr_identity."""412 """Test IBranch.bzr_identity."""