/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/workingtree.py

  • Committer: Jelmer Vernooij
  • Date: 2011-12-21 14:50:43 UTC
  • mfrom: (6394 +trunk)
  • mto: This revision was merged to the branch mainline in revision 6407.
  • Revision ID: jelmer@samba.org-20111221145043-pp63ot6xefuc7bjl
Merge bzr.dev.

Show diffs side-by-side

added added

removed removed

Lines of Context:
29
29
WorkingTree.open(dir).
30
30
"""
31
31
 
 
32
from __future__ import absolute_import
32
33
 
33
34
from cStringIO import StringIO
34
35
import os
69
70
    )
70
71
""")
71
72
 
 
73
# Explicitly import bzrlib.bzrdir so that the BzrProber
 
74
# is guaranteed to be registered.
 
75
import bzrlib.bzrdir
 
76
 
72
77
from bzrlib import symbol_versioning
73
78
from bzrlib.decorators import needs_read_lock, needs_write_lock
74
79
from bzrlib.i18n import gettext
84
89
    realpath,
85
90
    safe_unicode,
86
91
    splitpath,
87
 
    supports_executable,
88
92
    )
89
93
from bzrlib.trace import mutter, note
90
94
from bzrlib.revision import CURRENT_REVISION
228
232
        """See `Tree.has_versioned_directories`."""
229
233
        return self._format.supports_versioned_directories
230
234
 
 
235
    def _supports_executable(self):
 
236
        if sys.platform == 'win32':
 
237
            return False
 
238
        # FIXME: Ideally this should check the file system
 
239
        return True
 
240
 
231
241
    def break_lock(self):
232
242
        """Break a lock if one is present from another instance.
233
243
 
1112
1122
        else:
1113
1123
            mode = stat_value.st_mode
1114
1124
            kind = osutils.file_kind_from_stat_mode(mode)
1115
 
            if not supports_executable():
 
1125
            if not self._supports_executable():
1116
1126
                executable = entry is not None and entry.executable
1117
1127
            else:
1118
1128
                executable = bool(stat.S_ISREG(mode) and stat.S_IEXEC & mode)
2187
2197
        mode = stat_result.st_mode
2188
2198
        return bool(stat.S_ISREG(mode) and stat.S_IEXEC & mode)
2189
2199
 
2190
 
    if not supports_executable():
2191
 
        def is_executable(self, file_id, path=None):
 
2200
    def is_executable(self, file_id, path=None):
 
2201
        if not self._supports_executable():
2192
2202
            return self._inventory[file_id].executable
2193
 
 
2194
 
        _is_executable_from_path_and_stat = \
2195
 
            _is_executable_from_path_and_stat_from_basis
2196
 
    else:
2197
 
        def is_executable(self, file_id, path=None):
 
2203
        else:
2198
2204
            if not path:
2199
2205
                path = self.id2path(file_id)
2200
2206
            mode = os.lstat(self.abspath(path)).st_mode
2201
2207
            return bool(stat.S_ISREG(mode) and stat.S_IEXEC & mode)
2202
2208
 
2203
 
        _is_executable_from_path_and_stat = \
2204
 
            _is_executable_from_path_and_stat_from_stat
 
2209
    def _is_executable_from_path_and_stat(self, path, stat_result):
 
2210
        if not self._supports_executable():
 
2211
            return self._is_executable_from_path_and_stat_from_basis(path, stat_result)
 
2212
        else:
 
2213
            return self._is_executable_from_path_and_stat_from_stat(path, stat_result)
2205
2214
 
2206
2215
    @needs_tree_write_lock
2207
2216
    def _add(self, files, ids, kinds):