l.c.i.w.IGitRepositorySet(Interface) : interface documentation

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

Interface representing the set of Git repositories.
Method new Create a Git repository and return it.
Method getByPath Find a repository by its path.
Method getRepositories Get all repositories for a target.
Method getRepositoryVisibilityInfo Return the named repositories visible to both user and person.
Method getDefaultRepository Get the default repository for a target.
Method getDefaultRepositoryForOwner Get a person's default repository for a target.
Method setDefaultRepository Set the default repository for a target.
Method setDefaultRepositoryForOwner Set a person's default repository for a target.
Method empty_list Return an empty collection of repositories.
Method preloadDefaultRepositoriesForProjects Get preloaded default repositories for a list of projects.
def new(registrant, owner, target, name, information_type=None, date_created=None):
Create a Git repository and return it.
ParametersregistrantThe IPerson who registered the new repository.
ownerThe IPerson who owns the new repository.
targetThe IProduct, IDistributionSourcePackage, or IPerson that the new repository is associated with.
nameThe repository name.
information_typeSet the repository's information type to one different from the target's default. The type must conform to the target's code sharing policy. (optional)
@call_with(REQUEST_USER)
@operation_parameters(TextLine(_('Repository path'), True))
@operation_returns_entry(IGitRepository)
@export_read_operation()
@operation_for_version('devel')
def getByPath(user, path):
Find a repository by its path.

Any of these forms may be used:

Unique names:
    ~OWNER/PROJECT/+git/NAME
    ~OWNER/DISTRO/+source/SOURCE/+git/NAME
    ~OWNER/+git/NAME
Owner-target default aliases:
    ~OWNER/PROJECT
    ~OWNER/DISTRO/+source/SOURCE
Official aliases:
    PROJECT
    DISTRO/+source/SOURCE

Return None if no match was found.

@call_with(REQUEST_USER)
@operation_parameters(Reference(_('Target'), True, IHasGitRepositories))
@operation_returns_collection_of(IGitRepository)
@export_read_operation()
@operation_for_version('devel')
def getRepositories(user, target):
Get all repositories for a target.
ParametersuserAn IPerson. Only repositories visible by this user will be returned.
targetAn IHasGitRepositories.
ReturnsA collection of IGitRepository objects.
@call_with(REQUEST_USER)
@operation_parameters(Reference(_('The person whose repository visibility is being checked.'), IPerson), List(Text(), _('List of repository unique names'), True))
@export_read_operation()
@operation_for_version('devel')
def getRepositoryVisibilityInfo(user, person, repository_names):
Return the named repositories visible to both user and person.

Anonymous requesters don't get any information.

Return a dict with the following values: person_name: the displayname of the person. visible_repositories: a list of the unique names of the repositories which the requester and specified person can both see.

This API call is provided for use by the client Javascript. It is not designed to efficiently scale to handle requests for large numbers of repositories.

ParametersuserThe user requesting the information. If the user is None then we return an empty dict.
personThe person whose repository visibility we wish to check.
repository_namesThe unique names of the repositories to check.
@operation_parameters(Reference(_('Target'), True, IHasGitRepositories))
@operation_returns_entry(IGitRepository)
@export_read_operation()
@operation_for_version('devel')
def getDefaultRepository(target):
Get the default repository for a target.
ParameterstargetAn IHasGitRepositories.
ReturnsAn IGitRepository, or None.
RaisesGitTargetErrorif target is an IPerson.
@operation_parameters(Reference(_('Owner'), True, IPerson), Reference(_('Target'), True, IHasGitRepositories))
@operation_returns_entry(IGitRepository)
@export_read_operation()
@operation_for_version('devel')
def getDefaultRepositoryForOwner(owner, target):
Get a person's default repository for a target.
ParametersownerAn IPerson.
targetAn IHasGitRepositories.
ReturnsAn IGitRepository, or None.
RaisesGitTargetErrorif target is an IPerson.
@operation_parameters(Reference(_('Target'), True, IHasGitRepositories), Reference(_('Git repository'), False, IGitRepository))
@export_write_operation()
@operation_for_version('devel')
def setDefaultRepository(target, repository):
Set the default repository for a target.
ParameterstargetAn IHasGitRepositories.
repositoryAn IGitRepository, or None to unset the default repository.
RaisesGitTargetErrorif target is an IPerson.
@call_with(REQUEST_USER)
@operation_parameters(Reference(_('Owner'), True, IPerson), Reference(_('Target'), True, IHasGitRepositories), Reference(_('Git repository'), False, IGitRepository))
@export_write_operation()
@operation_for_version('devel')
def setDefaultRepositoryForOwner(owner, target, repository, user):
Set a person's default repository for a target.
ParametersownerAn IPerson.
targetAn IHasGitRepositories.
repositoryAn IGitRepository, or None to unset the default repository.
userThe IPerson who is making the change.
RaisesGitTargetErrorif target is an IPerson.
@collection_default_content()
def empty_list():
Return an empty collection of repositories.

This only exists to keep lazr.restful happy.

def preloadDefaultRepositoriesForProjects(projects):
Get preloaded default repositories for a list of projects.
ReturnsA dict mapping project IDs to their default repositories. Projects that do not have default repositories are omitted.
API Documentation for Launchpad, generated by pydoctor at 2022-06-16 00:00:12.