~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_transform.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2009-05-20 18:22:53 UTC
  • mfrom: (4354.4.4 commit-preview)
  • Revision ID: pqm@pqm.ubuntu.com-20090520182253-iqt2y0uikaxswu56
(abentley) Enable committing from a PreviewTree.

Show diffs side-by-side

added added

removed removed

Lines of Context:
2604
2604
                                                           'tree/foo'))
2605
2605
        self.assertEqual(False, preview_tree.is_executable('baz-id'))
2606
2606
 
 
2607
    def test_commit_preview_tree(self):
 
2608
        tree = self.make_branch_and_tree('tree')
 
2609
        rev_id = tree.commit('rev1')
 
2610
        tree.branch.lock_write()
 
2611
        self.addCleanup(tree.branch.unlock)
 
2612
        tt = TransformPreview(tree)
 
2613
        tt.new_file('file', tt.root, 'contents', 'file_id')
 
2614
        self.addCleanup(tt.finalize)
 
2615
        preview = tt.get_preview_tree()
 
2616
        preview.set_parent_ids([rev_id])
 
2617
        builder = tree.branch.get_commit_builder([rev_id])
 
2618
        list(builder.record_iter_changes(preview, rev_id, tt.iter_changes()))
 
2619
        builder.finish_inventory()
 
2620
        rev2_id = builder.commit('rev2')
 
2621
        rev2_tree = tree.branch.repository.revision_tree(rev2_id)
 
2622
        self.assertEqual('contents', rev2_tree.get_file_text('file_id'))
 
2623
 
2607
2624
 
2608
2625
class FakeSerializer(object):
2609
2626
    """Serializer implementation that simply returns the input.