/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 inventory.py

More work on roundtrip push support.

Show diffs side-by-side

added added

removed removed

Lines of Context:
176
176
 
177
177
    def _retrieve_children(self):
178
178
        self._children = {}
179
 
        for name, mode, hexsha in self.object.iteritems():
 
179
        for mode, name, hexsha in self.object.entries():
180
180
            basename = name.decode("utf-8")
181
181
            child_path = osutils.pathjoin(self.path, basename)
182
182
            if self._inventory.mapping.is_control_file(child_path):
241
241
        path = self.fileid_map.lookup_path(file_id)
242
242
        try:
243
243
            ie = self._get_ie(path)
 
244
            assert ie.path == path
244
245
        except KeyError:
245
246
            raise errors.NoSuchId(None, file_id)
246
247
 
312
313
    def path2id(self, path):
313
314
        if type(path) in (list, tuple):
314
315
            path = "/".join(path)
315
 
        encoded_path = path.encode("utf-8")
316
 
        if encoded_path in self.index:
317
 
            file_id = self.fileid_map.lookup_file_id(encoded_path)
 
316
        if path in self.index:
 
317
            file_id = self.fileid_map.lookup_file_id(path)
318
318
        else:
319
319
            self._read_contents()
320
320
            file_id = super(GitIndexInventory, self).path2id(path)
357
357
                    self.add_parents(path)
358
358
                    self.add(old_ie)
359
359
                else:
360
 
                    ie = self.add_path(path.decode("utf-8"), kind, file_id,
 
360
                    ie = self.add_path(path, kind, file_id,
361
361
                        self.add_parents(path))
362
362
                    data = self.store[sha].data
363
363
                    if kind == "symlink":
370
370
            pb.finished()
371
371
 
372
372
    def add_parents(self, path):
373
 
        assert isinstance(path, str)
374
373
        dirname, _ = osutils.split(path)
375
374
        file_id = super(GitIndexInventory, self).path2id(dirname)
376
375
        if file_id is None:
378
377
                parent_fid = None
379
378
            else:
380
379
                parent_fid = self.add_parents(dirname)
381
 
            ie = self.add_path(dirname.decode("utf-8"), 'directory',
 
380
            ie = self.add_path(dirname, 'directory',
382
381
                    self.fileid_map.lookup_file_id(dirname), parent_fid)
383
382
            if self.basis_inv is not None and ie.file_id in self.basis_inv:
384
383
                ie.revision = self.basis_inv[ie.file_id].revision