~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_branchbuilder.py

  • Committer: John Arbash Meinel
  • Date: 2008-07-23 02:35:09 UTC
  • mto: (3514.4.17 merge_lca_multi)
  • mto: This revision was merged to the branch mainline in revision 3748.
  • Revision ID: john@arbash-meinel.com-20080723023509-1t4wkw5wjif7h72i
Implement rename_one on MemoryTree, and expose that in the Branch Builder

Show diffs side-by-side

added added

removed removed

Lines of Context:
196
196
        self.assertRaises(errors.UnknownBuildAction,
197
197
            builder.build_snapshot, 'B-id', None, [('weirdo', ('foo',))])
198
198
 
199
 
    # TODO: rename a file/directory, but rename isn't supported by the
200
 
    #       MemoryTree api yet, so for now we wait until it is used
 
199
    def test_rename(self):
 
200
        builder = self.build_a_rev()
 
201
        builder.build_snapshot('B-id', None,
 
202
            [('rename', ('a', 'b'))])
 
203
        rev_tree = builder.get_branch().repository.revision_tree('B-id')
 
204
        self.assertTreeShape([(u'', 'a-root-id', 'directory'),
 
205
                              (u'b', 'a-id', 'file')], rev_tree)
 
206
 
 
207
    def test_rename_into_subdir(self):
 
208
        builder = self.build_a_rev()
 
209
        builder.build_snapshot('B-id', None,
 
210
            [('add', ('dir', 'dir-id', 'directory', None)),
 
211
             ('rename', ('a', 'dir/a'))])
 
212
        rev_tree = builder.get_branch().repository.revision_tree('B-id')
 
213
        self.assertTreeShape([(u'', 'a-root-id', 'directory'),
 
214
                              (u'dir', 'dir-id', 'directory'),
 
215
                              (u'dir/a', 'a-id', 'file')], rev_tree)
201
216
 
202
217
    def test_set_parent(self):
203
218
        builder = self.build_a_rev()