~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tree.py

  • Committer: Alexander Belchenko
  • Date: 2006-07-31 16:12:57 UTC
  • mto: (1711.2.111 jam-integration)
  • mto: This revision was merged to the branch mainline in revision 1906.
  • Revision ID: bialix@ukr.net-20060731161257-91a231523255332c
new official bzr.ico

Show diffs side-by-side

added added

removed removed

Lines of Context:
54
54
    """
55
55
    
56
56
    def changes_from(self, other, want_unchanged=False, specific_files=None,
57
 
        extra_trees=None, require_versioned=False, include_root=False):
 
57
        extra_trees=None, require_versioned=False):
58
58
        """Return a TreeDelta of the changes from other to this tree.
59
59
 
60
60
        :param other: A tree to compare with.
81
81
            specific_files=specific_files,
82
82
            extra_trees=extra_trees,
83
83
            require_versioned=require_versioned,
84
 
            include_root=include_root
85
84
            )
86
85
    
87
86
    def conflicts(self):
120
119
    def id2path(self, file_id):
121
120
        return self.inventory.id2path(file_id)
122
121
 
123
 
    def is_control_filename(self, filename):
124
 
        """True if filename is the name of a control file in this tree.
125
 
        
126
 
        :param filename: A filename within the tree. This is a relative path
127
 
        from the root of this tree.
128
 
 
129
 
        This is true IF and ONLY IF the filename is part of the meta data
130
 
        that bzr controls in this tree. I.E. a random .bzr directory placed
131
 
        on disk will not be a control file for this tree.
132
 
        """
133
 
        return self.bzrdir.is_control_filename(filename)
134
 
 
135
122
    def iter_entries_by_dir(self):
136
123
        """Walk the tree in 'by_dir' order.
137
124
 
148
135
    def _get_inventory(self):
149
136
        return self._inventory
150
137
    
151
 
    def get_file(self, file_id):
152
 
        """Return a file object for the file file_id in the tree."""
153
 
        raise NotImplementedError(self.get_file)
154
 
    
155
138
    def get_file_by_path(self, path):
156
139
        return self.get_file(self._inventory.path2id(path))
157
140
 
164
147
        fp = fingerprint_file(f)
165
148
        f.seek(0)
166
149
        
167
 
        if ie.text_size is not None:
 
150
        if ie.text_size != None:
168
151
            if ie.text_size != fp['size']:
169
152
                raise BzrError("mismatched size for file %r in %r" % (ie.file_id, self._store),
170
153
                        ["inventory expects %d bytes" % ie.text_size,
177
160
                     "file is actually %s" % fp['sha1'],
178
161
                     "store is probably damaged/corrupt"])
179
162
 
180
 
    def path2id(self, path):
181
 
        """Return the id for path in this tree."""
182
 
        return self._inventory.path2id(path)
183
163
 
184
164
    def print_file(self, file_id):
185
165
        """Print file with id `file_id` to stdout."""
233
213
        return False
234
214
 
235
215
    def kind(self, file_id):
236
 
        assert self._inventory[file_id].kind == "directory"
237
 
        return "directory"
 
216
        assert self._inventory[file_id].kind == "root_directory"
 
217
        return "root_directory"
238
218
 
239
219
    def list_files(self):
240
220
        return iter([])
241
221
    
242
222
    def __contains__(self, file_id):
243
 
        return (file_id in self._inventory)
 
223
        return file_id in self._inventory
244
224
 
245
225
    def get_file_sha1(self, file_id, path=None):
 
226
        assert self._inventory[file_id].kind == "root_directory"
246
227
        return None
247
228
 
248
229
 
395
376
    will pass through to InterTree as appropriate.
396
377
    """
397
378
 
398
 
    _optimisers = []
 
379
    _optimisers = set()
399
380
 
400
381
    @needs_read_lock
401
382
    def compare(self, want_unchanged=False, specific_files=None,
402
 
        extra_trees=None, require_versioned=False, include_root=False):
 
383
        extra_trees=None, require_versioned=False):
403
384
        """Return the changes from source to target.
404
385
 
405
386
        :return: A TreeDelta.
427
408
            # _compare_trees would think we want a complete delta
428
409
            return delta.TreeDelta()
429
410
        return delta._compare_trees(self.source, self.target, want_unchanged,
430
 
            specific_file_ids, include_root)
 
411
            specific_file_ids)