l.c.i.b.IBranchView(IHasOwner, IHasBranchTarget, IHasMergeProposals, IHasRecipes) : interface documentation

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

Known subclasses: lp.code.interfaces.webservice.IBranch

IBranch attributes that require launchpad.View permission.
Int id Undocumented
Method composePublicURL Return a public URL for the branch using the given protocol.
Choice distroseries The distribution series that this branch belongs to. Branches do not have to belong to a distribution series, they can also belong to a project or be junk branches.
Choice sourcepackagename The source package that this is a branch of. Source package branches always belong to a distribution series.
Attribute distribution The IDistribution that this branch belongs to. None if not a package branch.
Attribute namespace The namespace of this branch, as an IBranchNamespace.
Attribute displayname Display name (deprecated)
Attribute code_reviewer The reviewer if set, otherwise the owner of the branch.
Method isPersonTrustedReviewer Return true if the reviewer is a trusted reviewer.
Text last_mirrored_id The head revision ID of the branch when last successfully mirrored.
Attribute mirror_failures Number of failed mirror attempts since the last successful mirror.
Datetime next_mirror_time Undocumented
Attribute stacked_on Stacked-on branch
Method getLinkedBugTasks Return a result set for the tasks that are relevant to this branch.
Method linkBug Link a bug to this branch.
Method unlinkBug Unlink a bug to this branch.
Method getSpecificationLinks Fetch the ISpecificationBranch's that the user can view.
Method linkSpecification Link an ISpecification to a branch.
Method unlinkSpecification Unlink an ISpecification to a branch.
Attribute revision_history The sequence of revisions for the mainline of this branch.
Attribute pending_writes Whether there is new Bazaar data for this branch.
Attribute pending_updates Whether there is an update job of some kind (mirroring or scanning) pending for the Bazaar data in this branch. Note that pending_writes may be True and pending_updates False if a branch has been unscanned.
Method latest_revisions A specific number of the latest revisions in that branch.
Attribute landing_targets A collection of the merge proposals where this branch is the source branch.
Attribute landing_candidates A collection of the merge proposals where this branch is the target branch.
Method getPrecachedLandingTargets Return precached landing targets.
Method getPrecachedLandingCandidates Return precached landing candidates.
Method isBranchMergeable Is the other branch mergeable into this branch (or vice versa)?
Method addLandingTarget Create a new BranchMergeProposal with this branch as the source.
Method getMergeProposals Return matching BranchMergeProposals.
Method getDependentMergeProposals Return BranchMergeProposals dependent on merging this branch.
Method getMergeProposalByID Return this branch's merge proposal with this id, or None.
Method scheduleDiffUpdates Create UpdatePreviewDiffJobs for this branch's targets.
Method markRecipesStale Mark all recipes associated with this branch as stale.
Method markSnapsStale Mark all snap packages associated with this branch as stale.
Method getStackedBranches The branches that are stacked on this one.
Method getStackedOnBranches The branches on which this one is stacked.
Method getMainlineBranchRevisions Return the matching mainline branch revision objects.
Attribute code_is_browseable Is the code in this branch accessable through codebrowse?
Method getCodebrowseUrl Construct a URL for this branch in codebrowse.
Attribute browse_source_url The URL of the source browser for this branch.
Method getCodebrowseUrlForRevision The URL to the commit of the merge to the target branch
Attribute shortened_path The shortest reasonable version of the path to this branch; as bzr_identity but without the 'lp:' prefix.
Attribute identity The identity of this branch: a VCS-independent synonym for bzr_identity.
Method addToLaunchBag Add information about this branch to `launchbag'.
Method getBlob Get a blob by file name from this branch.
Method getDiff Get the diff between two revisions in this branch.
Method canBeDeleted Can this branch be deleted in its current state.
Method deletionRequirements Determine what is required to delete this branch.
Method associatedProductSeries Return the product series that this branch is associated with.
Method getProductSeriesPushingTranslations Return sequence of product series pushing translations here.
Method associatedSuiteSourcePackages Return the suite source packages that this branch is linked to.
Method getBranchLinks Return a sorted list of ICanHasLinkedBranch objects.
Method getBranchIdentities A list of aliases for a branch.
Method userCanBeSubscribed Return if the IPerson can be subscribed to the branch.
Method subscribe Subscribe this person to the branch.
Method getSubscription Return the BranchSubscription for this person.
Method hasSubscription Is this person subscribed to the branch?
Method unsubscribe Remove the person's subscription to this branch.
Method getSubscriptionsByLevel Return the subscriptions that are at the given notification levels.
Method getBranchRevision Get the associated BranchRevision.
Method createBranchRevision Create a new BranchRevision for this branch.
Method removeBranchRevisions Remove the specified revision_ids from this Branch's revisions.
Method createBranchRevisionFromIDs Create a batch of BranchRevision objects.
Method getTipRevision Return the Revision associated with the last_scanned_id.
Method updateScannedDetails Updates attributes associated with the scanning of the branch.
Method getNotificationRecipients Return a complete INotificationRecipientSet instance.
Method getScannerData Retrieve the full ancestry of a branch for the branch scanner.
Method getInternalBzrUrl Get the internal URL for this branch.
Method getBzrBranch Return the BzrBranch for this database Branch.
Method getPullURL Return the URL used to pull the branch into the mirror area.
Method requestMirror Request that this branch be mirrored on the next run of the branch
Method startMirroring Signal that this branch is being mirrored.
Method mirrorFailed Signal that a mirror attempt failed.
Method getLatestScanJob Get the latest IBranchScanJob for this branch
Method checkUpgrade Check whether an upgrade should be performed, and raise if not.
Attribute needs_upgrading Whether the branch needs to be upgraded.
Attribute upgrade_pending Whether a branch has had an upgrade requested.
Method visibleByUser Can the specified user see this branch?
Method getAllowedInformationTypes Get a list of acceptable `InformationType`s for this branch.
Method _createMergeProposal Create a new BranchMergeProposal with this branch as the source.

Inherited from IHasOwner:

Attribute owner The object's owner, which is an IPerson.

Inherited from IHasBranchTarget:

Attribute target The branch target, as an IBranchTarget.
id =
Undocumented
@operation_parameters(TextLine(_('URL scheme'), u'http'))
@export_read_operation()
@operation_for_version('beta')
def composePublicURL(scheme='http'):
Return a public URL for the branch using the given protocol.
Parametersschemea protocol name accepted by the public code-hosting API. (As a legacy issue, 'sftp' is also accepted).
distroseries =
The distribution series that this branch belongs to. Branches do not have to belong to a distribution series, they can also belong to a project or be junk branches.
sourcepackagename =
The source package that this is a branch of. Source package branches always belong to a distribution series.
distribution =
The IDistribution that this branch belongs to. None if not a package branch.
namespace =
The namespace of this branch, as an IBranchNamespace.
displayname =
Display name (deprecated)
code_reviewer =
The reviewer if set, otherwise the owner of the branch.
@operation_parameters(Reference(_('A person for which the reviewer status is in question.'), IPerson))
@export_read_operation()
@operation_for_version('beta')
def isPersonTrustedReviewer(reviewer):
Return true if the reviewer is a trusted reviewer.

The reviewer is trusted if they are either own the branch, or are in the team that owns the branch, or they are in the review team for the branch.

last_mirrored_id =
The head revision ID of the branch when last successfully mirrored.
mirror_failures =
Number of failed mirror attempts since the last successful mirror.
next_mirror_time =
Undocumented
stacked_on =
Stacked-on branch
def getLinkedBugTasks(user, status_filter):
Return a result set for the tasks that are relevant to this branch.

When multiple tasks are on a bug, if one of the tasks is for the branch.target, then only that task is returned. Otherwise the default bug task is returned.

ParametersuserThe user doing the search.
status_filterPassed onto the bug search as a constraint.
@call_with(REQUEST_USER)
@operation_parameters(Reference(Interface))
@export_write_operation()
@operation_for_version('beta')
def linkBug(bug, registrant):
Link a bug to this branch.
ParametersbugIBug to link.
registrantIPerson linking the bug.
@call_with(REQUEST_USER)
@operation_parameters(Reference(Interface))
@export_write_operation()
@operation_for_version('beta')
def unlinkBug(bug, user):
Unlink a bug to this branch.
ParametersbugIBug to unlink.
userIPerson unlinking the bug.
def getSpecificationLinks(user):
Fetch the ISpecificationBranch's that the user can view.
@call_with(REQUEST_USER)
@operation_parameters(Reference(Interface))
@export_write_operation()
@operation_for_version('beta')
def linkSpecification(spec, registrant):
Link an ISpecification to a branch.
ParametersspecISpecification to link.
registrantIPerson unlinking the spec.
@call_with(REQUEST_USER)
@operation_parameters(Reference(Interface))
@export_write_operation()
@operation_for_version('beta')
def unlinkSpecification(spec, user):
Unlink an ISpecification to a branch.
ParametersspecISpecification to unlink.
userIPerson unlinking the spec.
revision_history =
The sequence of revisions for the mainline of this branch.

They are ordered with the most recent revision first, and the list only contains those in the "leftmost tree", or in other words the revisions that match the revision history from bzrlib for this branch.

The revisions are listed as tuples of (BranchRevision, Revision).

pending_writes =
Whether there is new Bazaar data for this branch.
pending_updates =
Whether there is an update job of some kind (mirroring or scanning) pending for the Bazaar data in this branch. Note that pending_writes may be True and pending_updates False if a branch has been unscanned.
def latest_revisions(quantity=10):
A specific number of the latest revisions in that branch.
landing_targets =
A collection of the merge proposals where this branch is the source branch.
landing_candidates =
A collection of the merge proposals where this branch is the target branch.
def getPrecachedLandingTargets(user):
Return precached landing targets.

Target and prerequisite branches are preloaded, along with the related chains of stacked-on branches visible to user.

def getPrecachedLandingCandidates(user):
Return precached landing candidates.

Source and prerequisite branches are preloaded, along with the related chains of stacked-on branches visible to user.

def isBranchMergeable(other_branch):
Is the other branch mergeable into this branch (or vice versa)?
@export_operation_as('createMergeProposal')
@rename_parameters_as('target_branch', 'prerequisite_branch')
@operation_parameters(Reference(Interface), Reference(Interface), Bool(_('Needs review'), _('If True the proposal needs review.Otherwise, it will be work in progress.')), Text(_('Initial comment'), _("Registrant's initial description of proposal.")), Text(_('Commit message'), _('Message to use when committing this merge.')), List(Reference(IPerson)), List(TextLine()))
@call_with(REQUEST_USER)
@export_factory_operation(Interface, )
@operation_for_version('beta')
def _createMergeProposal(registrant, merge_target, merge_prerequisite=None, needs_review=True, initial_comment=None, commit_message=None, reviewers=None, review_types=None):
Create a new BranchMergeProposal with this branch as the source.

Both the target_branch and the prerequisite_branch, if it is there, must be branches with the same target as the source branch.

Personal branches (a.k.a. junk branches) cannot specify landing targets.

def addLandingTarget(registrant, merge_target, merge_prerequisite=None, date_created=None, needs_review=False, description=None, review_requests=None, commit_message=None):
Create a new BranchMergeProposal with this branch as the source.

Both the merge_target and the merge_prerequisite, if it is there, must be branches with the same target as the source branch.

Personal branches (a.k.a. junk branches) cannot specify landing targets.

ParametersregistrantThe person who is adding the landing target.
merge_targetMust be another branch, and different to self.
merge_prerequisiteOptional but if it is not None, it must be another branch.
date_createdUsed to specify the date_created value of the merge request.
needs_reviewUsed to specify the proposal is ready for review right now.
descriptionA description of the bugs fixed, features added, or refactorings.
review_requestsAn optional list of (Person, review_type).
@operation_parameters(List(_('A list of merge proposal statuses to filter by.'), Choice(BranchMergeProposalStatus)), List(Int(_('The target-branch revno of the merge.'))))
@call_with(REQUEST_USER)
@operation_returns_collection_of(Interface)
@export_read_operation()
@operation_for_version('beta')
def getMergeProposals(status=None, visible_by_user=None, merged_revnos=None, eager_load=False):
Return matching BranchMergeProposals.
def getDependentMergeProposals(status=None, visible_by_user=None, eager_load=False):
Return BranchMergeProposals dependent on merging this branch.
def getMergeProposalByID(id):
Return this branch's merge proposal with this id, or None.
def scheduleDiffUpdates():
Create UpdatePreviewDiffJobs for this branch's targets.
def markRecipesStale():
Mark all recipes associated with this branch as stale.
def markSnapsStale():
Mark all snap packages associated with this branch as stale.
def getStackedBranches():
The branches that are stacked on this one.
def getStackedOnBranches():
The branches on which this one is stacked.
def getMainlineBranchRevisions(start_date, end_date=None, oldest_first=False):
Return the matching mainline branch revision objects.
Parametersstart_dateReturn revisions that were committed after the start_date.
end_dateReturn revisions that were committed before the end_date
oldest_firstDefines the ordering of the result set.
ReturnsA resultset of tuples for (BranchRevision, Revision)
code_is_browseable =
Is the code in this branch accessable through codebrowse?
def getCodebrowseUrl(*extras):
Construct a URL for this branch in codebrowse.
ParametersextrasZero or more path segments that will be joined onto the end of the URL (with bzrlib.urlutils.join).
browse_source_url =
The URL of the source browser for this branch.
def getCodebrowseUrlForRevision(commit):
The URL to the commit of the merge to the target branch
shortened_path =
The shortest reasonable version of the path to this branch; as bzr_identity but without the 'lp:' prefix.
identity =
The identity of this branch: a VCS-independent synonym for bzr_identity.
def addToLaunchBag(launchbag):
Add information about this branch to `launchbag'.

