l.c.i.c.IBranchPuller(Interface) : interface documentation

Part of lp.code.interfaces.codehosting View In Hierarchy

Known implementations: lp.code.xmlrpc.codehosting.BranchPuller

The puller's interface to the rest of Launchpad.

Published at 'branch_puller' on the private XML-RPC server.

Method acquireBranchToPull Return a Branch to pull and mark it as mirror-started.
Method startMirroring Notify Launchpad that the given branch has started mirroring.
Method mirrorComplete Notify Launchpad that the branch has been successfully mirrored.
Method mirrorFailed Notify Launchpad that the branch could not be mirrored.
Method recordSuccess Notify Launchpad that a mirror script has successfully completed.
Method setStackedOn Mark a branch as being stacked on another branch.
def acquireBranchToPull(branch_type_names):
Return a Branch to pull and mark it as mirror-started.
Parametersbranch_type_namesOnly consider branches of these type names. An empty list means consider HOSTED, MIRRORED and IMPORTED branches.
ReturnsA 5-tuple:

(branch_id, pull_url, unique_name, default_branch, branch_type)

where:

  • branch_id is the database id of the branch,
  • pull_url is where to pull from,
  • unique_name is the unique_name of the branch,
  • default_branch is the unique name of the default stacked on branch for the branch's target (or '' if there is no such branch), and
  • branch_type is one of 'hosted', 'mirrored', or 'imported'.

or (), the empty tuple, if there is no branch to pull.

def startMirroring(branchID):
Notify Launchpad that the given branch has started mirroring.

The last_mirror_attempt field of the given branch record will be updated appropriately.

ParametersbranchIDThe database ID of the given branch.
ReturnsTrue if the branch status was successfully updated. NoBranchWithID fault if there's no branch with the given id.
def mirrorComplete(branchID, lastRevisionID):
Notify Launchpad that the branch has been successfully mirrored.

In the Launchpad database, the last_mirrored field will be updated to match the last_mirror_attempt value, the mirror_failures counter will be reset to zero and the next_mirror_time will be set to NULL.

ParametersbranchIDThe database ID of the given branch.
lastRevisionIDThe last revision ID mirrored.
ReturnsTrue if the branch status was successfully updated. NoBranchWithID fault if there's no branch with the given id.
def mirrorFailed(branchID, reason):
Notify Launchpad that the branch could not be mirrored.

The mirror_failures counter for the given branch record will be incremented and the next_mirror_time will be set to NULL.

ParametersbranchIDThe database ID of the given branch.
reasonA string giving the reason for the failure.
ReturnsTrue if the branch status was successfully updated. NoBranchWithID fault if there's no branch with the given id.
def recordSuccess(name, hostname, date_started, date_completed):
Notify Launchpad that a mirror script has successfully completed.

Create an entry in the ScriptActivity table with the provided data.

ParametersnameName of the script.
hostnameWhere the script was running.
date_startedWhen the script started, as an UTC time tuple.
date_completedWhen the script completed (now), as an UTC time tuple.
ReturnsTrue if the ScriptActivity record was successfully inserted.
def setStackedOn(branch_id, stacked_on_location):
Mark a branch as being stacked on another branch.
Parametersbranch_idThe database ID of the stacked branch.
stacked_on_locationThe location of the stacked-on branch. For hosted branches, this is normally '/~foo/bar/baz' where '~foo/bar/baz' is the unique name of another branch.
ReturnsTrue if the stacked branch information was set successfully. NoBranchWithID fault if there's no branch with the given id. NoSuchBranch fault if there's no branch matching 'stacked_on_location'.
API Documentation for Launchpad, generated by pydoctor at 2010-04-27 00:00:13.