/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

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

merge bzr.dev.

Show diffs side-by-side

added added

removed removed

Lines of Context:
12
12
#
13
13
# You should have received a copy of the GNU General Public License
14
14
# along with this program; if not, write to the Free Software
15
 
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
15
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
16
 
17
17
"""Test the executable bit under various working tree formats."""
18
18
 
19
19
import os
20
20
 
 
21
from bzrlib import (
 
22
    osutils,
 
23
    )
21
24
from bzrlib.inventory import InventoryFile
22
25
from bzrlib.transform import TreeTransform
23
26
from bzrlib.tests.workingtree_implementations import TestCaseWithWorkingTree
124
127
 
125
128
        rev_tree = self.wt.branch.repository.revision_tree('r1')
126
129
        # Now revert back to the previous commit
127
 
        self.wt.revert([], rev_tree, backups=False)
 
130
        self.wt.revert(old_tree=rev_tree, backups=False)
128
131
 
129
132
        self.check_exist(self.wt)
130
133
 
155
158
        # so that the second branch can pull the changes
156
159
        # and make sure that the executable bit has been copied
157
160
        rev_tree = self.wt.branch.repository.revision_tree('r1')
158
 
        self.wt.revert([], rev_tree, backups=False)
 
161
        self.wt.revert(old_tree=rev_tree, backups=False)
159
162
        self.wt.commit('resurrected', rev_id='r3')
160
163
 
161
164
        self.check_exist(self.wt)
167
170
 
168
171
    def test_08_no_op_revert(self):
169
172
        """Just do a simple revert without anything changed
170
 
        
 
173
 
171
174
        The bits shouldn't swap.
172
175
        """
173
176
        self.wt.commit('adding a,b', rev_id='r1')
174
177
        rev_tree = self.wt.branch.repository.revision_tree('r1')
175
 
        self.wt.revert([], rev_tree, backups=False)
 
178
        self.wt.revert(old_tree=rev_tree, backups=False)
176
179
        self.check_exist(self.wt)
177
180
 
 
181
    def test_commit_with_exec_from_basis(self):
 
182
        self.wt._is_executable_from_path_and_stat = \
 
183
            self.wt._is_executable_from_path_and_stat_from_basis
 
184
        rev_id1 = self.wt.commit('one')
 
185
        rev_tree1 = self.wt.branch.repository.revision_tree(rev_id1)
 
186
        a_executable = rev_tree1.inventory[self.a_id].executable
 
187
        b_executable = rev_tree1.inventory[self.b_id].executable
 
188
        self.assertIsNot(None, a_executable)
 
189
        self.assertTrue(a_executable)
 
190
        self.assertIsNot(None, b_executable)
 
191
        self.assertFalse(b_executable)
 
192
 
 
193
    def test_use_exec_from_basis(self):
 
194
        if osutils.supports_executable():
 
195
            self.assertEqual(self.wt._is_executable_from_path_and_stat_from_stat,
 
196
                             self.wt._is_executable_from_path_and_stat)
 
197
        else:
 
198
            self.assertEqual(self.wt._is_executable_from_path_and_stat_from_basis,
 
199
                             self.wt._is_executable_from_path_and_stat)