Use this when traversing to this branch in the web UI.

In particular, add information about the branch's target to the
launchbag. If the branch has a product, add that; if it has a source
package, add lots of information about that.

:param launchbag: `ILaunchBag`.
def getBlob(filename, revision_id=None):
Get a blob by file name from this branch.
ParametersfilenameRelative path of a file in the branch.
revision_idAn optional revision ID. Defaults to the last scanned revision ID of the branch.
ReturnsThe blob content as a byte string.
def getDiff(new, old):
Get the diff between two revisions in this branch.
ParametersnewThe new revno or revision ID.
oldThe old revno or revision ID. Defaults to the parent revision of new.
ReturnsThe diff as a byte string.
@export_read_operation()
@operation_for_version('beta')
def canBeDeleted():
Can this branch be deleted in its current state.

A branch is considered deletable if it has no revisions and is not linked to any bugs, specs, productseries, or code imports.

def deletionRequirements(eager_load=False):
Determine what is required to delete this branch.
Parameterseager_loadIf True, preload related information needed to display the deletion requirements.
Returnsa dict of {object: (operation, reason)}, where object is the object that must be deleted or altered, operation is either "delete" or "alter", and reason is a string explaining why the object needs to be touched.
def associatedProductSeries():
Return the product series that this branch is associated with.

