Merge lp:~rockstar/launchpad/default-branch-upgrade-bad into lp:launchpad

Proposed by Paul Hummer
Status: Merged
Approved by: Michael Hudson-Doyle
Approved revision: not available
Merged at revision: not available
Proposed branch: lp:~rockstar/launchpad/default-branch-upgrade-bad
Merge into: lp:launchpad
Diff against target: 68 lines (+29/-0)
3 files modified
lib/lp/code/bzr.py (+2/-0)
lib/lp/code/model/branch.py (+2/-0)
lib/lp/code/model/tests/test_branch.py (+25/-0)
To merge this branch: bzr merge lp:~rockstar/launchpad/default-branch-upgrade-bad
Reviewer Review Type Date Requested Status
Michael Hudson-Doyle Approve
Review via email: mp+18483@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Paul Hummer (rockstar) wrote :

Hi there-

  This branch fixes bug #515776 - Basically, a branch that didn't know its own formats was claiming it needed to be upgraded. That's a wrong assertion, since we don't know what the formats are, so we don't know whether they are out of date or not. Also, while I was working on it, I realized that mirrored/remote/imported branches that couldn't/shouldn't be upgraded could still claim they needed to be upgraded. I fixed that while I was there.

Cheers,
Paul

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

Looks good, nice and simple :-)

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'lib/lp/code/bzr.py'
--- lib/lp/code/bzr.py 2010-01-22 06:03:19 +0000
+++ lib/lp/code/bzr.py 2010-02-02 22:34:20 +0000
@@ -216,6 +216,7 @@
216216
217# A tuple of branch formats that should not suggest upgrading.217# A tuple of branch formats that should not suggest upgrading.
218CURRENT_BRANCH_FORMATS = (218CURRENT_BRANCH_FORMATS = (
219 None,
219 BranchFormat.UNRECOGNIZED,220 BranchFormat.UNRECOGNIZED,
220 BranchFormat.BRANCH_REFERENCE,221 BranchFormat.BRANCH_REFERENCE,
221 BranchFormat.BZR_BRANCH_7,222 BranchFormat.BZR_BRANCH_7,
@@ -226,6 +227,7 @@
226227
227# A tuple of repository formats that should not suggest upgrading.228# A tuple of repository formats that should not suggest upgrading.
228CURRENT_REPOSITORY_FORMATS = (229CURRENT_REPOSITORY_FORMATS = (
230 None,
229 RepositoryFormat.UNRECOGNIZED,231 RepositoryFormat.UNRECOGNIZED,
230 RepositoryFormat.BZR_PACK_DEV_0,232 RepositoryFormat.BZR_PACK_DEV_0,
231 RepositoryFormat.BZR_PACK_DEV_0_SUBTREE,233 RepositoryFormat.BZR_PACK_DEV_0_SUBTREE,
232234
=== modified file 'lib/lp/code/model/branch.py'
--- lib/lp/code/model/branch.py 2010-01-29 17:15:31 +0000
+++ lib/lp/code/model/branch.py 2010-02-02 22:34:20 +0000
@@ -1000,6 +1000,8 @@
1000 @property1000 @property
1001 def needs_upgrading(self):1001 def needs_upgrading(self):
1002 """See `IBranch`."""1002 """See `IBranch`."""
1003 if self.branch_type is not BranchType.HOSTED:
1004 return False
1003 if self.upgrade_pending:1005 if self.upgrade_pending:
1004 return False1006 return False
1005 return not (1007 return not (
10061008
=== modified file 'lib/lp/code/model/tests/test_branch.py'
--- lib/lp/code/model/tests/test_branch.py 2010-01-26 02:24:27 +0000
+++ lib/lp/code/model/tests/test_branch.py 2010-02-02 22:34:20 +0000
@@ -322,6 +322,31 @@
322322
323 layer = DatabaseFunctionalLayer323 layer = DatabaseFunctionalLayer
324324
325 def test_needsUpgrading_empty_formats(self):
326 branch = self.factory.makePersonalBranch()
327 self.assertFalse(branch.needs_upgrading)
328
329 def test_needsUpgrade_mirrored_branch(self):
330 branch = self.factory.makeBranch(
331 branch_type=BranchType.MIRRORED,
332 branch_format=BranchFormat.BZR_BRANCH_6,
333 repository_format=RepositoryFormat.BZR_REPOSITORY_4)
334 self.assertFalse(branch.needs_upgrading)
335
336 def test_needsUpgrade_remote_branch(self):
337 branch = self.factory.makeBranch(
338 branch_type=BranchType.REMOTE,
339 branch_format=BranchFormat.BZR_BRANCH_6,
340 repository_format=RepositoryFormat.BZR_REPOSITORY_4)
341 self.assertFalse(branch.needs_upgrading)
342
343 def test_needsUpgrade_import_branch(self):
344 branch = self.factory.makeBranch(
345 branch_type=BranchType.IMPORTED,
346 branch_format=BranchFormat.BZR_BRANCH_6,
347 repository_format=RepositoryFormat.BZR_REPOSITORY_4)
348 self.assertFalse(branch.needs_upgrading)
349
325 def test_needsUpgrading_already_requested(self):350 def test_needsUpgrading_already_requested(self):
326 # A branch has a needs_upgrading attribute that returns whether or not351 # A branch has a needs_upgrading attribute that returns whether or not
327 # a branch needs to be upgraded or not. If the format is352 # a branch needs to be upgraded or not. If the format is