~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_transform.py

Fixed up tests for Windows

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
from bzrlib.errors import (DuplicateKey, MalformedTransform, NoSuchFile,
20
20
                           ReusingTransform, CantMoveRoot, NotVersionedError,
21
21
                           ExistingLimbo, ImmortalLimbo, LockError)
22
 
from bzrlib.osutils import file_kind, has_symlinks
 
22
from bzrlib.osutils import file_kind, has_symlinks, pathjoin
23
23
from bzrlib.merge import Merge3Merger
24
24
from bzrlib.tests import TestCaseInTempDir, TestSkipped
25
25
from bzrlib.transform import (TreeTransform, ROOT_PARENT, FinalPaths, 
41
41
    def test_existing_limbo(self):
42
42
        limbo_name = self.wt._control_files.controlfilename('limbo')
43
43
        transform, root = self.get_transform()
44
 
        os.mkdir(os.path.join(limbo_name, 'hehe'))
 
44
        os.mkdir(pathjoin(limbo_name, 'hehe'))
45
45
        self.assertRaises(ImmortalLimbo, transform.apply)
46
46
        self.assertRaises(LockError, self.wt.unlock)
47
47
        self.assertRaises(ExistingLimbo, self.get_transform)
48
48
        self.assertRaises(LockError, self.wt.unlock)
49
 
        os.rmdir(os.path.join(limbo_name, 'hehe'))
 
49
        os.rmdir(pathjoin(limbo_name, 'hehe'))
50
50
        os.rmdir(limbo_name)
51
51
        transform, root = self.get_transform()
52
52
        transform.apply()
166
166
        result = transform2.find_conflicts()
167
167
        fp = FinalPaths(transform2)
168
168
        self.assert_('oz/tip' in transform2._tree_path_ids)
169
 
        self.assertEqual(fp.get_path(newtip), os.path.join('oz', 'tip'))
 
169
        self.assertEqual(fp.get_path(newtip), pathjoin('oz', 'tip'))
170
170
        self.assertEqual(len(result), 2)
171
171
        self.assertEqual((result[0][0], result[0][1]), 
172
172
                         ('duplicate', newtip))
239
239
        mangle_tree.apply()
240
240
        self.assertEqual(file(self.wt.abspath('name1')).read(), 'hello2')
241
241
        self.assertEqual(file(self.wt.abspath('name2')).read(), 'hello1')
242
 
        mfile2_path = self.wt.abspath(os.path.join('new_directory','mfile2'))
 
242
        mfile2_path = self.wt.abspath(pathjoin('new_directory','mfile2'))
243
243
        self.assertEqual(mangle_tree.final_parent(mfile2), newdir)
244
244
        self.assertEqual(file(mfile2_path).read(), 'later2')
245
245
        self.assertEqual(self.wt.id2path('mfile2'), 'new_directory/mfile2')
246
246
        self.assertEqual(self.wt.path2id('new_directory/mfile2'), 'mfile2')
247
 
        newfile_path = self.wt.abspath(os.path.join('new_directory','newfile'))
 
247
        newfile_path = self.wt.abspath(pathjoin('new_directory','newfile'))
248
248
        self.assertEqual(file(newfile_path).read(), 'hello3')
249
249
        self.assertEqual(self.wt.path2id('dying_directory'), 'ddir')
250
250
        self.assertIs(self.wt.path2id('dying_directory/dying_file'), None)
251
 
        mfile2_path = self.wt.abspath(os.path.join('new_directory','mfile2'))
 
251
        mfile2_path = self.wt.abspath(pathjoin('new_directory','mfile2'))
252
252
 
253
253
    def test_both_rename(self):
254
254
        create_tree,root = self.get_transform()
624
624
        for tg in [this, base, other]:
625
625
            tg.tt.apply()
626
626
        Merge3Merger(this.wt, this.wt, base.wt, other.wt)
627
 
        self.assertEqual(this.wt.id2path('c'), os.path.join('b/c1'))
628
 
        self.assertEqual(this.wt.id2path('d'), os.path.join('b/d1'))
629
 
        self.assertEqual(this.wt.id2path('e'), os.path.join('b/e1'))
630
 
        self.assertEqual(this.wt.id2path('f'), os.path.join('b/f1'))
 
627
        self.assertEqual(this.wt.id2path('c'), pathjoin('b/c1'))
 
628
        self.assertEqual(this.wt.id2path('d'), pathjoin('b/d1'))
 
629
        self.assertEqual(this.wt.id2path('e'), pathjoin('b/e1'))
 
630
        self.assertEqual(this.wt.id2path('f'), pathjoin('b/f1'))
631
631
 
632
632
    def test_filename_merge_conflicts(self):
633
633
        base = TransformGroup("BASE")
651
651
            tg.tt.apply()
652
652
        Merge3Merger(this.wt, this.wt, base.wt, other.wt)
653
653
 
654
 
        self.assertEqual(this.wt.id2path('g'), os.path.join('b/g1.OTHER'))
 
654
        self.assertEqual(this.wt.id2path('g'), pathjoin('b/g1.OTHER'))
655
655
        self.assertIs(os.path.lexists(this.wt.abspath('b/g1.BASE')), True)
656
656
        self.assertIs(os.path.lexists(this.wt.abspath('b/g1.THIS')), False)
657
 
        self.assertEqual(this.wt.id2path('h'), os.path.join('b/h1.THIS'))
 
657
        self.assertEqual(this.wt.id2path('h'), pathjoin('b/h1.THIS'))
658
658
        self.assertIs(os.path.lexists(this.wt.abspath('b/h1.BASE')), True)
659
659
        self.assertIs(os.path.lexists(this.wt.abspath('b/h1.OTHER')), False)
660
 
        self.assertEqual(this.wt.id2path('i'), os.path.join('b/i1.OTHER'))
 
660
        self.assertEqual(this.wt.id2path('i'), pathjoin('b/i1.OTHER'))