/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: Robert Collins
  • Date: 2005-09-30 02:54:51 UTC
  • mfrom: (1395)
  • mto: This revision was merged to the branch mainline in revision 1397.
  • Revision ID: robertc@robertcollins.net-20050930025451-47b9e412202be44b
symlink and weaves, whaddya know

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
 
    
 
24
import fnmatch
 
25
        
25
26
import bzrlib.tree
26
 
from errors import BzrCheckError
27
 
from trace import mutter
 
27
from bzrlib.osutils import appendpath, file_kind, isdir, splitpath
 
28
from bzrlib.errors import BzrCheckError
 
29
from bzrlib.trace import mutter
28
30
 
29
31
class WorkingTree(bzrlib.tree.Tree):
30
32
    """Working copy tree.
67
69
        """
68
70
        inv = self._inventory
69
71
        for path, ie in inv.iter_entries():
70
 
            if os.path.exists(self.abspath(path)):
 
72
            if bzrlib.osutils.lexists(self.abspath(path)):
71
73
                yield ie.file_id
72
74
 
73
75
 
81
83
        return os.path.join(self.basedir, filename)
82
84
 
83
85
    def has_filename(self, filename):
84
 
        return os.path.exists(self.abspath(filename))
 
86
        return bzrlib.osutils.lexists(self.abspath(filename))
85
87
 
86
88
    def get_file(self, file_id):
87
89
        return self.get_file_byname(self.id2path(file_id))
93
95
        ## XXX: badly named; this isn't in the store at all
94
96
        return self.abspath(self.id2path(file_id))
95
97
 
 
98
 
 
99
    def id2abspath(self, file_id):
 
100
        return self.abspath(self.id2path(file_id))
 
101
 
96
102
                
97
103
    def has_id(self, file_id):
98
104
        # files that have been deleted are excluded
100
106
        if not inv.has_id(file_id):
101
107
            return False
102
108
        path = inv.id2path(file_id)
103
 
        return os.path.exists(self.abspath(path))
 
109
        return bzrlib.osutils.lexists(self.abspath(path))
104
110
 
105
111
 
106
112
    __contains__ = has_id
107
113
    
108
114
 
109
115
    def get_file_size(self, file_id):
110
 
        # is this still called?
111
 
        raise NotImplementedError()
112
 
 
 
116
        return os.path.getsize(self.id2abspath(file_id))
113
117
 
114
118
    def get_file_sha1(self, file_id):
115
119
        path = self._inventory.id2path(file_id)
116
120
        return self._hashcache.get_sha1(path)
117
121
 
 
122
    def get_symlink_target(self, file_id):
 
123
        return os.readlink(self.id2path(file_id))
118
124
 
119
125
    def file_class(self, filename):
120
126
        if self.path2id(filename):
135
141
 
136
142
        Skips the control directory.
137
143
        """
138
 
        from osutils import appendpath, file_kind
139
 
        import os
140
 
 
141
144
        inv = self._inventory
142
145
 
143
146
        def descend(from_dir_relpath, from_dir_id, dp):
205
208
        Currently returned depth-first, sorted by name within directories.
206
209
        """
207
210
        ## TODO: Work from given directory downwards
208
 
        from osutils import isdir, appendpath
209
 
        
210
211
        for path, dir_entry in self.inventory.directories():
211
212
            mutter("search for unknowns in %r" % path)
212
213
            dirabs = self.abspath(path)
269
270
        # Eventually it should be replaced with something more
270
271
        # accurate.
271
272
        
272
 
        import fnmatch
273
 
        from osutils import splitpath
274
 
        
275
273
        for pat in self.get_ignore_list():
276
274
            if '/' in pat or '\\' in pat:
277
275
                
290
288
                    return pat
291
289
        else:
292
290
            return None
293
 
        
 
 
b'\\ No newline at end of file'
 
291