~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/workingtree_implementations/test_inv.py

  • Committer: Robert Collins
  • Date: 2007-10-03 06:37:01 UTC
  • mfrom: (2871.1.4 commit-builder)
  • mto: This revision was merged to the branch mainline in revision 2933.
  • Revision ID: robertc@robertcollins.net-20071003063701-goxzcxccmwdukl6w
Merge bzr.dev (untested).

Show diffs side-by-side

added added

removed removed

Lines of Context:
67
67
                                  ('foo/bar', None, 'bar-id', None)])
68
68
        self.assertIs(None, wt.path2id('foo'))
69
69
 
 
70
    def test_rename_dir_with_children(self):
 
71
        wt = self.make_branch_and_tree('.')
 
72
        wt.lock_write()
 
73
        root_id = wt.get_root_id()
 
74
        self.addCleanup(wt.unlock)
 
75
        self.build_tree(['foo/', 'foo/bar'])
 
76
        wt.add(['foo', 'foo/bar'],
 
77
               ['foo-id', 'bar-id'])
 
78
        wt.apply_inventory_delta([('foo', 'baz', 'foo-id',
 
79
            inventory.InventoryDirectory('foo-id', 'baz', root_id))])
 
80
        # foo/bar should have been followed the rename of its parent to baz/bar
 
81
        self.assertEqual('baz/bar', wt.id2path('bar-id'))
 
82
 
 
83
    def test_rename_dir_with_children_with_children(self):
 
84
        wt = self.make_branch_and_tree('.')
 
85
        wt.lock_write()
 
86
        root_id = wt.get_root_id()
 
87
        self.addCleanup(wt.unlock)
 
88
        self.build_tree(['foo/', 'foo/bar/', 'foo/bar/baz'])
 
89
        wt.add(['foo', 'foo/bar', 'foo/bar/baz'],
 
90
               ['foo-id', 'bar-id', 'baz-id'])
 
91
        wt.apply_inventory_delta([('foo', 'quux', 'foo-id',
 
92
            inventory.InventoryDirectory('foo-id', 'quux', root_id))])
 
93
        # foo/bar/baz should have been followed the rename of its parent's
 
94
        # parent to quux/bar/baz
 
95
        self.assertEqual('quux/bar/baz', wt.id2path('baz-id'))
 
96
 
70
97
    def test_rename_file(self):
71
98
        wt = self.make_branch_and_tree('.')
72
99
        wt.lock_write()
73
 
        root_id = wt.get_root_id()
74
100
        self.addCleanup(wt.unlock)
75
101
        self.build_tree(['foo/', 'foo/bar', 'baz/'])
76
102
        wt.add(['foo', 'foo/bar', 'baz'],
110
136
        self.build_tree(['dir/', 'dir/child', 'other/'])
111
137
        wt.add(['dir', 'dir/child', 'other'],
112
138
               ['dir-id', 'child-id', 'other-id'])
 
139
        # this delta moves dir-id to dir2 and reparents 
 
140
        # child-id to a parent of other-id
113
141
        wt.apply_inventory_delta([('dir', 'dir2', 'dir-id',
114
142
            inventory.InventoryDirectory('dir-id', 'dir2', root_id)),
115
143
            ('dir/child', 'other/child', 'child-id',