/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to breezy/tests/test_revert.py

  • Committer: Jelmer Vernooij
  • Date: 2018-07-07 19:27:38 UTC
  • mto: (7027.4.10 python3-blackbox)
  • mto: This revision was merged to the branch mainline in revision 7038.
  • Revision ID: jelmer@jelmer.uk-20180707192738-cbt5f28lbd3lx4td
Add some more bees; support writing both bytes and unicode strings in build_tree_contents.

Show diffs side-by-side

added added

removed removed

Lines of Context:
86
86
        tt = transform.TreeTransform(tree)
87
87
        tt.new_file('newfile', tt.root, [b'helooo!'], b'newfile-id', True)
88
88
        tt.apply()
89
 
        tree.lock_write()
90
 
        try:
 
89
        with tree.lock_write():
91
90
            self.assertTrue(tree.is_executable('newfile'))
92
91
            tree.commit('added newfile')
93
 
        finally:
94
 
            tree.unlock()
95
92
        return tree
96
93
 
97
94
    def test_preserve_execute(self):
99
96
        tt = transform.TreeTransform(tree)
100
97
        newfile = tt.trans_id_tree_path('newfile')
101
98
        tt.delete_contents(newfile)
102
 
        tt.create_file('Woooorld!', newfile)
 
99
        tt.create_file([b'Woooorld!'], newfile)
103
100
        tt.apply()
104
101
        tree = workingtree.WorkingTree.open('tree')
105
102
        tree.lock_write()
138
135
        tree = self.make_branch_and_tree('.')
139
136
        self.build_tree(['dir/', 'dir/file1', 'dir/file2'])
140
137
        tree.add(['dir', 'dir/file1', 'dir/file2'],
141
 
                 ['dir-id', 'file1-id', 'file2-id'])
 
138
                 [b'dir-id', b'file1-id', b'file2-id'])
142
139
        tree.commit("Added files")
143
140
        os.unlink('dir/file1')
144
141
        os.unlink('dir/file2')
156
153
        tree.add(['file1'])
157
154
        tree.commit('first')
158
155
        tree.set_root_id(b'temp-root-id')
159
 
        self.assertEqual('temp-root-id', tree.get_root_id())
 
156
        self.assertEqual(b'temp-root-id', tree.get_root_id())
160
157
        tree.revert()
161
 
        self.assertEqual('initial-root-id', tree.get_root_id())
 
158
        self.assertEqual(b'initial-root-id', tree.get_root_id())