~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Tarmac
  • Author(s): Vincent Ladeuil
  • Date: 2017-01-30 14:42:05 UTC
  • mfrom: (6620.1.1 trunk)
  • Revision ID: tarmac-20170130144205-r8fh2xpmiuxyozpv
Merge  2.7 into trunk including fix for bug #1657238 [r=vila]

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2006 Canonical Ltd
 
1
# Copyright (C) 2006, 2007, 2009, 2011, 2012, 2016 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
58
58
        tree.lock_read()
59
59
        if not ignore_inv:
60
60
            self.assertEqual(
61
 
                [('', tree.inventory.root)],
62
 
                list(tree.inventory.iter_entries()))
 
61
                [('', tree.root_inventory.root)],
 
62
                list(tree.root_inventory.iter_entries()))
63
63
        self.assertFalse(tree.has_id(self.a_id))
64
64
        self.assertFalse(tree.has_filename('a'))
65
65
        self.assertFalse(tree.has_id(self.b_id))
71
71
        self.wt.commit('adding a,b', rev_id='r1')
72
72
        # Now make sure that 'bzr branch' also preserves the
73
73
        # executable bit
74
 
        # TODO: Maybe this should be a blackbox test
75
 
        dir2 = self.wt.branch.bzrdir.clone('b2', revision_id='r1')
 
74
        dir2 = self.wt.branch.bzrdir.sprout('b2', revision_id='r1')
76
75
        wt2 = dir2.open_workingtree()
77
76
        self.assertEqual(['r1'], wt2.get_parent_ids())
78
77
        self.assertEqual('r1', wt2.branch.last_revision())
148
147
 
149
148
        # Make sure pull will delete the files
150
149
        wt2.pull(self.wt.branch)
151
 
        self.assertEquals(['r2'], wt2.get_parent_ids())
152
 
        self.assertEquals('r2', wt2.branch.last_revision())
 
150
        self.assertEqual(['r2'], wt2.get_parent_ids())
 
151
        self.assertEqual('r2', wt2.branch.last_revision())
153
152
        self.check_empty(wt2)
154
153
 
155
154
        # Now restore the files on the first branch and commit
162
161
        self.check_exist(self.wt)
163
162
 
164
163
        wt2.pull(self.wt.branch)
165
 
        self.assertEquals(['r3'], wt2.get_parent_ids())
166
 
        self.assertEquals('r3', wt2.branch.last_revision())
 
164
        self.assertEqual(['r3'], wt2.get_parent_ids())
 
165
        self.assertEqual('r3', wt2.branch.last_revision())
167
166
        self.check_exist(wt2)
168
167
 
169
168
    def test_08_no_op_revert(self):
181
180
            self.wt._is_executable_from_path_and_stat_from_basis
182
181
        rev_id1 = self.wt.commit('one')
183
182
        rev_tree1 = self.wt.branch.repository.revision_tree(rev_id1)
184
 
        a_executable = rev_tree1.inventory[self.a_id].executable
185
 
        b_executable = rev_tree1.inventory[self.b_id].executable
 
183
        a_executable = rev_tree1.root_inventory[self.a_id].executable
 
184
        b_executable = rev_tree1.root_inventory[self.b_id].executable
186
185
        self.assertIsNot(None, a_executable)
187
186
        self.assertTrue(a_executable)
188
187
        self.assertIsNot(None, b_executable)
189
188
        self.assertFalse(b_executable)
190
189
 
191
190
    def test_use_exec_from_basis(self):
192
 
        if osutils.supports_executable():
193
 
            self.assertEqual(self.wt._is_executable_from_path_and_stat_from_stat,
194
 
                             self.wt._is_executable_from_path_and_stat)
195
 
        else:
196
 
            self.assertEqual(self.wt._is_executable_from_path_and_stat_from_basis,
197
 
                             self.wt._is_executable_from_path_and_stat)
 
191
        self.wt._supports_executable = lambda: False
 
192
        self.addCleanup(self.wt.lock_read().unlock)
 
193
        self.assertTrue(self.wt.is_executable(self.a_id))
 
194
        self.assertFalse(self.wt.is_executable(self.b_id))