l.c.i.g.IGitRepositoryView(IHasRecipes) : interface documentation

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

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

IGitRepository attributes that require launchpad.View permission.
Int id Undocumented
Attribute namespace The namespace of this repository, as an IGitNamespace.
Attribute code_reviewer The reviewer if set, otherwise the owner of the repository.
Attribute shortened_path The shortest reasonable version of the path to this repository.
Method isPersonTrustedReviewer Return true if the reviewer is a trusted reviewer.
Attribute identity The identity of this repository: a VCS-independent synonym for git_identity.
Attribute branches_by_date The branch references present in this repository, ordered by last commit date.
Attribute rules The access rules for this repository.
Attribute grants The access grants for this repository.
Method getRefByPath Look up a single reference in this repository by path.
Method createOrUpdateRefs Create or update a set of references in this repository.
Method removeRefs Remove a set of references in this repository.
Method planRefChanges Plan ref changes based on information from the hosting service.
Method fetchRefCommits Fetch commit information from the hosting service for a set of refs.
Method synchroniseRefs Synchronise references with those from the hosting service.
Method setOwnerDefault Set whether this repository is the default for its owner-target.
Method setTargetDefault Set whether this repository is the default for its target.
Method getCodebrowseUrl Construct a browsing URL for this Git repository.
Method getCodebrowseUrlForRevision The URL to the commit of the merge to the target branch
Method getLatestScanJob Return the last IGitRefScanJobSource for this repository
Method visibleByUser Can the specified user see this repository?
Method getAllowedInformationTypes Get a list of acceptable `InformationType`s for this repository.
Method getInternalPath Get the internal path to this repository.
Method getRepositoryDefaults Return a sorted list of ICanHasDefaultGitRepository objects.
Method getRepositoryIdentities A list of aliases for a repository.
Method userCanBeSubscribed Return True if the IPerson can be subscribed to the repository.
Method subscribe Subscribe this person to the repository.
Method getSubscription Return the GitSubscription for this person.
Method hasSubscription Is this person subscribed to the repository?
Method unsubscribe Remove the person's subscription to this repository.
Method getSubscriptionsByLevel Return the subscriptions that are at the given notification levels.
Method getNotificationRecipients Return a complete INotificationRecipientSet instance.
Attribute landing_targets A collection of the merge proposals where this repository is the source.
Attribute landing_candidates A collection of the merge proposals where this repository is the target.
Method getPrecachedLandingTargets Return precached landing targets.
Method getPrecachedLandingCandidates Return precached landing candidates.
Method getMergeProposals Return matching BranchMergeProposals.
Method getMergeProposalByID Return this repository's merge proposal with this id, or None.
Method isRepositoryMergeable Is the other repository mergeable into this one (or vice versa)?
Attribute pending_updates Whether there are recent changes in this repository that have not yet been scanned.
Method updateMergeCommitIDs Update commit SHA1s of merge proposals for this repository.
Method updateLandingTargets Update landing targets (MPs where this repository is the source).
Method markRecipesStale Mark recipes associated with this repository as stale.
Method markSnapsStale Mark snap packages associated with this repository as stale.
Method detectMerges Detect merges of landing candidates.
Method getBlob Get a blob by file name from this repository.
Method getDiff Get the diff between two commits in this repository.
Method getRule Get the access rule for this repository with a given pattern.
Method getActivity Get activity log entries for this repository.
Method getPrecachedActivity Activity log entries are preloaded.
Method issueAccessToken Issue an access token for this repository.
id =
Undocumented
namespace =
The namespace of this repository, as an IGitNamespace.
code_reviewer =
The reviewer if set, otherwise the owner of the repository.
shortened_path =
The shortest reasonable version of the path to this repository.
@operation_parameters(Reference(_('A person for which the reviewer status is in question.'), IPerson))
@export_read_operation()
@operation_for_version('devel')
def isPersonTrustedReviewer(reviewer):
Return true if the reviewer is a trusted reviewer.

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

