~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/workingtree.py

  • Committer: Patch Queue Manager
  • Date: 2011-12-19 17:39:35 UTC
  • mfrom: (6379.7.4 per-wt-executable)
  • Revision ID: pqm@pqm.ubuntu.com-20111219173935-49wnc1pb71e653iz
(jelmer) Make the check to see whether executable bits are supported
 per-workingtree, rather than global. (Jelmer Vernooij)

Show diffs side-by-side

added added

removed removed

Lines of Context:
89
89
    realpath,
90
90
    safe_unicode,
91
91
    splitpath,
92
 
    supports_executable,
93
92
    )
94
93
from bzrlib.trace import mutter, note
95
94
from bzrlib.revision import CURRENT_REVISION
233
232
        """See `Tree.has_versioned_directories`."""
234
233
        return self._format.supports_versioned_directories
235
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
 
236
241
    def break_lock(self):
237
242
        """Break a lock if one is present from another instance.
238
243
 
1117
1122
        else:
1118
1123
            mode = stat_value.st_mode
1119
1124
            kind = osutils.file_kind_from_stat_mode(mode)
1120
 
            if not supports_executable():
 
1125
            if not self._supports_executable():
1121
1126
                executable = entry is not None and entry.executable
1122
1127
            else:
1123
1128
                executable = bool(stat.S_ISREG(mode) and stat.S_IEXEC & mode)
2192
2197
        mode = stat_result.st_mode
2193
2198
        return bool(stat.S_ISREG(mode) and stat.S_IEXEC & mode)
2194
2199
 
2195
 
    if not supports_executable():
2196
 
        def is_executable(self, file_id, path=None):
 
2200
    def is_executable(self, file_id, path=None):
 
2201
        if not self._supports_executable():
2197
2202
            return self._inventory[file_id].executable
2198
 
 
2199
 
        _is_executable_from_path_and_stat = \
2200
 
            _is_executable_from_path_and_stat_from_basis
2201
 
    else:
2202
 
        def is_executable(self, file_id, path=None):
 
2203
        else:
2203
2204
            if not path:
2204
2205
                path = self.id2path(file_id)
2205
2206
            mode = os.lstat(self.abspath(path)).st_mode
2206
2207
            return bool(stat.S_ISREG(mode) and stat.S_IEXEC & mode)
2207
2208
 
2208
 
        _is_executable_from_path_and_stat = \
2209
 
            _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)
2210
2214
 
2211
2215
    @needs_tree_write_lock
2212
2216
    def _add(self, files, ids, kinds):