~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_transform.py

Merge bzr.dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
28
28
from bzrlib.transform import (TreeTransform, ROOT_PARENT, FinalPaths, 
29
29
                              resolve_conflicts, cook_conflicts, 
30
30
                              find_interesting, build_tree, get_backup_name)
 
31
import bzrlib.urlutils as urlutils
31
32
from bzrlib.workingtree import gen_root_id
32
33
 
33
34
 
34
35
class TestTreeTransform(TestCaseInTempDir):
 
36
 
35
37
    def setUp(self):
36
38
        super(TestTreeTransform, self).setUp()
37
39
        self.wt = BzrDir.create_standalone_workingtree('.')
43
45
        return transform, transform.root
44
46
 
45
47
    def test_existing_limbo(self):
46
 
        limbo_name = self.wt._control_files.controlfilename('limbo')
 
48
        limbo_name = urlutils.local_path_from_url(
 
49
            self.wt._control_files.controlfilename('limbo'))
47
50
        transform, root = self.get_transform()
48
51
        os.mkdir(pathjoin(limbo_name, 'hehe'))
49
52
        self.assertRaises(ImmortalLimbo, transform.apply)
494
497
        self.assertRaises(NotVersionedError, find_interesting, wt, wt,
495
498
                          ['uvfile'])
496
499
 
 
500
    def test_set_executability_order(self):
 
501
        """Ensure that executability behaves the same, no matter what order.
 
502
        
 
503
        - create file and set executability simultaneously
 
504
        - create file and set executability afterward
 
505
        - unsetting the executability of a file whose executability has not been
 
506
        declared should throw an exception (this may happen when a
 
507
        merge attempts to create a file with a duplicate ID)
 
508
        """
 
509
        transform, root = self.get_transform()
 
510
        wt = transform._tree
 
511
        transform.new_file('set_on_creation', root, 'Set on creation', 'soc',
 
512
                           True)
 
513
        sac = transform.new_file('set_after_creation', root, 'Set after creation', 'sac')
 
514
        transform.set_executability(True, sac)
 
515
        uws = transform.new_file('unset_without_set', root, 'Unset badly', 'uws')
 
516
        self.assertRaises(KeyError, transform.set_executability, None, uws)
 
517
        transform.apply()
 
518
        self.assertTrue(wt.is_executable('soc'))
 
519
        self.assertTrue(wt.is_executable('sac'))
 
520
 
497
521
 
498
522
class TransformGroup(object):
499
523
    def __init__(self, dirname, root_id):