Merge lp:~mwhudson/launchpad/other-puller-argh into lp:launchpad

Proposed by Michael Hudson-Doyle
Status: Merged
Approved by: Tim Penhey
Approved revision: no longer in the source branch.
Merged at revision: not available
Proposed branch: lp:~mwhudson/launchpad/other-puller-argh
Merge into: lp:launchpad
Diff against target: None lines
To merge this branch: bzr merge lp:~mwhudson/launchpad/other-puller-argh
Reviewer Review Type Date Requested Status
Christian Reis (community) release-critical Approve
Tim Penhey (community) Approve
Jonathan Lange (community) Approve
Review via email: mp+11400@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Michael Hudson-Doyle (mwhudson) wrote :

Hi Tim,

This is the test and fix for that bug kiko alerted us to.

Cheers,
mwh

Revision history for this message
Jonathan Lange (jml) wrote :

Looks fine to me. The comment on the test is very helpful.

review: Approve
Revision history for this message
Tim Penhey (thumper) :
review: Approve
Revision history for this message
Christian Reis (kiko) wrote :

Let's get this and the other related fix onto production!

review: Approve (release-critical)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/lp/codehosting/puller/tests/test_worker.py'
2--- lib/lp/codehosting/puller/tests/test_worker.py 2009-09-07 01:06:42 +0000
3+++ lib/lp/codehosting/puller/tests/test_worker.py 2009-09-08 23:12:55 +0000
4@@ -14,7 +14,7 @@
5 import bzrlib.branch
6 from bzrlib.branch import BranchReferenceFormat, BzrBranchFormat7
7 from bzrlib.bzrdir import BzrDir, BzrDirMetaFormat1
8-from bzrlib.errors import IncompatibleRepositories, NotBranchError
9+from bzrlib.errors import IncompatibleRepositories, NotBranchError, NotStacked
10 from bzrlib.tests.http_server import HttpServer
11 from bzrlib.remote import RemoteBranch
12 from bzrlib.repofmt.pack_repo import RepositoryFormatKnitPack1
13@@ -203,6 +203,19 @@
14 dest = bzrlib.branch.Branch.open(self.get_url('destdir'))
15 self.assertFalse(dest._format.supports_stacking())
16
17+ def test_defaultStackedOnBranchIncompatibleMirrorsOK(self):
18+ # If the policy supplies a stacked on URL for a branch which is
19+ # incompatible with the branch we're mirroring, the mirroring
20+ # completes successfully and the destination branch is not stacked.
21+ stack_on = self.make_branch('default-stack-on', format='2a')
22+ source_branch = self.make_branch('source-branch', format='1.9')
23+ to_mirror = self.makePullerWorker(
24+ source_branch.base, self.get_url('destdir'),
25+ policy=PrearrangedStackedBranchPolicy(stack_on.base))
26+ to_mirror.mirrorWithoutChecks()
27+ dest = bzrlib.branch.Branch.open(self.get_url('destdir'))
28+ self.assertRaises(NotStacked, dest.get_stacked_on_url)
29+
30 def testCanMirrorWithIncompatibleRepos(self):
31 # If the destination branch cannot be opened because its repository is
32 # not compatible with that of the branch it is stacked on, we delete
33
34=== modified file 'lib/lp/codehosting/puller/worker.py'
35--- lib/lp/codehosting/puller/worker.py 2009-09-07 00:58:35 +0000
36+++ lib/lp/codehosting/puller/worker.py 2009-09-08 23:12:55 +0000
37@@ -331,7 +331,8 @@
38 try:
39 dest_branch.set_stacked_on_url(stacked_on_url)
40 except (errors.UnstackableRepositoryFormat,
41- errors.UnstackableBranchFormat):
42+ errors.UnstackableBranchFormat,
43+ errors.IncompatibleRepositories):
44 stacked_on_url = None
45 except errors.NotBranchError:
46 raise StackedOnBranchNotFound()