/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

Use support opening index of first revision.

Show diffs side-by-side

added added

removed removed

Lines of Context:
268
268
        return "<%s for %r>" % (self.__class__.__name__, self.index)
269
269
 
270
270
    def __init__(self, basis_inventory, fileid_map, index, store):
271
 
        super(GitIndexInventory, self).__init__(revision_id=None, root_id=basis_inventory.root.file_id)
 
271
        if basis_inventory is None:
 
272
            root_id = None
 
273
        else:
 
274
            root_id = basis_inventory.root.file_id
 
275
        super(GitIndexInventory, self).__init__(revision_id=None, root_id=root_id)
272
276
        self.basis_inv = basis_inventory
273
277
        self.fileid_map = fileid_map
274
278
        self.index = index
334
338
                assert isinstance(path, str)
335
339
                assert isinstance(value, tuple) and len(value) == 10
336
340
                (ctime, mtime, dev, ino, mode, uid, gid, size, sha, flags) = value
337
 
                try:
338
 
                    old_ie = self.basis_inv._get_ie(path)
339
 
                except KeyError:
 
341
                if self.basis_inv is not None:
 
342
                    try:
 
343
                        old_ie = self.basis_inv._get_ie(path)
 
344
                    except KeyError:
 
345
                        old_ie = None
 
346
                else:
340
347
                    old_ie = None
341
348
                if old_ie is None:
342
349
                    file_id = self.fileid_map.lookup_file_id(path)
372
379
                parent_fid = self.add_parents(dirname)
373
380
            ie = self.add_path(dirname, 'directory',
374
381
                    self.fileid_map.lookup_file_id(dirname), parent_fid)
375
 
            if ie.file_id in self.basis_inv:
 
382
            if self.basis_inv is not None and ie.file_id in self.basis_inv:
376
383
                ie.revision = self.basis_inv[ie.file_id].revision
377
384
            file_id = ie.file_id
378
385
        if type(file_id) != str: