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

  • Committer: Jelmer Vernooij
  • Date: 2010-05-02 19:26:28 UTC
  • mto: (0.200.912 trunk)
  • mto: This revision was merged to the branch mainline in revision 6960.
  • Revision ID: jelmer@samba.org-20100502192628-dy0lavjbjexavvmb
More work on roundtripping support.

Show diffs side-by-side

added added

removed removed

Lines of Context:
234
234
            type_data = (self.revid, self._commit.tree)
235
235
            self.cache.idmap._by_revid[self.revid] = obj.id
236
236
        elif obj.type_name in ("blob", "tree"):
237
 
            if obj.type_name == "blob":
238
 
                revision = ie.revision
239
 
            else:
240
 
                revision = self.revid
241
 
            type_data = (ie.file_id, revision)
242
 
            self.cache.idmap._by_fileid.setdefault(type_data[1], {})[type_data[0]] = obj.id
 
237
            if ie is not None:
 
238
                if obj.type_name == "blob":
 
239
                    revision = ie.revision
 
240
                else:
 
241
                    revision = self.revid
 
242
                type_data = (ie.file_id, revision)
 
243
                self.cache.idmap._by_fileid.setdefault(type_data[1], {})[type_data[0]] =\
 
244
                    obj.id
243
245
        else:
244
246
            raise AssertionError
245
247
        self.cache.idmap._by_sha[obj.id] = (obj.type_name, type_data)
293
295
            self._commit = obj
294
296
            assert ie is None
295
297
        elif obj.type_name == "tree":
296
 
            self._trees.append((obj.id, ie.file_id, self.revid))
 
298
            if ie is not None:
 
299
                self._trees.append((obj.id, ie.file_id, self.revid))
297
300
        elif obj.type_name == "blob":
298
 
            self._blobs.append((obj.id, ie.file_id, ie.revision))
 
301
            if ie is not None:
 
302
                self._blobs.append((obj.id, ie.file_id, ie.revision))
299
303
        else:
300
304
            raise AssertionError
301
305
 
436
440
            self._commit = obj
437
441
            assert ie is None
438
442
        elif obj.type_name == "blob":
 
443
            if ie is None:
 
444
                return
439
445
            self.db["\0".join(("blob", ie.file_id, ie.revision))] = sha
440
446
            type_data = (ie.file_id, ie.revision)
441
447
        elif obj.type_name == "tree":
 
448
            if ie is None:
 
449
                return
442
450
            type_data = (ie.file_id, self.revid)
443
451
        else:
444
452
            raise AssertionError