~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_transform.py

  • Committer: Alexander Belchenko
  • Date: 2007-12-01 21:59:46 UTC
  • mto: This revision was merged to the branch mainline in revision 3064.
  • Revision ID: bialix@ukr.net-20071201215946-cv7sc7jdv2czuisf
Catch OSError 17 (file exists) in final phase of tree transform and show filename to user (#111758).

Show diffs side-by-side

added added

removed removed

Lines of Context:
36
36
from bzrlib.osutils import file_kind, pathjoin
37
37
from bzrlib.merge import Merge3Merger
38
38
from bzrlib.tests import (
 
39
    CaseInsensitiveFilesystemFeature,
39
40
    SymlinkFeature,
40
41
    TestCase,
41
42
    TestCaseInTempDir,
1088
1089
        self.callDeprecated([txt], change_entry, None, None, None, None, None,
1089
1090
            None, None, None)
1090
1091
 
 
1092
    def test_case_insensitive_clash(self):
 
1093
        self.requireFeature(CaseInsensitiveFilesystemFeature)
 
1094
        def tt_helper():
 
1095
            wt = self.make_branch_and_tree('.')
 
1096
            tt = TreeTransform(wt)  # TreeTransform obtains write lock
 
1097
            try:
 
1098
                tt.new_file('foo', tt.root, 'bar')
 
1099
                tt.new_file('Foo', tt.root, 'spam')
 
1100
                tt.apply(no_conflicts=True)
 
1101
            finally:
 
1102
                wt.unlock()
 
1103
        err = self.assertRaises(errors.FileExists, tt_helper)
 
1104
        self.assertContainsRe(str(err),
 
1105
            "^File exists: .+/foo")
 
1106
 
1091
1107
 
1092
1108
class TransformGroup(object):
 
1109
 
1093
1110
    def __init__(self, dirname, root_id):
1094
1111
        self.name = dirname
1095
1112
        os.mkdir(dirname)
1462
1479
        object.__init__(self)
1463
1480
        self.name = "name"
1464
1481
 
 
1482
 
1465
1483
class TestGetBackupName(TestCase):
1466
1484
    def test_get_backup_name(self):
1467
1485
        tt = MockTransform()