/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: 2019-06-03 23:48:08 UTC
  • mfrom: (7316 work)
  • mto: This revision was merged to the branch mainline in revision 7328.
  • Revision ID: jelmer@jelmer.uk-20190603234808-15yk5c7054tj8e2b
Merge trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
85
85
 
86
86
    def tree_with_executable(self):
87
87
        tree = self.make_branch_and_tree('tree')
88
 
        tt = tree.get_transform()
 
88
        tt = transform.TreeTransform(tree)
89
89
        tt.new_file('newfile', tt.root, [b'helooo!'], b'newfile-id', True)
90
90
        tt.apply()
91
91
        with tree.lock_write():
95
95
 
96
96
    def test_preserve_execute(self):
97
97
        tree = self.tree_with_executable()
98
 
        tt = tree.get_transform()
 
98
        tt = transform.TreeTransform(tree)
99
99
        newfile = tt.trans_id_tree_path('newfile')
100
100
        tt.delete_contents(newfile)
101
101
        tt.create_file([b'Woooorld!'], newfile)
111
111
 
112
112
    def test_revert_executable(self):
113
113
        tree = self.tree_with_executable()
114
 
        tt = tree.get_transform()
 
114
        tt = transform.TreeTransform(tree)
115
115
        newfile = tt.trans_id_tree_path('newfile')
116
116
        tt.set_executability(False, newfile)
117
117
        tt.apply()
124
124
        tree = self.make_branch_and_tree('.')
125
125
        self.build_tree(['file'])
126
126
        tree.add('file')
127
 
        rev1 = tree.commit('added file')
128
 
        with tree.lock_read():
129
 
            file_sha = tree.get_file_sha1('file')
 
127
        tree.commit('added file', rev_id=b'rev1')
130
128
        os.unlink('file')
131
129
        tree.commit('removed file')
132
130
        self.assertPathDoesNotExist('file')
133
 
        tree.revert(old_tree=tree.branch.repository.revision_tree(rev1))
134
 
        self.assertEqual({'file': file_sha}, tree.merge_modified())
 
131
        tree.revert(old_tree=tree.branch.repository.revision_tree(b'rev1'))
135
132
        self.assertPathExists('file')
136
133
        tree.revert()
137
134
        self.assertPathDoesNotExist('file')
159
156
        tree.add(['file1'])
160
157
        tree.commit('first')
161
158
        tree.set_root_id(b'temp-root-id')
162
 
        self.assertEqual(b'temp-root-id', tree.path2id(''))
 
159
        self.assertEqual(b'temp-root-id', tree.get_root_id())
163
160
        tree.revert()
164
 
        self.assertEqual(b'initial-root-id', tree.path2id(''))
 
161
        self.assertEqual(b'initial-root-id', tree.get_root_id())