identity =
The identity of this repository: a VCS-independent synonym for git_identity.
branches_by_date =
The branch references present in this repository, ordered by last commit date.
rules =
The access rules for this repository.
grants =
The access grants for this repository.
@operation_parameters(TextLine(_('A string to look up as a path.')))
@operation_returns_entry(Interface)
@export_read_operation()
@operation_for_version('devel')
def getRefByPath(path):
Look up a single reference in this repository by path.
ParameterspathA string to look up as a path.
ReturnsAn IGitRef, or None.
def createOrUpdateRefs(refs_info, get_objects=False, logger=None):
Create or update a set of references in this repository.
Parametersrefs_infoA dict mapping ref paths to {"sha1": sha1, "type": GitObjectType}.
get_objectsReturn the created/updated references.
loggerAn optional logger.
ReturnsA list of the created/updated references if get_objects, otherwise None.
def removeRefs(paths):
Remove a set of references in this repository.
Unknown Field: paramspathsAn iterable of paths.
def planRefChanges(hosting_path, logger=None):
Plan ref changes based on information from the hosting service.
Parametershosting_pathA path on the hosting service.
loggerAn optional logger.
ReturnsA dict of refs to create or update as appropriate, mapping ref paths to dictionaries of their fields; and a set of ref paths to remove.
def fetchRefCommits(hosting_path, refs, logger=None):
Fetch commit information from the hosting service for a set of refs.
Parametershosting_pathA path on the hosting service.
refsA dict mapping ref paths to dictionaries of their fields; the field dictionaries will be updated with any detailed commit information that is available.
loggerAn optional logger.
def synchroniseRefs(refs_to_upsert, refs_to_remove, logger=None):
Synchronise references with those from the hosting service.
Parametersrefs_to_upsertA dictionary mapping ref paths to dictionaries of their fields; these refs will be created or updated as appropriate.
refs_to_removeA set of ref paths to remove.
loggerAn optional logger.
def setOwnerDefault(value):
Set whether this repository is the default for its owner-target.

This is for internal use; the caller should ensure permission to edit the owner, should arrange to remove any existing owner-target default, and should check that this repository is attached to the desired target.

ParametersvalueTrue if this repository should be the owner-target default, otherwise False.
def setTargetDefault(value):
Set whether this repository is the default for its target.

This is for internal use; the caller should ensure permission to edit the target, should arrange to remove any existing target default, and should check that this repository is attached to the desired target.

ParametersvalueTrue if this repository should be the target default, otherwise False.
def getCodebrowseUrl():
Construct a browsing URL for this Git repository.
def getCodebrowseUrlForRevision(commit):
The URL to the commit of the merge to the target branch
def getLatestScanJob():
Return the last IGitRefScanJobSource for this repository
def visibleByUser(user):
Can the specified user see this repository?
def getAllowedInformationTypes(user):
Get a list of acceptable `InformationType`s for this repository.

If the user is a Launchpad admin, any type is acceptable.
def getInternalPath():
Get the internal path to this repository.

This is used on the storage backend.

def getRepositoryDefaults():
Return a sorted list of ICanHasDefaultGitRepository objects.

There is one result for each related object for which this repository is the default. For example, in the case where a repository is the default for a project and is also its owner's default repository for that project, the objects for both the project and the person-project are returned.

More important related objects are sorted first.

def getRepositoryIdentities():
A list of aliases for a repository.

Returns a list of tuples of path and context object.  There is at
least one alias for any repository, and that is the repository
itself.  For default repositories, the context object is the
appropriate default object.

Where a repository is the default for a product or a distribution
source package, the repository is available through a number of
different URLs.  These URLs are the aliases for the repository.

For example, a repository which is the default for the 'fooix'
project and which is also its owner's default repository for that
project is accessible using:
  fooix - the context object is the project fooix
  ~fooix-owner/fooix - the context object is the person-project
      ~fooix-owner and fooix
  ~fooix-owner/fooix/+git/fooix - the unique name of the repository
      where the context object is the repository itself.
def userCanBeSubscribed(person):
Return True if the IPerson can be subscribed to the repository.
@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('devel')
def subscribe(person, notification_level, max_diff_lines, code_review_level, subscribed_by):
Subscribe this person to the repository.
ParameterspersonThe Person to subscribe.
notification_levelThe kinds of repository 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.
ReturnsA new or existing GitSubscription.
@operation_parameters(Reference(_('The person to search for'), IPerson))
@operation_returns_entry(Interface)
@export_read_operation()
@operation_for_version('devel')
def getSubscription(person):
Return the GitSubscription for this person.
def hasSubscription(person):
Is this person subscribed to the repository?
@operation_parameters(Reference(_('The person to unsubscribe'), IPerson))
@call_with(REQUEST_USER)
@export_write_operation()
@operation_for_version('devel')
def unsubscribe(person, unsubscribed_by):
Remove the person's subscription to this repository.
ParameterspersonThe person or team to unsubscribe from the repository.
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: A `ResultSet`.
def getNotificationRecipients():
Return a complete INotificationRecipientSet instance.

