~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/per_workingtree/test_workingtree.py

  • Committer: Martin Packman
  • Date: 2012-01-05 09:50:04 UTC
  • mfrom: (6424 +trunk)
  • mto: This revision was merged to the branch mainline in revision 6426.
  • Revision ID: martin.packman@canonical.com-20120105095004-mia9xb7y0efmto0v
Merge bzr.dev to resolve conflicts in bzrlib.builtins

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
 
23
23
from bzrlib import (
24
24
    branch,
25
 
    branchbuilder,
26
25
    bzrdir,
27
26
    config,
28
27
    errors,
29
28
    osutils,
 
29
    revision as _mod_revision,
30
30
    symbol_versioning,
31
31
    tests,
32
32
    trace,
249
249
 
250
250
        wt.commit('create initial state')
251
251
 
252
 
        revid = b.revision_history()[0]
 
252
        revid = b.last_revision()
253
253
        self.log('first revision_id is {%s}' % revid)
254
254
 
255
255
        tree = b.repository.revision_tree(revid)
312
312
        cloned = cloned_dir.open_workingtree()
313
313
        self.assertEqual(cloned.get_parent_ids(), wt.get_parent_ids())
314
314
 
 
315
    def test_clone_empty(self):
 
316
        wt = self.make_branch_and_tree('source')
 
317
        cloned_dir = wt.bzrdir.clone('target', revision_id=_mod_revision.NULL_REVISION)
 
318
        cloned = cloned_dir.open_workingtree()
 
319
        self.assertEqual(cloned.get_parent_ids(), wt.get_parent_ids())
 
320
 
315
321
    def test_last_revision(self):
316
322
        wt = self.make_branch_and_tree('source')
317
323
        self.assertEqual([], wt.get_parent_ids())
623
629
        # which should have pivoted the local tip into a merge
624
630
        self.assertEqual([master_tip, 'bar'], tree.get_parent_ids())
625
631
        # and the local branch history should match the masters now.
626
 
        self.assertEqual(master_tree.branch.revision_history(),
627
 
            tree.branch.revision_history())
 
632
        self.assertEqual(master_tree.branch.last_revision(),
 
633
            tree.branch.last_revision())
628
634
 
629
635
    def test_update_takes_revision_parameter(self):
630
636
        wt = self.make_branch_and_tree('wt')
940
946
            case_sensitive = True
941
947
        tree = self.make_branch_and_tree('test')
942
948
        self.assertEqual(case_sensitive, tree.case_sensitive)
 
949
        if not isinstance(tree, InventoryWorkingTree):
 
950
            raise TestNotApplicable("get_format_string is only available "
 
951
                                    "on bzr working trees")
943
952
        # now we cheat, and make a file that matches the case-sensitive name
944
953
        t = tree.bzrdir.get_workingtree_transport(None)
945
954
        try:
951
960
        tree = tree.bzrdir.open_workingtree()
952
961
        self.assertFalse(tree.case_sensitive)
953
962
 
 
963
    def test_supports_executable(self):
 
964
        self.build_tree(['filename'])
 
965
        tree = self.make_branch_and_tree('.')
 
966
        tree.add('filename')
 
967
        self.assertIsInstance(tree._supports_executable(), bool)
 
968
        if tree._supports_executable():
 
969
            tree.lock_read()
 
970
            try:
 
971
                self.assertFalse(tree.is_executable(tree.path2id('filename')))
 
972
            finally:
 
973
                tree.unlock()
 
974
            os.chmod('filename', 0755)
 
975
            self.addCleanup(tree.lock_read().unlock)
 
976
            self.assertTrue(tree.is_executable(tree.path2id('filename')))
 
977
        else:
 
978
            self.addCleanup(tree.lock_read().unlock)
 
979
            self.assertFalse(tree.is_executable(tree.path2id('filename')))
 
980
 
954
981
    def test_all_file_ids_with_missing(self):
955
982
        tree = self.make_branch_and_tree('tree')
956
983
        tree.lock_write()
1001
1028
            4 5-M
1002
1029
            |
1003
1030
            W
1004
 
         """
1005
 
        builder = branchbuilder.BranchBuilder(
1006
 
            self.get_transport(),
1007
 
            format=self.workingtree_format._matchingbzrdir)
 
1031
        """
 
1032
        format = self.workingtree_format.get_controldir_for_branch()
 
1033
        builder = self.make_branch_builder(".", format=format)
1008
1034
        builder.start_series()
1009
1035
        # mainline
1010
1036
        builder.build_snapshot(