~jeanfrancois.roy/bzr/url-safe-escape

« back to all changes in this revision

Viewing changes to bzrlib/tests/bzrdir_implementations/test_bzrdir.py

  • Committer: Mark Hammond
  • Date: 2008-12-28 05:21:23 UTC
  • mfrom: (3920 +trunk)
  • mto: (3932.1.1 prepare-1.11)
  • mto: This revision was merged to the branch mainline in revision 3937.
  • Revision ID: mhammond@skippinet.com.au-20081228052123-f78xs5sbdkotshwf
merge trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
28
28
    bzrdir,
29
29
    errors,
30
30
    lockdir,
 
31
    osutils,
31
32
    repository,
32
33
    revision as _mod_revision,
33
34
    transactions,
34
35
    transport,
35
36
    ui,
 
37
    urlutils,
36
38
    workingtree,
37
39
    )
38
40
from bzrlib.branch import Branch, needs_read_lock, needs_write_lock
1476
1478
                format=dir._format), bzrdir.Converter))
1477
1479
        dir.needs_format_conversion(None)
1478
1480
 
 
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])
 
1499
                if f1[2] == "file":
 
1500
                    osutils.compare_files(open(f1[4]), open(f2[4]))
 
1501
 
1479
1502
    def test_upgrade_new_instance(self):
1480
1503
        """Does an available updater work?"""
1481
1504
        dir = self.make_bzrdir('.')