~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_transform.py

Got creation of a versioned file working

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
from bzrlib.tests import TestCaseInTempDir
 
2
from bzrlib.branch import Branch
 
3
from bzrlib.transform import TreeTransform
 
4
 
 
5
class TestTreeTransform(TestCaseInTempDir):
 
6
    def test_build(self):
 
7
        branch = Branch.initialize('.')
 
8
        wt = branch.working_tree()
 
9
        transform = TreeTransform(wt)
 
10
        try:
 
11
            root = transform.get_id_tree(wt.get_root_id())
 
12
            trans_id = transform.create_path('name', transform.root)
 
13
            transform.create_file('contents', trans_id)
 
14
            transform.version_file('my_pretties', trans_id)
 
15
            transform.apply()
 
16
            self.assertEqual('contents', file('name').read())
 
17
            self.assertEqual(wt.path2id('name'), 'my_pretties')
 
18
        finally:
 
19
            transform.finalize()
 
20
        # is it safe to finalize repeatedly?
 
21
        transform.finalize()