1476
1478
format=dir._format), bzrdir.Converter))
1477
1479
dir.needs_format_conversion(None)
1481
def test_backup_copies_existing(self):
1482
tree = self.make_branch_and_tree('test')
1483
self.build_tree(['test/a'])
1484
tree.add(['a'], ['a-id'])
1485
tree.commit('some data to be copied.')
1486
old_url, new_url = tree.bzrdir.backup_bzrdir()
1487
old_path = urlutils.local_path_from_url(old_url)
1488
new_path = urlutils.local_path_from_url(new_url)
1489
self.failUnlessExists(old_path)
1490
self.failUnlessExists(new_path)
1491
for (((dir_relpath1, _), entries1),
1492
((dir_relpath2, _), entries2)) in izip(
1493
osutils.walkdirs(old_path),
1494
osutils.walkdirs(new_path)):
1495
self.assertEquals(dir_relpath1, dir_relpath2)
1496
for f1, f2 in zip(entries1, entries2):
1497
self.assertEquals(f1[0], f2[0])
1498
self.assertEquals(f1[2], f2[2])
1500
osutils.compare_files(open(f1[4]), open(f2[4]))
1479
1502
def test_upgrade_new_instance(self):
1480
1503
"""Does an available updater work?"""
1481
1504
dir = self.make_bzrdir('.')