~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_transform.py

  • Committer: Jelmer Vernooij
  • Date: 2012-02-23 19:45:15 UTC
  • mto: This revision was merged to the branch mainline in revision 6486.
  • Revision ID: jelmer@samba.org-20120223194515-1ctgfzj362m0tu0k
Use bzrdir.controldir for generic access to control directories.

Show diffs side-by-side

added added

removed removed

Lines of Context:
88
88
 
89
89
    def setUp(self):
90
90
        super(TestTreeTransform, self).setUp()
91
 
        self.wt = self.make_branch_and_tree('.', format='dirstate-with-subtree')
 
91
        self.wt = self.make_branch_and_tree('.', format='development-subtree')
92
92
        os.chdir('..')
93
93
 
94
94
    def get_transform(self):
399
399
        tree.lock_read()
400
400
        self.addCleanup(tree.unlock)
401
401
        self.assertEqual('subtree-revision',
402
 
                         tree.inventory['subtree-id'].reference_revision)
 
402
                         tree.root_inventory['subtree-id'].reference_revision)
403
403
 
404
404
    def test_conflicts(self):
405
405
        transform, root = self.get_transform()
1532
1532
        self.assertPathExists("foo/bar")
1533
1533
        wt.lock_read()
1534
1534
        try:
1535
 
            self.assertEqual(wt.inventory.get_file_kind(wt.path2id("foo")),
1536
 
                    "directory")
 
1535
            self.assertEqual(wt.kind(wt.path2id("foo")), "directory")
1537
1536
        finally:
1538
1537
            wt.unlock()
1539
1538
        wt.commit("two")
1555
1554
        self.assertPathExists("foo")
1556
1555
        wt.lock_read()
1557
1556
        self.addCleanup(wt.unlock)
1558
 
        self.assertEqual(wt.inventory.get_file_kind(wt.path2id("foo")),
1559
 
                "symlink")
 
1557
        self.assertEqual(wt.kind(wt.path2id("foo")), "symlink")
1560
1558
 
1561
1559
    def test_dir_to_file(self):
1562
1560
        wt = self.make_branch_and_tree('.')
1574
1572
        self.assertPathExists("foo")
1575
1573
        wt.lock_read()
1576
1574
        self.addCleanup(wt.unlock)
1577
 
        self.assertEqual(wt.inventory.get_file_kind(wt.path2id("foo")),
1578
 
                "file")
 
1575
        self.assertEqual(wt.kind(wt.path2id("foo")), "file")
1579
1576
 
1580
1577
    def test_dir_to_hardlink(self):
1581
1578
        self.requireFeature(HardlinkFeature)
1596
1593
        self.assertPathExists("baz")
1597
1594
        wt.lock_read()
1598
1595
        self.addCleanup(wt.unlock)
1599
 
        self.assertEqual(wt.inventory.get_file_kind(wt.path2id("foo")),
1600
 
                "file")
 
1596
        self.assertEqual(wt.kind(wt.path2id("foo")), "file")
1601
1597
 
1602
1598
    def test_no_final_path(self):
1603
1599
        transform, root = self.get_transform()
1902
1898
 
1903
1899
    def test_build_with_references(self):
1904
1900
        tree = self.make_branch_and_tree('source',
1905
 
            format='dirstate-with-subtree')
 
1901
            format='development-subtree')
1906
1902
        subtree = self.make_branch_and_tree('source/subtree',
1907
 
            format='dirstate-with-subtree')
 
1903
            format='development-subtree')
1908
1904
        tree.add_reference(subtree)
1909
1905
        tree.commit('a revision')
1910
1906
        tree.branch.create_checkout('target')
2796
2792
 
2797
2793
    def test_iter_changes(self):
2798
2794
        revision_tree, preview_tree = self.get_tree_and_preview_tree()
2799
 
        root = revision_tree.inventory.root.file_id
 
2795
        root = revision_tree.get_root_id()
2800
2796
        self.assertEqual([('a-id', ('a', 'a'), True, (True, True),
2801
2797
                          (root, root), ('a', 'a'), ('file', 'file'),
2802
2798
                          (False, False))],
2806
2802
        revision_tree, preview_tree = self.get_tree_and_preview_tree()
2807
2803
        changes = preview_tree.iter_changes(revision_tree,
2808
2804
                                            include_unchanged=True)
2809
 
        root = revision_tree.inventory.root.file_id
 
2805
        root = revision_tree.get_root_id()
2810
2806
 
2811
2807
        self.assertEqual([ROOT_ENTRY, A_ENTRY], list(changes))
2812
2808
 
3638
3634
        self.assertRaises(NotImplementedError, tt.new_orphan, 'foo', 'bar')
3639
3635
 
3640
3636
    def _set_orphan_policy(self, wt, policy):
3641
 
        wt.branch.get_config().set_user_option('bzr.transform.orphan_policy',
 
3637
        wt.branch.get_config_stack().set('bzr.transform.orphan_policy',
3642
3638
                                               policy)
3643
3639
 
3644
3640
    def _prepare_orphan(self, wt):
3717
3713
        self.assertEqual(('deleting parent', 'Not deleting', 'new-1'),
3718
3714
                         remaining_conflicts.pop())
3719
3715
        self.assertLength(1, warnings)
3720
 
        self.assertStartsWith(warnings[0], 'donttouchmypreciouuus')
 
3716
        self.assertStartsWith(warnings[0], 'Value "donttouchmypreciouuus" ')
3721
3717
 
3722
3718
 
3723
3719
class TestTransformHooks(tests.TestCaseWithTransport):