/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 breezy/git/repository.py

  • Committer: Jelmer Vernooij
  • Date: 2019-03-04 05:10:44 UTC
  • mfrom: (7293 work)
  • mto: This revision was merged to the branch mainline in revision 7294.
  • Revision ID: jelmer@jelmer.uk-20190304051044-vph4s8p9qvpy2qe9
Merge trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
68
68
    )
69
69
 
70
70
 
71
 
class RepoReconciler(object):
72
 
    """Reconciler that reconciles a repository.
73
 
 
74
 
    """
75
 
 
76
 
    def __init__(self, repo, other=None, thorough=False):
77
 
        """Construct a RepoReconciler.
78
 
 
79
 
        :param thorough: perform a thorough check which may take longer but
80
 
                         will correct non-data loss issues such as incorrect
81
 
                         cached data.
82
 
        """
83
 
        self.repo = repo
84
 
 
85
 
    def reconcile(self):
86
 
        """Perform reconciliation.
87
 
 
88
 
        After reconciliation the following attributes document found issues:
89
 
        inconsistent_parents: The number of revisions in the repository whose
90
 
                              ancestry was being reported incorrectly.
91
 
        garbage_inventories: The number of inventory objects without revisions
92
 
                             that were garbage collected.
93
 
        """
94
 
 
95
 
 
96
71
class GitCheck(check.Check):
97
72
 
98
73
    def __init__(self, repository, check_repo=True):
241
216
 
242
217
    def reconcile(self, other=None, thorough=False):
243
218
        """Reconcile this repository."""
244
 
        reconciler = RepoReconciler(self, thorough=thorough)
245
 
        reconciler.reconcile()
246
 
        return reconciler
 
219
        from ..reconcile import ReconcileResult
 
220
        ret = ReconcileResult()
 
221
        ret.aborted = False
 
222
        return ret
247
223
 
248
224
    def supports_rich_root(self):
249
225
        return True
372
348
            o = self._git.object_store[sha]
373
349
            if not isinstance(o, Commit):
374
350
                continue
375
 
            rev, roundtrip_revid, verifiers = mapping.import_commit(
376
 
                o, mapping.revision_id_foreign_to_bzr)
377
 
            yield o.id, rev.revision_id, roundtrip_revid
 
351
            revid = mapping.revision_id_foreign_to_bzr(o)
 
352
            roundtrip_revid = mapping.get_revision_id(o)
 
353
            yield o.id, revid, (roundtrip_revid if revid != roundtrip_revid else None)
378
354
 
379
355
    def all_revision_ids(self):
380
356
        ret = set()
478
454
        commit = self._git.object_store.peel_sha(foreign_revid)
479
455
        if not isinstance(commit, Commit):
480
456
            raise NotCommitError(commit.id)
481
 
        rev, roundtrip_revid, verifiers = mapping.import_commit(
482
 
            commit, mapping.revision_id_foreign_to_bzr)
 
457
        revid = mapping.get_revision_id(commit)
483
458
        # FIXME: check testament before doing this?
484
 
        if roundtrip_revid:
485
 
            return roundtrip_revid
486
 
        else:
487
 
            return rev.revision_id
 
459
        return revid
488
460
 
489
461
    def has_signature_for_revision_id(self, revision_id):
490
462
        """Check whether a GPG signature is present for this revision.