The INotificationRecipientSet instance contains the subscribers and their subscriptions.

landing_targets =
A collection of the merge proposals where this repository is the source.
landing_candidates =
A collection of the merge proposals where this repository is the target.
def getPrecachedLandingTargets(user):
Return precached landing targets.

Target and prerequisite repositories are preloaded.

def getPrecachedLandingCandidates(user):
Return precached landing candidates.

Source and prerequisite repositories are preloaded.

@operation_parameters(List(_('A list of merge proposal statuses to filter by.'), Choice(BranchMergeProposalStatus)), List(TextLine(_('The target revision ID of the merge.'))))
@call_with(REQUEST_USER)
@operation_returns_collection_of(Interface)
@export_read_operation()
@operation_for_version('devel')
def getMergeProposals(status=None, visible_by_user=None, merged_revision_ids=None, eager_load=False):
Return matching BranchMergeProposals.
def getMergeProposalByID(id):
Return this repository's merge proposal with this id, or None.
def isRepositoryMergeable(other):
Is the other repository mergeable into this one (or vice versa)?
pending_updates =
Whether there are recent changes in this repository that have not yet been scanned.
def updateMergeCommitIDs(paths):
Update commit SHA1s of merge proposals for this repository.

The *_git_commit_sha1 columns of merge proposals are stored
explicitly in order that merge proposals are still meaningful after
associated refs have been deleted.  However, active merge proposals
where the refs in question still exist should have these columns
kept up to date.
def updateLandingTargets(paths):
Update landing targets (MPs where this repository is the source).

For each merge proposal, create `UpdatePreviewDiffJob`s.

:param paths: A list of reference paths.  Any merge proposals whose
    source is this repository and one of these paths will have their
    diffs updated.
def markRecipesStale(paths):
Mark recipes associated with this repository as stale.
ParameterspathsA list of reference paths. Any recipes that include an entry that points to this repository and that have a revspec that is one of these paths will be marked as stale.
def markSnapsStale(paths):
Mark snap packages associated with this repository as stale.
ParameterspathsA list of reference paths. Any snap packages that include an entry that points to this repository and that are based on one of these paths will be marked as stale.
def detectMerges(paths, logger=None):
Detect merges of landing candidates.
ParameterspathsA list of reference paths. Any merge proposals whose target is this repository and one of these paths will be checked.
loggerAn optional logger.
def getBlob(filename, rev=None):
Get a blob by file name from this repository.
ParametersfilenameRelative path of a file in the repository.
revAn optional revision. Defaults to 'HEAD'.
ReturnsA binary string with the blob content.
def getDiff(old, new):
Get the diff between two commits in this repository.
ParametersoldThe OID of the old commit.
newThe OID of the new commit.
ReturnsThe diff as a binary string.
def getRule(ref_pattern):
Get the access rule for this repository with a given pattern.
Parametersref_patternThe reference pattern that the rule should have.
ReturnsAn IGitRule, or None.
def getActivity(changed_after=None):
Get activity log entries for this repository.
Parameterschanged_afterIf supplied, only return entries for changes made after this date.
ReturnsA ResultSet of IGitActivity.
def getPrecachedActivity(**kwargs):
Activity log entries are preloaded.
Parameterschanged_afterIf supplied, only return entries for changes made after this date.
ReturnsA ResultSet of IGitActivity.
@export_write_operation()
@operation_for_version('devel')
def issueAccessToken():
Issue an access token for this repository.

Access tokens can be used to push to this repository over HTTPS. They are only valid for a single repository, and have a short expiry period (currently one week), so at the moment they are only suitable in some limited situations.

This interface is experimental, and may be changed or removed without notice.

ReturnsA serialised macaroon.
API Documentation for Launchpad, generated by pydoctor at 2022-06-16 00:00:12.