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

mark remote git directories as not supporting working trees.

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
 
19
19
from dulwich.objects import (
20
20
    Blob,
21
 
    Commit,
22
21
    Tree,
23
22
    sha_to_hex,
24
23
    )
342
341
        self._update_sha_map()
343
342
        return iter(self._cache.idmap.sha1s())
344
343
 
345
 
    def _reconstruct_commit(self, rev, tree_sha, roundtrip, verifiers):
346
 
        """Reconstruct a Commit object.
347
 
 
348
 
        :param rev: Revision object
349
 
        :param tree_sha: SHA1 of the root tree object
350
 
        :param roundtrip: Whether or not to roundtrip bzr metadata
351
 
        :param verifiers: Verifiers for the commits
352
 
        :return: Commit object
353
 
        """
 
344
    def _reconstruct_commit(self, rev, tree_sha, roundtrip, testament3_sha1):
354
345
        def parent_lookup(revid):
355
346
            try:
356
347
                return self._lookup_revision_sha1(revid)
357
348
            except errors.NoSuchRevision:
358
349
                return None
359
350
        return self.mapping.export_commit(rev, tree_sha, parent_lookup,
360
 
            roundtrip, verifiers)
 
351
            roundtrip, testament3_sha1)
361
352
 
362
353
    def _create_fileid_map_blob(self, inv):
363
354
        # FIXME: This can probably be a lot more efficient, 
404
395
        yield "", root_tree, root_ie
405
396
        if roundtrip:
406
397
            testament3 = StrictTestament3(rev, tree.inventory)
407
 
            verifiers = { "testament3-sha1": testament3.as_sha1() }
 
398
            testament3_sha1 = testament3.as_sha1()
408
399
        else:
409
 
            verifiers = {}
 
400
            testament3_sha1 = None
410
401
        commit_obj = self._reconstruct_commit(rev, root_tree.id,
411
 
            roundtrip=roundtrip, verifiers=verifiers)
 
402
            roundtrip=roundtrip, testament3_sha1=testament3_sha1)
412
403
        try:
413
404
            foreign_revid, mapping = mapping_registry.parse_revision_id(
414
405
                rev.revision_id)
427
418
        updater = self._get_updater(rev)
428
419
        for path, obj, ie in self._revision_to_objects(rev, tree,
429
420
            roundtrip=True):
430
 
            if isinstance(obj, Commit):
431
 
                testament3 = StrictTestament3(rev, tree.inventory)
432
 
                ie = { "testament3-sha1": testament3.as_sha1() }
433
421
            updater.add_object(obj, ie, path)
434
422
        commit_obj = updater.finish()
435
423
        return commit_obj.id
547
535
        ret = {}
548
536
        for sha in shas:
549
537
            if sha == ZERO_SHA:
550
 
                ret[sha] = ("commit", (NULL_REVISION, None, {}))
 
538
                ret[sha] = ("commit", (NULL_REVISION, None))
551
539
                continue
552
540
            try:
553
541
                ret[sha] = self._cache.idmap.lookup_git_sha(sha)
575
563
        (type, type_data) = self.lookup_git_sha(sha)
576
564
        # convert object to git object
577
565
        if type == "commit":
578
 
            (revid, tree_sha, verifiers) = type_data
 
566
            (revid, tree_sha) = type_data
579
567
            try:
580
568
                rev = self.repository.get_revision(revid)
581
569
            except errors.NoSuchRevision:
582
570
                trace.mutter('entry for %s %s in shamap: %r, but not found in '
583
571
                             'repository', type, sha, type_data)
584
572
                raise KeyError(sha)
585
 
            commit = self._reconstruct_commit(rev, tree_sha, roundtrip=True,
586
 
                verifiers=verifiers)
 
573
            commit = self._reconstruct_commit(rev, tree_sha, roundtrip=True)
587
574
            _check_expected_sha(sha, commit)
588
575
            return commit
589
576
        elif type == "blob":