/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

Refactor repository initialization.

Show diffs side-by-side

added added

removed removed

Lines of Context:
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
245
244
        except KeyError:
246
245
            raise errors.NoSuchId(None, file_id)
247
246
 
313
312
    def path2id(self, path):
314
313
        if type(path) in (list, tuple):
315
314
            path = "/".join(path)
316
 
        if path in self.index:
317
 
            file_id = self.fileid_map.lookup_file_id(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)
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, kind, file_id,
 
360
                    ie = self.add_path(path.decode("utf-8"), 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)
373
374
        dirname, _ = osutils.split(path)
374
375
        file_id = super(GitIndexInventory, self).path2id(dirname)
375
376
        if file_id is None:
377
378
                parent_fid = None
378
379
            else:
379
380
                parent_fid = self.add_parents(dirname)
380
 
            ie = self.add_path(dirname, 'directory',
 
381
            ie = self.add_path(dirname.decode("utf-8"), 'directory',
381
382
                    self.fileid_map.lookup_file_id(dirname), parent_fid)
382
383
            if self.basis_inv is not None and ie.file_id in self.basis_inv:
383
384
                ie.revision = self.basis_inv[ie.file_id].revision