A branch may be associated with a product series is either a branch. Also a branch can be associated with more than one product series as a branch.

def getProductSeriesPushingTranslations():
Return sequence of product series pushing translations here.

These are any ProductSeries that have this branch as their translations_branch. It should normally be at most one, but there's nothing stopping people from combining translations branches.

def associatedSuiteSourcePackages():
Return the suite source packages that this branch is linked to.
ReturnsA list of suite source packages ordered by pocket.
def getBranchLinks():
Return a sorted list of ICanHasLinkedBranch objects.

There is one result for each related linked object that the branch is linked to. For example in the case where a branch is linked to the development series of a project, the link objects for both the project and the development series are returned.

The sorting uses the defined order of the linked objects where the more important links are sorted first.

def getBranchIdentities():
A list of aliases for a branch.

Returns a list of tuples of bzr identity and context object.  There is
at least one alias for any branch, and that is the branch itself.  For
linked branches, the context object is the appropriate linked object.

Where a branch is linked to a product series or a suite source
package, the branch is available through a number of different urls.
These urls are the aliases for the branch.

For example, a branch linked to the development focus of the 'fooix'
project is accessible using:
  fooix - the linked object is the product fooix
  fooix/trunk - the linked object is the trunk series of fooix
  ~owner/fooix/name - the unique name of the branch where the linked
      object is the branch itself.
