312
312
self.assertRaises(errors.IncompatibleFormat, serializer.write,
313
313
b.repository, [], {}, StringIO())
315
class BundleTester(TestCaseWithTransport):
315
class V08BundleTester(TestCaseWithTransport):
319
def bzrdir_format(self):
320
format = bzrdir.BzrDirMetaFormat1()
321
format.repository_format = repository.RepositoryFormatKnit1()
324
def make_branch_and_tree(self, path, format=None):
326
format = self.bzrdir_format()
327
return TestCaseWithTransport.make_branch_and_tree(self, path, format)
329
def make_branch(self, path, format=None):
331
format = self.bzrdir_format()
332
return TestCaseWithTransport.make_branch(self, path, format)
317
334
def create_bundle_text(self, base_rev_id, rev_id):
318
335
bundle_txt = StringIO()
319
336
rev_ids = write_bundle(self.b1.repository, rev_id, base_rev_id,
337
bundle_txt, format=self.format)
321
338
bundle_txt.seek(0)
322
339
self.assertEqual(bundle_txt.readline(),
323
340
'# Bazaar revision bundle v0.8\n')
403
420
if not os.path.exists(checkout_dir):
404
421
os.mkdir(checkout_dir)
405
tree = BzrDir.create_standalone_workingtree(checkout_dir)
422
tree = self.make_branch_and_tree(checkout_dir)
407
ancestors = write_bundle(self.b1.repository, rev_id, None, s)
424
ancestors = write_bundle(self.b1.repository, rev_id, None, s,
409
427
assert isinstance(s.getvalue(), str), (
410
428
"Bundle isn't a bytestring:\n %s..." % repr(s.getvalue())[:40])
592
610
def test_symlink_bundle(self):
593
611
if not has_symlinks():
594
612
raise TestSkipped("No symlink support")
595
self.tree1 = BzrDir.create_standalone_workingtree('b1')
613
self.tree1 = self.make_branch_and_tree('b1')
596
614
self.b1 = self.tree1.branch
597
615
tt = TreeTransform(self.tree1)
598
616
tt.new_symlink('link', tt.root, 'bar/foo', 'link-1')
622
640
self.get_valid_bundle('l@cset-0-3', 'l@cset-0-4')
624
642
def test_binary_bundle(self):
625
self.tree1 = BzrDir.create_standalone_workingtree('b1')
643
self.tree1 = self.make_branch_and_tree('b1')
626
644
self.b1 = self.tree1.branch
627
645
tt = TreeTransform(self.tree1)
664
682
self.get_valid_bundle(None, 'b@cset-0-4')
666
684
def test_last_modified(self):
667
self.tree1 = BzrDir.create_standalone_workingtree('b1')
685
self.tree1 = self.make_branch_and_tree('b1')
668
686
self.b1 = self.tree1.branch
669
687
tt = TreeTransform(self.tree1)
670
688
tt.new_file('file', tt.root, 'file', 'file')
692
710
bundle = self.get_valid_bundle('a@lmod-0-2a', 'a@lmod-0-4')
694
712
def test_hide_history(self):
695
self.tree1 = BzrDir.create_standalone_workingtree('b1')
713
self.tree1 = self.make_branch_and_tree('b1')
696
714
self.b1 = self.tree1.branch
698
716
open('b1/one', 'wb').write('one\n')
822
840
self.assertEqual('revid1', tree.inventory.root.revision)
843
class V09BundleTester(V08BundleTester):
847
def bzrdir_format(self):
848
format = bzrdir.BzrDirMetaFormat1()
849
format.repository_format = repository.RepositoryFormatKnit2()
825
853
class MungedBundleTester(TestCaseWithTransport):
827
855
def build_test_bundle(self):