228
228
branch = _mod_branch.Branch.open('.')
229
229
self.assertEquals(branch._format.features, {})
231
def test_register_unregister_format(self):
232
# Test the deprecated format registration functions
233
format = SampleBranchFormat()
235
dir = bzrdir.BzrDirMetaFormat1().initialize(self.get_url())
237
format.initialize(dir)
238
# register a format for it.
239
self.applyDeprecated(symbol_versioning.deprecated_in((2, 4, 0)),
240
_mod_branch.BranchFormat.register_format, format)
241
# which branch.Open will refuse (not supported)
242
self.assertRaises(errors.UnsupportedFormatError,
243
_mod_branch.Branch.open, self.get_url())
244
self.make_branch_and_tree('foo')
245
# but open_downlevel will work
248
controldir.ControlDir.open(self.get_url()).open_branch(unsupported=True))
249
# unregister the format
250
self.applyDeprecated(symbol_versioning.deprecated_in((2, 4, 0)),
251
_mod_branch.BranchFormat.unregister_format, format)
252
self.make_branch_and_tree('bar')
255
232
class TestBranchFormatRegistry(tests.TestCase):
737
714
class TestPullResult(tests.TestCase):
739
def test_pull_result_to_int(self):
740
# to support old code, the pull result can be used as an int
741
r = _mod_branch.PullResult()
744
# this usage of results is not recommended for new code (because it
745
# doesn't describe very well what happened), but for api stability
746
# it's still supported
747
self.assertEqual(self.applyDeprecated(
748
symbol_versioning.deprecated_in((2, 3, 0)),
752
716
def test_report_changed(self):
753
717
r = _mod_branch.PullResult()
754
718
r.old_revid = "old-revid"