def userCanBeSubscribed(person):
Return if the IPerson can be subscribed to the branch.
@operation_parameters(Reference(_('The person to subscribe.'), IPerson), Choice(_('The level of notification to subscribe to.'), BranchSubscriptionNotificationLevel), Choice(_('The max number of lines for diff email.'), BranchSubscriptionDiffSize), Choice(_('The level of code review notification emails.'), CodeReviewNotificationLevel))
@operation_returns_entry(Interface)
@call_with(REQUEST_USER)
@export_write_operation()
@operation_for_version('beta')
def subscribe(person, notification_level, max_diff_lines, code_review_level, subscribed_by, check_stacked_visibility=True):
Subscribe this person to the branch.
ParameterspersonThe Person to subscribe.
notification_levelThe kinds of branch changes that cause notification.
max_diff_linesThe maximum number of lines of diff that may appear in a notification.
code_review_levelThe kinds of code review activity that cause notification.
subscribed_byThe person who is subscribing the subscriber. Most often the subscriber themselves.
Returnsnew or existing BranchSubscription.
@operation_parameters(Reference(_('The person to search for'), IPerson))
@operation_returns_entry(Interface)
@export_read_operation()
@operation_for_version('beta')
def getSubscription(person):
Return the BranchSubscription for this person.
def hasSubscription(person):
Is this person subscribed to the branch?
@operation_parameters(Reference(_('The person to unsubscribe'), IPerson))
@call_with(REQUEST_USER)
@export_write_operation()
@operation_for_version('beta')
def unsubscribe(person, unsubscribed_by):
Remove the person's subscription to this branch.
ParameterspersonThe person or team to unsubscribe from the branch.
unsubscribed_byThe person doing the unsubscribing.
def getSubscriptionsByLevel(notification_levels):
Return the subscriptions that are at the given notification levels.

