~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/workingtree_4.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2007-03-13 13:38:34 UTC
  • mfrom: (2325.3.5 win32)
  • Revision ID: pqm@pqm.ubuntu.com-20070313133834-ff8514538f6b02f7
(John Arbash Meinel) Some small fixes for win32 and dirstate.

Show diffs side-by-side

added added

removed removed

Lines of Context:
353
353
                inv_entry = factory[kind](file_id, name_unicode,
354
354
                                          parent_ie.file_id)
355
355
                if kind == 'file':
 
356
                    # This is only needed on win32, where this is the only way
 
357
                    # we know the executable bit.
 
358
                    inv_entry.executable = executable
356
359
                    # not strictly needed: working tree
357
 
                    #entry.executable = executable
358
 
                    #entry.text_size = size
359
 
                    #entry.text_sha1 = sha1
360
 
                    pass
 
360
                    #inv_entry.text_size = size
 
361
                    #inv_entry.text_sha1 = sha1
361
362
                elif kind == 'directory':
362
363
                    # add this entry to the parent map.
363
364
                    parent_ies[(dirname + '/' + name).strip('/')] = inv_entry
464
465
        path_utf8 = osutils.pathjoin(entry[0][0], entry[0][1])
465
466
        return path_utf8.decode('utf8')
466
467
 
 
468
    if not osutils.supports_executable():
 
469
        @needs_read_lock
 
470
        def is_executable(self, file_id, path=None):
 
471
            file_id = osutils.safe_file_id(file_id)
 
472
            entry = self._get_entry(file_id=file_id, path=path)
 
473
            if entry == (None, None):
 
474
                return False
 
475
            return entry[1][0][3]
 
476
    else:
 
477
        @needs_read_lock
 
478
        def is_executable(self, file_id, path=None):
 
479
            if not path:
 
480
                file_id = osutils.safe_file_id(file_id)
 
481
                path = self.id2path(file_id)
 
482
            mode = os.lstat(self.abspath(path)).st_mode
 
483
            return bool(stat.S_ISREG(mode) and stat.S_IEXEC & mode)
 
484
 
467
485
    @needs_read_lock
468
486
    def __iter__(self):
469
487
        """Iterate through file_ids for this tree.