~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/workingtree.py

  • Committer: Martin Pool
  • Date: 2005-10-04 02:27:27 UTC
  • mfrom: (1399)
  • mto: (1185.13.3)
  • mto: This revision was merged to the branch mainline in revision 1400.
  • Revision ID: mbp@sourcefrog.net-20051004022727-aee7064c62e039a7
[merge] merge robertc's format5 integration

 - test status on specific files
 - track x bit
 - baz2bzr fixes
 - remotebranch fixes

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
# it's not predictable when it will be written out.
22
22
 
23
23
import os
 
24
import stat
24
25
import fnmatch
25
26
        
26
27
import bzrlib.tree
69
70
        """
70
71
        inv = self._inventory
71
72
        for path, ie in inv.iter_entries():
72
 
            if os.path.exists(self.abspath(path)):
 
73
            if bzrlib.osutils.lexists(self.abspath(path)):
73
74
                yield ie.file_id
74
75
 
75
76
 
83
84
        return os.path.join(self.basedir, filename)
84
85
 
85
86
    def has_filename(self, filename):
86
 
        return os.path.exists(self.abspath(filename))
 
87
        return bzrlib.osutils.lexists(self.abspath(filename))
87
88
 
88
89
    def get_file(self, file_id):
89
90
        return self.get_file_byname(self.id2path(file_id))
106
107
        if not inv.has_id(file_id):
107
108
            return False
108
109
        path = inv.id2path(file_id)
109
 
        return os.path.exists(self.abspath(path))
 
110
        return bzrlib.osutils.lexists(self.abspath(path))
110
111
 
111
112
 
112
113
    __contains__ = has_id
115
116
    def get_file_size(self, file_id):
116
117
        return os.path.getsize(self.id2abspath(file_id))
117
118
 
118
 
 
119
119
    def get_file_sha1(self, file_id):
120
120
        path = self._inventory.id2path(file_id)
121
121
        return self._hashcache.get_sha1(path)
122
122
 
123
123
 
 
124
    def is_executable(self, file_id):
 
125
        if os.name == "nt":
 
126
            return self._inventory[file_id].executable
 
127
        else:
 
128
            path = self._inventory.id2path(file_id)
 
129
            mode = os.lstat(self.abspath(path)).st_mode
 
130
            return bool(stat.S_ISREG(mode) and stat.S_IEXEC&mode)
 
131
 
 
132
    def get_symlink_target(self, file_id):
 
133
        return os.readlink(self.id2path(file_id))
 
134
 
124
135
    def file_class(self, filename):
125
136
        if self.path2id(filename):
126
137
            return 'V'