l.c.s.b.BzrSync : class documentation

Part of lp.codehosting.scanner.bzrsync View In Hierarchy

Import version control metadata from a Bazaar branch into the database.
Method __init__ Undocumented
Method syncBranchAndClose Synchronize the database with a Bazaar branch, handling locking.
Method syncBranch Synchronize the database view of a branch with Bazaar data.
Method retrieveDatabaseAncestry Efficiently retrieve ancestry from the database.
Method getAncestryDelta Undocumented
Method getHistoryDelta Undocumented
Method planDatabaseChanges Plan database changes to synchronize with bzrlib data.
Method getBazaarRevisions Like get_revisions(revisions) but filter out ghosts first.
Method syncRevisions Import the supplied revisions.
Static Method revisionsToInsert Calculate the revisions to insert and their revnos.
Method deleteBranchRevisions Delete a batch of BranchRevision rows.
Method insertBranchRevisions Insert a batch of BranchRevision rows.
Method updateBranchStatus Update the branch-scanner status in the database Branch table.
Method _getRevisionGraph Undocumented
def __init__(self, branch, logger=None):
Undocumented
def syncBranchAndClose(self, bzr_branch=None):
Synchronize the database with a Bazaar branch, handling locking.
def syncBranch(self, bzr_branch):

Synchronize the database view of a branch with Bazaar data.

bzr_branch must be read locked.

Several tables must be updated:

  • Revision: there must be one Revision row for each revision in the branch ancestry. If the row for a revision that has just been added to the branch is already present, it must be checked for consistency.
  • BranchRevision: there must be one BrancheRevision row for each revision in the branch ancestry. If history revisions became merged revisions, the corresponding rows must be changed.
  • Branch: the branch-scanner status information must be updated when the sync is complete.
def retrieveDatabaseAncestry(self):
Efficiently retrieve ancestry from the database.
def _getRevisionGraph(self, bzr_branch, db_last):
Undocumented
def getAncestryDelta(self, bzr_branch):
Undocumented
def getHistoryDelta(self, bzr_history, db_history):
Undocumented
def planDatabaseChanges(self, bzr_branch, bzr_history, db_ancestry, db_history):
Plan database changes to synchronize with bzrlib data.

Use the data retrieved by retrieveDatabaseAncestry and retrieveBranchDetails to plan the changes to apply to the database.

def getBazaarRevisions(self, bzr_branch, revisions):
Like get_revisions(revisions) but filter out ghosts first.
Parametersrevisionsthe set of Bazaar revision IDs to return bzrlib Revision objects for.
def syncRevisions(self, bzr_branch, bzr_revisions, revids_to_insert):
Import the supplied revisions.
Parametersbzr_branchThe Bazaar branch that's being scanned.
bzr_revisionsthe revisions to import
bzr_revision (type: bzrlib.revision.Revision)
revids_to_inserta dict of revision ids to integer revno. Non-mainline revisions will be mapped to None.
@staticmethod
def revisionsToInsert(added_history, last_revno, added_ancestry):
Calculate the revisions to insert and their revnos.
Parametersadded_historyA list of revision ids added to the revision history in parent-to-child order.
last_revnoThe revno of the last revision.
added_ancestryA set of revisions that have been added to the ancestry of the branch. May overlap with added_history.
def deleteBranchRevisions(self, revision_ids_to_delete):
Delete a batch of BranchRevision rows.
def insertBranchRevisions(self, bzr_branch, revids_to_insert):
Insert a batch of BranchRevision rows.
def updateBranchStatus(self, bzr_history):
Update the branch-scanner status in the database Branch table.
API Documentation for Launchpad, generated by pydoctor at 2018-11-17 00:00:08.