852
852
rename.set_executability(True, myfile)
855
def test_rename_fails(self):
856
# see https://bugs.launchpad.net/bzr/+bug/491763
857
create, root_id = self.get_transform()
858
first_dir = create.new_directory('first-dir', root_id, 'first-id')
859
myfile = create.new_file('myfile', root_id, 'myfile-text',
862
# make the file and directory readonly in the hope this will prevent
864
osutils.make_readonly(self.wt.abspath('first-dir'))
865
osutils.make_readonly(self.wt.abspath('myfile'))
866
# now transform to rename
867
rename_transform, root_id = self.get_transform()
868
file_trans_id = rename_transform.trans_id_file_id('myfile-id')
869
dir_id = rename_transform.trans_id_file_id('first-id')
870
rename_transform.adjust_path('newname', dir_id, file_trans_id)
871
e = self.assertRaises(errors.TransformRenameFailed,
872
rename_transform.apply)
874
# "Failed to rename .../work/.bzr/checkout/limbo/new-1
875
# to .../first-dir/newname: [Errno 13] Permission denied"
876
# so the first filename is not visible in it; we expect a strerror but
877
# it may vary per OS and language so it's not checked here
878
self.assertContainsRe(str(e),
879
"Failed to rename .*first-dir.newname:")
855
881
def test_set_executability_order(self):
856
882
"""Ensure that executability behaves the same, no matter what order.