538
538
destination.set_parent(parent)
542
"""Check consistency of the branch.
544
In particular this checks that revisions given in the revision-history
545
do actually match up in the revision graph, and that they're all
546
present in the repository.
548
:return: A BranchCheckResult.
550
mainline_parent_id = None
551
for revision_id in self.revision_history():
553
revision = self.repository.get_revision(revision_id)
554
except errors.NoSuchRevision, e:
555
raise BzrCheckError("mainline revision {%s} not in repository"
557
# In general the first entry on the revision history has no parents.
558
# But it's not illegal for it to have parents listed; this can happen
559
# in imports from Arch when the parents weren't reachable.
560
if mainline_parent_id is not None:
561
if mainline_parent_id not in revision.parent_ids:
562
raise BzrCheckError("previous revision {%s} not listed among "
564
% (mainline_parent_id, revision_id))
565
mainline_parent_id = revision_id
566
return BranchCheckResult(self)
541
569
class BranchFormat(object):
542
570
"""An encapsulation of the initialization and open routines for a format.
1365
class BranchCheckResult(object):
1366
"""Results of checking branch consistency.
1371
def __init__(self, branch):
1372
self.branch = branch
1374
def report_results(self, verbose):
1375
"""Report the check results via trace.note.
1377
:param verbose: Requests more detailed display of what was checked,
1380
note('checked branch %s format %s',
1382
self.branch._format)
1337
1385
######################################################################