~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/workingtree.py

  • Committer: Robert Collins
  • Date: 2007-10-22 01:23:51 UTC
  • mfrom: (2921.3.1 graph)
  • mto: This revision was merged to the branch mainline in revision 2933.
  • Revision ID: robertc@robertcollins.net-20071022012351-16lm27an2lbzk038
Merge graph history-access bugfix.

Show diffs side-by-side

added added

removed removed

Lines of Context:
599
599
            path = self.inventory.id2path(file_id)
600
600
        return os.lstat(self.abspath(path)).st_mtime
601
601
 
 
602
    def _is_executable_from_path_and_stat_from_basis(self, path, stat_result):
 
603
        file_id = self.path2id(path)
 
604
        return self._inventory[file_id].executable
 
605
 
 
606
    def _is_executable_from_path_and_stat_from_stat(self, path, stat_result):
 
607
        mode = stat_result.st_mode
 
608
        return bool(stat.S_ISREG(mode) and stat.S_IEXEC & mode)
 
609
 
602
610
    if not supports_executable():
603
611
        def is_executable(self, file_id, path=None):
604
612
            return self._inventory[file_id].executable
 
613
 
 
614
        _is_executable_from_path_and_stat = \
 
615
            _is_executable_from_path_and_stat_from_basis
605
616
    else:
606
617
        def is_executable(self, file_id, path=None):
607
618
            if not path:
609
620
            mode = os.lstat(self.abspath(path)).st_mode
610
621
            return bool(stat.S_ISREG(mode) and stat.S_IEXEC & mode)
611
622
 
 
623
        _is_executable_from_path_and_stat = \
 
624
            _is_executable_from_path_and_stat_from_stat
 
625
 
612
626
    @needs_tree_write_lock
613
627
    def _add(self, files, ids, kinds):
614
628
        """See MutableTree._add."""
705
719
        if kind == 'file':
706
720
            size = stat_result.st_size
707
721
            # try for a stat cache lookup
708
 
            if not supports_executable():
709
 
                executable = None # caller can decide policy.
710
 
            else:
711
 
                mode = stat_result.st_mode
712
 
                executable = bool(stat.S_ISREG(mode) and stat.S_IEXEC & mode)
 
722
            executable = self._is_executable_from_path_and_stat(path, stat_result)
713
723
            return (kind, size, executable, self._sha_from_stat(
714
724
                path, stat_result))
715
725
        elif kind == 'directory':