558
558
destination.set_parent(parent)
562
"""Check consistency of the branch.
564
In particular this checks that revisions given in the revision-history
565
do actually match up in the revision graph, and that they're all
566
present in the repository.
568
:return: A BranchCheckResult.
570
mainline_parent_id = None
571
for revision_id in self.revision_history():
573
revision = self.repository.get_revision(revision_id)
574
except errors.NoSuchRevision, e:
575
raise BzrCheckError("mainline revision {%s} not in repository"
577
# In general the first entry on the revision history has no parents.
578
# But it's not illegal for it to have parents listed; this can happen
579
# in imports from Arch when the parents weren't reachable.
580
if mainline_parent_id is not None:
581
if mainline_parent_id not in revision.parent_ids:
582
raise BzrCheckError("previous revision {%s} not listed among "
584
% (mainline_parent_id, revision_id))
585
mainline_parent_id = revision_id
586
return BranchCheckResult(self)
561
589
class BranchFormat(object):
562
590
"""An encapsulation of the initialization and open routines for a format.
1396
class BranchCheckResult(object):
1397
"""Results of checking branch consistency.
1402
def __init__(self, branch):
1403
self.branch = branch
1405
def report_results(self, verbose):
1406
"""Report the check results via trace.note.
1408
:param verbose: Requests more detailed display of what was checked,
1411
note('checked branch %s format %s',
1413
self.branch._format)
1368
1416
######################################################################