Merge lp://staging/~thumper/launchpad/disable-import-auto-upgrade into lp://staging/launchpad

Proposed by Tim Penhey
Status: Merged
Merged at revision: not available
Proposed branch: lp://staging/~thumper/launchpad/disable-import-auto-upgrade
Merge into: lp://staging/launchpad
Diff against target: None lines
To merge this branch: bzr merge lp://staging/~thumper/launchpad/disable-import-auto-upgrade
Reviewer Review Type Date Requested Status
Michael Hudson-Doyle Approve
Review via email: mp+12017@code.staging.launchpad.net
To post a comment you must log in.
Revision history for this message
Tim Penhey (thumper) wrote :

This branch will include the approved bzr 2.0 changes :-(

Also, after moving the methods out of the puller/worker into bzrutils, I couldn't use them in the tests anyway as I didn't have two branches to compare to.

This branch will disable the automatic upgrades of the import branches, and disables the tests for it too.

The branch also adds a test and a fix for pushing divergant branches.

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

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Tim Penhey wrote:
> Tim Penhey has proposed merging lp:~thumper/launchpad/disable-import-auto-upgrade into lp:launchpad/devel.
>
> Requested reviews:
> Michael Hudson (mwhudson)
>
> This branch will include the approved bzr 2.0 changes :-(

Generally looks nice.

> Also, after moving the methods out of the puller/worker into bzrutils, I couldn't use them in the tests anyway as I didn't have two branches to compare to.
>
> This branch will disable the automatic upgrades of the import branches, and disables the tests for it too.
>
> The branch also adds a test and a fix for pushing divergant branches.

Two comments:

> - if bzr_dir.needs_format_conversion(format=required_format):
> + # XXX Tim Penhey 2009-09-18 bug abc Automatic upgrade of import
> + # branches disabled. Need an orderly upgrade process.
> + if False and bzr_dir.needs_format_conversion(format=required_format):

bug abc? :)

> - def test_pullUpgradesFormat(self):
> + def disabled_test_pullUpgradesFormat(self):

Would be good to have a similar XXX here.

Otherwise, looks good.

 review approve

Cheers,
mwh

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkqy2hgACgkQeTTOPm7A7kgp/QCeJadBid7zcH9MqsnAu9bZD48x
FTMAnRdAc6/UyWWM9ErHv8GtfQGfMDlY
=ZF8d
-----END PGP SIGNATURE-----

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'lib/lp/codehosting/bzrutils.py'
--- lib/lp/codehosting/bzrutils.py 2009-07-17 00:26:05 +0000
+++ lib/lp/codehosting/bzrutils.py 2009-09-18 00:08:40 +0000
@@ -13,7 +13,9 @@
13 'DenyingServer',13 'DenyingServer',
14 'ensure_base',14 'ensure_base',
15 'get_branch_stacked_on_url',15 'get_branch_stacked_on_url',
16 'get_vfs_format_classes',
16 'HttpAsLocalTransport',17 'HttpAsLocalTransport',
18 'identical_formats',
17 'install_oops_handler',19 'install_oops_handler',
18 'is_branch_stackable',20 'is_branch_stackable',
19 'remove_exception_logging_hook',21 'remove_exception_logging_hook',
@@ -22,12 +24,11 @@
22import os24import os
23import sys25import sys
2426
25from bzrlib import config27from bzrlib import config, trace
26from bzrlib.errors import (28from bzrlib.errors import (
27 NoSuchFile, NotStacked, UnstackableBranchFormat,29 NoSuchFile, NotStacked, UnstackableBranchFormat,
28 UnstackableRepositoryFormat)30 UnstackableRepositoryFormat)
29from bzrlib.remote import RemoteBzrDir31from bzrlib.remote import RemoteBranch, RemoteBzrDir, RemoteRepository
30from bzrlib import trace
31from bzrlib.transport import register_transport, unregister_transport32from bzrlib.transport import register_transport, unregister_transport
32from bzrlib.transport.local import LocalTransport33from bzrlib.transport.local import LocalTransport
3334
@@ -260,3 +261,34 @@
260 """Prevent creation of transport for 'url'."""261 """Prevent creation of transport for 'url'."""
261 raise AssertionError(262 raise AssertionError(
262 "Creation of transport for %r is currently forbidden" % url)263 "Creation of transport for %r is currently forbidden" % url)
264
265
266def get_vfs_format_classes(branch):
267 """Return the vfs classes of the branch, repo and bzrdir formats.
268
269 'vfs' here means that it will return the underlying format classes of a
270 remote branch.
271 """
272 if isinstance(branch, RemoteBranch):
273 branch._ensure_real()
274 branch = branch._real_branch
275 repository = branch.repository
276 if isinstance(repository, RemoteRepository):
277 repository._ensure_real()
278 repository = repository._real_repository
279 bzrdir = branch.bzrdir
280 if isinstance(bzrdir, RemoteBzrDir):
281 bzrdir._ensure_real()
282 bzrdir = bzrdir._real_bzrdir
283 return (
284 branch._format.__class__,
285 repository._format.__class__,
286 bzrdir._format.__class__,
287 )
288
289
290def identical_formats(branch_one, branch_two):
291 """Check if two branches have the same bzrdir, repo, and branch formats.
292 """
293 return (get_vfs_format_classes(branch_one) ==
294 get_vfs_format_classes(branch_two))
263295
=== modified file 'lib/lp/codehosting/codeimport/tests/test_worker.py'
--- lib/lp/codehosting/codeimport/tests/test_worker.py 2009-07-17 00:26:05 +0000
+++ lib/lp/codehosting/codeimport/tests/test_worker.py 2009-09-18 00:32:10 +0000
@@ -108,7 +108,7 @@
108 self.assertEqual(108 self.assertEqual(
109 tree.branch.last_revision(), new_tree.branch.last_revision())109 tree.branch.last_revision(), new_tree.branch.last_revision())
110110
111 def test_pullUpgradesFormat(self):111 def disabled_test_pullUpgradesFormat(self):
112 # A branch should always be in the most up-to-date format before a112 # A branch should always be in the most up-to-date format before a
113 # pull is performed.113 # pull is performed.
114 store = self.makeBranchStore()114 store = self.makeBranchStore()
@@ -128,7 +128,7 @@
128 self.assertEqual(128 self.assertEqual(
129 default_format.get_branch_format(), new_branch._format)129 default_format.get_branch_format(), new_branch._format)
130130
131 def test_pullUpgradesFormatWithBackupDirPresent(self):131 def disabled_test_pullUpgradesFormatWithBackupDirPresent(self):
132 # pull can upgrade the remote branch even if there is a backup.bzr132 # pull can upgrade the remote branch even if there is a backup.bzr
133 # directory from a previous upgrade.133 # directory from a previous upgrade.
134 store = self.makeBranchStore()134 store = self.makeBranchStore()
@@ -162,6 +162,15 @@
162 self.assertEqual(162 self.assertEqual(
163 tree.branch.last_revision(), new_tree.branch.last_revision())163 tree.branch.last_revision(), new_tree.branch.last_revision())
164164
165 def test_push_divergant_branches(self):
166 # push() uses overwrite=True, so divergent branches (rebased) can be
167 # pushed.
168 store = self.makeBranchStore()
169 tree = create_branch_with_one_revision('original')
170 store.push(self.arbitrary_branch_id, tree, default_format)
171 tree = create_branch_with_one_revision('divergant')
172 store.push(self.arbitrary_branch_id, tree, default_format)
173
165 def fetchBranch(self, from_url, target_path):174 def fetchBranch(self, from_url, target_path):
166 """Pull a branch from `from_url` to `target_path`.175 """Pull a branch from `from_url` to `target_path`.
167176
168177
=== modified file 'lib/lp/codehosting/codeimport/worker.py'
--- lib/lp/codehosting/codeimport/worker.py 2009-07-17 00:26:05 +0000
+++ lib/lp/codehosting/codeimport/worker.py 2009-09-18 00:32:10 +0000
@@ -62,7 +62,9 @@
62 except NotBranchError:62 except NotBranchError:
63 return BzrDir.create_standalone_workingtree(63 return BzrDir.create_standalone_workingtree(
64 target_path, required_format)64 target_path, required_format)
65 if bzr_dir.needs_format_conversion(format=required_format):65 # XXX Tim Penhey 2009-09-18 bug abc Automatic upgrade of import
66 # branches disabled. Need an orderly upgrade process.
67 if False and bzr_dir.needs_format_conversion(format=required_format):
66 try:68 try:
67 bzr_dir.root_transport.delete_tree('backup.bzr')69 bzr_dir.root_transport.delete_tree('backup.bzr')
68 except NoSuchFile:70 except NoSuchFile:
@@ -81,7 +83,7 @@
81 except NotBranchError:83 except NotBranchError:
82 branch_to = BzrDir.create_branch_and_repo(84 branch_to = BzrDir.create_branch_and_repo(
83 target_url, format=required_format)85 target_url, format=required_format)
84 branch_to.pull(branch_from)86 branch_to.pull(branch_from, overwrite=True)
8587
8688
87def get_default_bazaar_branch_store():89def get_default_bazaar_branch_store():
@@ -479,10 +481,6 @@
479class PullingImportWorker(ImportWorker):481class PullingImportWorker(ImportWorker):
480 """An import worker for imports that can be done by a bzr plugin."""482 """An import worker for imports that can be done by a bzr plugin."""
481483
482 # XXX 2009-03-05, MichaelHudson, bug=338061: There should be a way to find
483 # the 'default' rich-root format.
484 required_format = format_registry.get('1.9-rich-root')()
485
486 def _doImport(self):484 def _doImport(self):
487 bazaar_tree = self.getBazaarWorkingTree()485 bazaar_tree = self.getBazaarWorkingTree()
488 saved_factory = bzrlib.ui.ui_factory486 saved_factory = bzrlib.ui.ui_factory
489487
=== modified file 'lib/lp/codehosting/puller/tests/test_acceptance.py'
--- lib/lp/codehosting/puller/tests/test_acceptance.py 2009-07-23 02:35:18 +0000
+++ lib/lp/codehosting/puller/tests/test_acceptance.py 2009-09-17 05:07:50 +0000
@@ -298,7 +298,7 @@
298 elif branch_type == BranchType.MIRRORED:298 elif branch_type == BranchType.MIRRORED:
299 # For mirrored branches, we serve the branch over HTTP, point the299 # For mirrored branches, we serve the branch over HTTP, point the
300 # database branch at this HTTP server and call requestMirror()300 # database branch at this HTTP server and call requestMirror()
301 self.setUpMirroredBranch(default_branch, format='1.6')301 self.setUpMirroredBranch(default_branch)
302 transaction.commit()302 transaction.commit()
303 else:303 else:
304 raise AssertionError(304 raise AssertionError(
@@ -315,7 +315,7 @@
315 default_branch = self._makeDefaultStackedOnBranch()315 default_branch = self._makeDefaultStackedOnBranch()
316 db_branch = self.factory.makeProductBranch(316 db_branch = self.factory.makeProductBranch(
317 branch_type=BranchType.MIRRORED, product=default_branch.product)317 branch_type=BranchType.MIRRORED, product=default_branch.product)
318 tree = self.setUpMirroredBranch(db_branch, format='1.6')318 tree = self.setUpMirroredBranch(db_branch)
319 transaction.commit()319 transaction.commit()
320 command, retcode, output, error = self.runPuller()320 command, retcode, output, error = self.runPuller()
321 self.assertRanSuccessfully(command, retcode, output, error)321 self.assertRanSuccessfully(command, retcode, output, error)
@@ -335,7 +335,7 @@
335 db_branch = self.factory.makeProductBranch(335 db_branch = self.factory.makeProductBranch(
336 branch_type=BranchType.HOSTED, product=default_branch.product)336 branch_type=BranchType.HOSTED, product=default_branch.product)
337 transaction.commit()337 transaction.commit()
338 self.pushBranch(db_branch, format='1.6')338 self.pushBranch(db_branch)
339 command, retcode, output, error = self.runPuller()339 command, retcode, output, error = self.runPuller()
340 self.assertRanSuccessfully(command, retcode, output, error)340 self.assertRanSuccessfully(command, retcode, output, error)
341 mirrored_branch = self.assertMirrored(db_branch)341 mirrored_branch = self.assertMirrored(db_branch)
@@ -358,7 +358,7 @@
358 db_branch = self.factory.makeProductBranch(358 db_branch = self.factory.makeProductBranch(
359 branch_type=BranchType.HOSTED, product=default_branch.product)359 branch_type=BranchType.HOSTED, product=default_branch.product)
360 transaction.commit()360 transaction.commit()
361 self.pushBranch(db_branch, format='1.6')361 self.pushBranch(db_branch)
362 # Because Bazaar can't access branches over bzr+ssh in this test, we362 # Because Bazaar can't access branches over bzr+ssh in this test, we
363 # cheat and set the stacking information directly.363 # cheat and set the stacking information directly.
364 branch_config = TransportConfig(364 branch_config = TransportConfig(
@@ -383,7 +383,7 @@
383 db_branch = self.factory.makeProductBranch(383 db_branch = self.factory.makeProductBranch(
384 branch_type=BranchType.MIRRORED, product=default_branch.product)384 branch_type=BranchType.MIRRORED, product=default_branch.product)
385385
386 tree = self.setUpMirroredBranch(db_branch, format='1.6')386 tree = self.setUpMirroredBranch(db_branch)
387 transaction.commit()387 transaction.commit()
388 command, retcode, output, error = self.runPuller()388 command, retcode, output, error = self.runPuller()
389 self.assertRanSuccessfully(command, retcode, output, error)389 self.assertRanSuccessfully(command, retcode, output, error)
390390
=== modified file 'lib/lp/codehosting/puller/tests/test_worker.py'
--- lib/lp/codehosting/puller/tests/test_worker.py 2009-09-08 23:12:55 +0000
+++ lib/lp/codehosting/puller/tests/test_worker.py 2009-09-18 00:08:40 +0000
@@ -16,17 +16,15 @@
16from bzrlib.bzrdir import BzrDir, BzrDirMetaFormat116from bzrlib.bzrdir import BzrDir, BzrDirMetaFormat1
17from bzrlib.errors import IncompatibleRepositories, NotBranchError, NotStacked17from bzrlib.errors import IncompatibleRepositories, NotBranchError, NotStacked
18from bzrlib.tests.http_server import HttpServer18from bzrlib.tests.http_server import HttpServer
19from bzrlib.remote import RemoteBranch
20from bzrlib.repofmt.pack_repo import RepositoryFormatKnitPack119from bzrlib.repofmt.pack_repo import RepositoryFormatKnitPack1
21from bzrlib.revision import NULL_REVISION20from bzrlib.revision import NULL_REVISION
22from bzrlib.smart import server
23from bzrlib.tests import TestCaseInTempDir, TestCaseWithTransport21from bzrlib.tests import TestCaseInTempDir, TestCaseWithTransport
24from bzrlib.transport import get_transport22from bzrlib.transport import get_transport
2523
26from lp.codehosting.bzrutils import ensure_base24from lp.codehosting.bzrutils import ensure_base
27from lp.codehosting.puller.worker import (25from lp.codehosting.puller.worker import (
28 BranchLoopError, BranchMirrorer, BranchReferenceForbidden,26 BranchLoopError, BranchMirrorer, BranchReferenceForbidden,
29 PullerWorkerProtocol, StackedOnBranchNotFound, get_vfs_format_classes,27 PullerWorkerProtocol, StackedOnBranchNotFound,
30 install_worker_ui_factory, WORKER_ACTIVITY_NETWORK)28 install_worker_ui_factory, WORKER_ACTIVITY_NETWORK)
31from lp.codehosting.puller.tests import (29from lp.codehosting.puller.tests import (
32 AcceptAnythingPolicy, BlacklistPolicy, PullerWorkerMixin, WhitelistPolicy)30 AcceptAnythingPolicy, BlacklistPolicy, PullerWorkerMixin, WhitelistPolicy)
@@ -56,37 +54,6 @@
56 return strings54 return strings
5755
5856
59class TestGetVfsFormatClasses(TestCaseWithTransport):
60 """Tests for `lp.codehosting.puller.worker.get_vfs_format_classes`.
61 """
62
63 def tearDown(self):
64 # This makes sure the connections held by the branches opened in the
65 # test are dropped, so the daemon threads serving those branches can
66 # exit.
67 gc.collect()
68 super(TestGetVfsFormatClasses, self).tearDown()
69
70 def test_get_vfs_format_classes(self):
71 # get_vfs_format_classes for a returns the underlying format classes
72 # of the branch, repo and bzrdir, even if the branch is a
73 # RemoteBranch.
74 vfs_branch = self.make_branch('.')
75 smart_server = server.SmartTCPServer_for_testing()
76 smart_server.setUp(self.get_vfs_only_server())
77 self.addCleanup(smart_server.tearDown)
78 remote_branch = bzrlib.branch.Branch.open(smart_server.get_url())
79 # Check that our set up worked: remote_branch is Remote and
80 # source_branch is not.
81 self.assertIsInstance(remote_branch, RemoteBranch)
82 self.failIf(isinstance(vfs_branch, RemoteBranch))
83 # Now, get_vfs_format_classes on both branches returns the same format
84 # information.
85 self.assertEqual(
86 get_vfs_format_classes(vfs_branch),
87 get_vfs_format_classes(remote_branch))
88
89
90class PrearrangedStackedBranchPolicy(AcceptAnythingPolicy):57class PrearrangedStackedBranchPolicy(AcceptAnythingPolicy):
91 """A branch policy that returns a pre-configurable stack-on URL."""58 """A branch policy that returns a pre-configurable stack-on URL."""
9259
9360
=== modified file 'lib/lp/codehosting/puller/worker.py'
--- lib/lp/codehosting/puller/worker.py 2009-09-08 23:12:55 +0000
+++ lib/lp/codehosting/puller/worker.py 2009-09-18 00:08:40 +0000
@@ -12,18 +12,19 @@
12from bzrlib.bzrdir import BzrDir12from bzrlib.bzrdir import BzrDir
13from bzrlib import errors13from bzrlib import errors
14from bzrlib.plugins.loom.branch import LoomSupport14from bzrlib.plugins.loom.branch import LoomSupport
15from bzrlib.remote import RemoteBranch, RemoteBzrDir, RemoteRepository
16from bzrlib.transport import get_transport15from bzrlib.transport import get_transport
17from bzrlib import urlutils16from bzrlib import urlutils
18from bzrlib.ui import SilentUIFactory17from bzrlib.ui import SilentUIFactory
19import bzrlib.ui18import bzrlib.ui
2019
21from canonical.config import config20from canonical.config import config
21from canonical.launchpad.webapp import errorlog
22
23from lp.codehosting.bzrutils import identical_formats
24from lp.codehosting.puller import get_lock_id_for_branch_id
22from lp.codehosting.vfs.branchfs import (25from lp.codehosting.vfs.branchfs import (
23 BadUrlLaunchpad, BadUrlScheme, BadUrlSsh, make_branch_mirrorer)26 BadUrlLaunchpad, BadUrlScheme, BadUrlSsh, make_branch_mirrorer)
24from lp.codehosting.puller import get_lock_id_for_branch_id
25from lp.code.enums import BranchType27from lp.code.enums import BranchType
26from canonical.launchpad.webapp import errorlog
27from lazr.uri import InvalidURIError28from lazr.uri import InvalidURIError
2829
2930
@@ -119,37 +120,6 @@
119 self.sendEvent('log', fmt % args)120 self.sendEvent('log', fmt % args)
120121
121122
122def get_vfs_format_classes(branch):
123 """Return the vfs classes of the branch, repo and bzrdir formats.
124
125 'vfs' here means that it will return the underlying format classes of a
126 remote branch.
127 """
128 if isinstance(branch, RemoteBranch):
129 branch._ensure_real()
130 branch = branch._real_branch
131 repository = branch.repository
132 if isinstance(repository, RemoteRepository):
133 repository._ensure_real()
134 repository = repository._real_repository
135 bzrdir = branch.bzrdir
136 if isinstance(bzrdir, RemoteBzrDir):
137 bzrdir._ensure_real()
138 bzrdir = bzrdir._real_bzrdir
139 return (
140 branch._format.__class__,
141 repository._format.__class__,
142 bzrdir._format.__class__,
143 )
144
145
146def identical_formats(branch_one, branch_two):
147 """Check if two branches have the same bzrdir, repo, and branch formats.
148 """
149 return (get_vfs_format_classes(branch_one) ==
150 get_vfs_format_classes(branch_two))
151
152
153class BranchMirrorer(object):123class BranchMirrorer(object):
154 """A `BranchMirrorer` safely makes mirrors of branches.124 """A `BranchMirrorer` safely makes mirrors of branches.
155125
156126
=== modified file 'lib/lp/codehosting/scanner/tests/test_formats.py'
--- lib/lp/codehosting/scanner/tests/test_formats.py 2009-06-30 16:56:07 +0000
+++ lib/lp/codehosting/scanner/tests/test_formats.py 2009-09-17 05:11:31 +0000
@@ -12,9 +12,27 @@
12 BranchFormat, ControlFormat, RepositoryFormat)12 BranchFormat, ControlFormat, RepositoryFormat)
1313
1414
15class TestScanFormat2a(BzrSyncTestCase):
16 """Test scanning of 2a repositories."""
17
18 def testRecognize2a(self):
19 """Ensure scanner records correct formats for pack branches."""
20 self.makeBzrSync(self.db_branch).syncBranchAndClose()
21 self.assertEqual(self.db_branch.branch_format,
22 BranchFormat.BZR_BRANCH_7)
23 self.assertEqual(self.db_branch.repository_format,
24 RepositoryFormat.BZR_CHK_2A)
25 self.assertEqual(self.db_branch.control_format,
26 ControlFormat.BZR_METADIR_1)
27
28
15class TestScanFormatPack(BzrSyncTestCase):29class TestScanFormatPack(BzrSyncTestCase):
16 """Test scanning of pack-format repositories."""30 """Test scanning of pack-format repositories."""
1731
32 def makeBzrBranchAndTree(self, db_branch):
33 return BzrSyncTestCase.makeBzrBranchAndTree(
34 self, db_branch, 'pack-0.92')
35
18 def testRecognizePack(self):36 def testRecognizePack(self):
19 """Ensure scanner records correct formats for pack branches."""37 """Ensure scanner records correct formats for pack branches."""
20 self.makeBzrSync(self.db_branch).syncBranchAndClose()38 self.makeBzrSync(self.db_branch).syncBranchAndClose()
2139
=== modified file 'lib/lp/codehosting/tests/test_bzrutils.py'
--- lib/lp/codehosting/tests/test_bzrutils.py 2009-07-17 00:26:05 +0000
+++ lib/lp/codehosting/tests/test_bzrutils.py 2009-09-18 00:08:40 +0000
@@ -8,10 +8,11 @@
8import gc8import gc
9import sys9import sys
1010
11from bzrlib import errors11from bzrlib import errors, trace
12from bzrlib.branch import Branch12from bzrlib.branch import Branch
13from bzrlib.bzrdir import format_registry13from bzrlib.bzrdir import format_registry
14from bzrlib import trace14from bzrlib.remote import RemoteBranch
15from bzrlib.smart import server
15from bzrlib.tests import (16from bzrlib.tests import (
16 multiply_tests, TestCase, TestCaseWithTransport, TestLoader,17 multiply_tests, TestCase, TestCaseWithTransport, TestLoader,
17 TestNotApplicable)18 TestNotApplicable)
@@ -20,9 +21,11 @@
20except ImportError:21except ImportError:
21 from bzrlib.tests.branch_implementations import (22 from bzrlib.tests.branch_implementations import (
22 TestCaseWithBzrDir, branch_scenarios)23 TestCaseWithBzrDir, branch_scenarios)
24
23from lp.codehosting.bzrutils import (25from lp.codehosting.bzrutils import (
24 add_exception_logging_hook, DenyingServer, get_branch_stacked_on_url,26 add_exception_logging_hook, DenyingServer, get_branch_stacked_on_url,
25 is_branch_stackable, remove_exception_logging_hook)27 get_vfs_format_classes, is_branch_stackable,
28 remove_exception_logging_hook)
26from lp.codehosting.tests.helpers import TestResultWrapper29from lp.codehosting.tests.helpers import TestResultWrapper
2730
2831
@@ -168,6 +171,37 @@
168 self.assertEqual([], exceptions)171 self.assertEqual([], exceptions)
169172
170173
174class TestGetVfsFormatClasses(TestCaseWithTransport):
175 """Tests for `lp.codehosting.bzrutils.get_vfs_format_classes`.
176 """
177
178 def tearDown(self):
179 # This makes sure the connections held by the branches opened in the
180 # test are dropped, so the daemon threads serving those branches can
181 # exit.
182 gc.collect()
183 super(TestGetVfsFormatClasses, self).tearDown()
184
185 def test_get_vfs_format_classes(self):
186 # get_vfs_format_classes for a returns the underlying format classes
187 # of the branch, repo and bzrdir, even if the branch is a
188 # RemoteBranch.
189 vfs_branch = self.make_branch('.')
190 smart_server = server.SmartTCPServer_for_testing()
191 smart_server.setUp(self.get_vfs_only_server())
192 self.addCleanup(smart_server.tearDown)
193 remote_branch = Branch.open(smart_server.get_url())
194 # Check that our set up worked: remote_branch is Remote and
195 # source_branch is not.
196 self.assertIsInstance(remote_branch, RemoteBranch)
197 self.failIf(isinstance(vfs_branch, RemoteBranch))
198 # Now, get_vfs_format_classes on both branches returns the same format
199 # information.
200 self.assertEqual(
201 get_vfs_format_classes(vfs_branch),
202 get_vfs_format_classes(remote_branch))
203
204
171def load_tests(basic_tests, module, loader):205def load_tests(basic_tests, module, loader):
172 """Parametrize the tests of get_branch_stacked_on_url by branch format."""206 """Parametrize the tests of get_branch_stacked_on_url by branch format."""
173 result = loader.suiteClass()207 result = loader.suiteClass()
@@ -181,6 +215,7 @@
181 result.addTests(loader.loadTestsFromTestCase(TestIsBranchStackable))215 result.addTests(loader.loadTestsFromTestCase(TestIsBranchStackable))
182 result.addTests(loader.loadTestsFromTestCase(TestDenyingServer))216 result.addTests(loader.loadTestsFromTestCase(TestDenyingServer))
183 result.addTests(loader.loadTestsFromTestCase(TestExceptionLoggingHooks))217 result.addTests(loader.loadTestsFromTestCase(TestExceptionLoggingHooks))
218 result.addTests(loader.loadTestsFromTestCase(TestGetVfsFormatClasses))
184 return result219 return result
185220
186221
187222
=== renamed file 'lib/lp/codehosting/puller/tests/test_format_comparison.py' => 'lib/lp/codehosting/tests/test_format_comparison.py'
--- lib/lp/codehosting/puller/tests/test_format_comparison.py 2009-06-25 04:06:00 +0000
+++ lib/lp/codehosting/tests/test_format_comparison.py 2009-09-18 00:08:40 +0000
@@ -7,7 +7,7 @@
77
8import unittest8import unittest
99
10from lp.codehosting.puller import worker10from lp.codehosting.bzrutils import identical_formats
1111
1212
13# Define a bunch of different fake format classes to pass to identical_formats13# Define a bunch of different fake format classes to pass to identical_formats
@@ -52,7 +52,7 @@
52 # identical_formats should return True when both branches have the same52 # identical_formats should return True when both branches have the same
53 # bzrdir, repository, and branch formats.53 # bzrdir, repository, and branch formats.
54 self.failUnless(54 self.failUnless(
55 worker.identical_formats(55 identical_formats(
56 StubBranch(BzrDirFormatA(), RepoFormatA(), BranchFormatA()),56 StubBranch(BzrDirFormatA(), RepoFormatA(), BranchFormatA()),
57 StubBranch(BzrDirFormatA(), RepoFormatA(), BranchFormatA())))57 StubBranch(BzrDirFormatA(), RepoFormatA(), BranchFormatA())))
5858
@@ -60,7 +60,7 @@
60 # identical_formats should return False when both branches have the60 # identical_formats should return False when both branches have the
61 # different bzrdir formats.61 # different bzrdir formats.
62 self.failIf(62 self.failIf(
63 worker.identical_formats(63 identical_formats(
64 StubBranch(BzrDirFormatA(), RepoFormatA(), BranchFormatA()),64 StubBranch(BzrDirFormatA(), RepoFormatA(), BranchFormatA()),
65 StubBranch(BzrDirFormatB(), RepoFormatA(), BranchFormatA())))65 StubBranch(BzrDirFormatB(), RepoFormatA(), BranchFormatA())))
6666
@@ -68,7 +68,7 @@
68 # identical_formats should return False when both branches have the68 # identical_formats should return False when both branches have the
69 # different repository formats.69 # different repository formats.
70 self.failIf(70 self.failIf(
71 worker.identical_formats(71 identical_formats(
72 StubBranch(BzrDirFormatA(), RepoFormatA(), BranchFormatA()),72 StubBranch(BzrDirFormatA(), RepoFormatA(), BranchFormatA()),
73 StubBranch(BzrDirFormatA(), RepoFormatB(), BranchFormatA())))73 StubBranch(BzrDirFormatA(), RepoFormatB(), BranchFormatA())))
7474
@@ -76,11 +76,10 @@
76 # identical_formats should return False when both branches have the76 # identical_formats should return False when both branches have the
77 # different branch formats.77 # different branch formats.
78 self.failIf(78 self.failIf(
79 worker.identical_formats(79 identical_formats(
80 StubBranch(BzrDirFormatA(), RepoFormatA(), BranchFormatA()),80 StubBranch(BzrDirFormatA(), RepoFormatA(), BranchFormatA()),
81 StubBranch(BzrDirFormatA(), RepoFormatA(), BranchFormatB())))81 StubBranch(BzrDirFormatA(), RepoFormatA(), BranchFormatB())))
8282
8383
84def test_suite():84def test_suite():
85 return unittest.TestLoader().loadTestsFromName(__name__)85 return unittest.TestLoader().loadTestsFromName(__name__)
86
8786
=== modified file 'versions.cfg'
--- versions.cfg 2009-09-14 21:54:37 +0000
+++ versions.cfg 2009-09-17 05:07:28 +0000
@@ -3,7 +3,7 @@
33
4[versions]4[versions]
5# Alphabetical, case-insensitive, please! :-)5# Alphabetical, case-insensitive, please! :-)
6bzr = 1.186bzr = 2.0rc2
7chameleon.core = 1.0b357chameleon.core = 1.0b35
8chameleon.zpt = 1.0b178chameleon.zpt = 1.0b17
9ClientForm = 0.2.109ClientForm = 0.2.10