~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_workingtree.py

Merge from integration.

Show diffs side-by-side

added added

removed removed

Lines of Context:
50
50
class TestWorkingTree(TestCaseInTempDir):
51
51
 
52
52
    def test_listfiles(self):
53
 
        branch = Branch.initialize('.')
 
53
        branch = Branch.initialize(u'.')
54
54
        os.mkdir('dir')
55
55
        print >> open('file', 'w'), "content"
56
56
        os.symlink('target', 'symlink')
61
61
        self.assertEqual(files[2], ('symlink', '?', 'symlink', None, TreeLink()))
62
62
 
63
63
    def test_open_containing(self):
64
 
        branch = Branch.initialize('.')
 
64
        branch = Branch.initialize(u'.')
65
65
        wt, relpath = WorkingTree.open_containing()
66
66
        self.assertEqual('', relpath)
67
67
        self.assertEqual(wt.basedir, branch.base)
68
 
        wt, relpath = WorkingTree.open_containing('.')
 
68
        wt, relpath = WorkingTree.open_containing(u'.')
69
69
        self.assertEqual('', relpath)
70
70
        self.assertEqual(wt.basedir, branch.base)
71
71
        wt, relpath = WorkingTree.open_containing('./foo')
77
77
                          'file:///' + os.getcwdu())
78
78
 
79
79
    def test_construct_with_branch(self):
80
 
        branch = Branch.initialize('.')
 
80
        branch = Branch.initialize(u'.')
81
81
        tree = WorkingTree(branch.base, branch)
82
82
        self.assertEqual(branch, tree.branch)
83
83
        self.assertEqual(branch.base, tree.basedir)
84
84
    
85
85
    def test_construct_without_branch(self):
86
 
        branch = Branch.initialize('.')
 
86
        branch = Branch.initialize(u'.')
87
87
        tree = WorkingTree(branch.base)
88
88
        self.assertEqual(branch.base, tree.branch.base)
89
89
        self.assertEqual(branch.base, tree.basedir)
90
90
 
91
91
    def test_basic_relpath(self):
92
92
        # for comprehensive relpath tests, see whitebox.py.
93
 
        branch = Branch.initialize('.')
 
93
        branch = Branch.initialize(u'.')
94
94
        tree = WorkingTree(branch.base)
95
95
        self.assertEqual('child',
96
96
                         tree.relpath(os.path.join(os.getcwd(), 'child')))
97
97
 
98
98
    def test_lock_locks_branch(self):
99
 
        branch = Branch.initialize('.')
 
99
        branch = Branch.initialize(u'.')
100
100
        tree = WorkingTree(branch.base)
101
101
        tree.lock_read()
102
102
        self.assertEqual(1, tree.branch.control_files._lock_count)
135
135
 
136
136
    def test_revert(self):
137
137
        """Test selected-file revert"""
138
 
        b = Branch.initialize('.')
 
138
        b = Branch.initialize(u'.')
139
139
 
140
140
        self.build_tree(['hello.txt'])
141
141
        file('hello.txt', 'w').write('initial hello')
161
161
        self.check_file_contents('hello.txt~', 'new hello')
162
162
 
163
163
    def test_unknowns(self):
164
 
        b = Branch.initialize('.')
165
 
        tree = WorkingTree('.', b)
 
164
        b = Branch.initialize(u'.')
 
165
        tree = WorkingTree(u'.', b)
166
166
        self.build_tree(['hello.txt',
167
167
                         'hello.txt~'])
168
168
        self.assertEquals(list(tree.unknowns()),