def test_revert_executable(self): tree = self.tree_with_executable() tt = transform.TreeTransform(tree) newfile = tt.trans_id_tree_file_id('newfile-id') tt.set_executability(False, newfile) tt.apply() tree.lock_write() self.addCleanup(tree.unlock) transform.revert(tree, tree.basis_tree(), None) self.assertTrue(tree.is_executable('newfile-id'))
def test_preserve_execute(self): tree = self.tree_with_executable() tt = transform.TreeTransform(tree) newfile = tt.trans_id_tree_file_id('newfile-id') tt.delete_contents(newfile) tt.create_file('Woooorld!', newfile) tt.apply() tree = workingtree.WorkingTree.open('tree') tree.lock_write() self.addCleanup(tree.unlock) self.assertTrue(tree.is_executable('newfile-id')) transform.revert(tree, tree.basis_tree(), None, backups=True) self.assertEqual('helooo!', tree.get_file('newfile-id').read()) self.assertTrue(tree.is_executable('newfile-id'))