:param notification_levels: An iterable of
    `BranchSubscriptionNotificationLevel`s
:return: An SQLObject query result.
def getBranchRevision(sequence=None, revision=None, revision_id=None):
Get the associated BranchRevision.

One and only one parameter is to be not None.

ParameterssequenceThe revno of the revision in the mainline history.
revisionA Revision object.
revision_idA revision id string.
ReturnsA BranchRevision or None.
def createBranchRevision(sequence, revision):
Create a new BranchRevision for this branch.
def removeBranchRevisions(revision_ids):
Remove the specified revision_ids from this Branch's revisions.
Parametersrevision_idsEither a single revision_id or an iterable.
def createBranchRevisionFromIDs(revision_id_sequence_pairs):
Create a batch of BranchRevision objects.
Parametersrevision_id_sequence_pairsA sequence of (revision_id, sequence) pairs. The revision_ids are assumed to have been inserted already; no checking of this is done.
def getTipRevision():
Return the Revision associated with the last_scanned_id.

Will return None if last_scanned_id is None, or if the id is not found (as in a ghost revision).

def updateScannedDetails(db_revision, revision_count):
Updates attributes associated with the scanning of the branch.

A single entry point that is called solely from the branch scanner script.

ParametersrevisionThe Revision that is the tip, or None if empty.
revision_countThe number of revisions in the history (main line revisions).
def getNotificationRecipients():
Return a complete INotificationRecipientSet instance.

The INotificationRecipientSet instance contains the subscribers and their subscriptions.

def getScannerData():
Retrieve the full ancestry of a branch for the branch scanner.

The branch scanner script is the only place where we need to retrieve
all the BranchRevision rows for a branch. Since the ancestry of some
branches is into the tens of thousands we don't want to materialise
BranchRevision instances for each of these.

:return: tuple of three items.
    1. Ancestry set of bzr revision-ids.
    2. History list of bzr revision-ids. Similar to the result of
       bzrlib.Branch.revision_history().
    3. Dictionnary mapping bzr bzr revision-ids to the database ids of
       the corresponding BranchRevision rows for this branch.
def getInternalBzrUrl():
Get the internal URL for this branch.

It's generally better to use getBzrBranch to open the branch directly, as that method is safe against the branch unexpectedly being a branch reference or stacked on something mischievous.

def getBzrBranch():
Return the BzrBranch for this database Branch.

You can only call this if a server returned by get_ro_server or get_rw_server is running.

Raiseslp.codehosting.safe_open.BadUrlIf the branch is stacked on or a reference to an unacceptable URL.
def getPullURL():
Return the URL used to pull the branch into the mirror area.
@export_write_operation()
@operation_for_version('beta')
def requestMirror():
Request that this branch be mirrored on the next run of the branch puller.
def startMirroring():
Signal that this branch is being mirrored.
def mirrorFailed(reason):
Signal that a mirror attempt failed.
ParametersreasonAn error message that will be displayed on the branch detail page.
def getLatestScanJob():
Get the latest IBranchScanJob for this branch
def checkUpgrade():
Check whether an upgrade should be performed, and raise if not.
Raisesa CannotUpgradeBranch, or a subclass.
needs_upgrading =
Whether the branch needs to be upgraded.
upgrade_pending =
Whether a branch has had an upgrade requested.
def visibleByUser(user):
Can the specified user see this branch?
def getAllowedInformationTypes(who):
Get a list of acceptable `InformationType`s for this branch.

If the user is a Launchpad admin, any type is acceptable. Otherwise
the `IBranchNamespace` is consulted.
API Documentation for Launchpad, generated by pydoctor at 2019-06-20 00:00:12.