~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_transform.py

  • Committer: Andrew Bennetts
  • Date: 2010-05-14 09:02:35 UTC
  • mfrom: (5230 +trunk)
  • mto: This revision was merged to the branch mainline in revision 5232.
  • Revision ID: andrew.bennetts@canonical.com-20100514090235-32z3rbfplw712csz
MergeĀ lp:bzr.

Show diffs side-by-side

added added

removed removed

Lines of Context:
852
852
        rename.set_executability(True, myfile)
853
853
        rename.apply()
854
854
 
 
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',
 
860
                                 'myfile-id')
 
861
        create.apply()
 
862
        # make the file and directory readonly in the hope this will prevent
 
863
        # renames
 
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)
 
873
        # Looks like: 
 
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:")
 
880
 
855
881
    def test_set_executability_order(self):
856
882
        """Ensure that executability behaves the same, no matter what order.
857
883