~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_transform.py

  • Committer: Martin Pool
  • Date: 2006-06-20 07:55:43 UTC
  • mfrom: (1798 +trunk)
  • mto: This revision was merged to the branch mainline in revision 1799.
  • Revision ID: mbp@sourcefrog.net-20060620075543-b10f6575d4a4fa32
[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
 
32
33
class TestTreeTransform(TestCaseInTempDir):
 
34
 
33
35
    def setUp(self):
34
36
        super(TestTreeTransform, self).setUp()
35
37
        self.wt = BzrDir.create_standalone_workingtree('.')
41
43
        return transform, transform.trans_id_tree_file_id(self.wt.get_root_id())
42
44
 
43
45
    def test_existing_limbo(self):
44
 
        limbo_name = self.wt._control_files.controlfilename('limbo')
 
46
        limbo_name = urlutils.local_path_from_url(
 
47
            self.wt._control_files.controlfilename('limbo'))
45
48
        transform, root = self.get_transform()
46
49
        os.mkdir(pathjoin(limbo_name, 'hehe'))
47
50
        self.assertRaises(ImmortalLimbo, transform.apply)
492
495
        self.assertRaises(NotVersionedError, find_interesting, wt, wt,
493
496
                          ['uvfile'])
494
497
 
 
498
    def test_set_executability_order(self):
 
499
        """Ensure that executability behaves the same, no matter what order.
 
500
        
 
501
        - create file and set executability simultaneously
 
502
        - create file and set executability afterward
 
503
        - unsetting the executability of a file whose executability has not been
 
504
        declared should throw an exception (this may happen when a
 
505
        merge attempts to create a file with a duplicate ID)
 
506
        """
 
507
        transform, root = self.get_transform()
 
508
        wt = transform._tree
 
509
        transform.new_file('set_on_creation', root, 'Set on creation', 'soc',
 
510
                           True)
 
511
        sac = transform.new_file('set_after_creation', root, 'Set after creation', 'sac')
 
512
        transform.set_executability(True, sac)
 
513
        uws = transform.new_file('unset_without_set', root, 'Unset badly', 'uws')
 
514
        self.assertRaises(KeyError, transform.set_executability, None, uws)
 
515
        transform.apply()
 
516
        self.assertTrue(wt.is_executable('soc'))
 
517
        self.assertTrue(wt.is_executable('sac'))
 
518
 
495
519
 
496
520
class TransformGroup(object):
497
521
    def __init__(self, dirname):