l.c.i.b.IBranchLookup(Interface) : interface documentation

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

Utility for looking up a branch by name.
Method get Return the branch with the given id.
Method getByHostingPath Get information about a given codehosting path.
Method getByUniqueName Find a branch by its ~owner/product/name unique name.
Method uriToHostingPath Return the path for the URI, if the URI is on codehosting.
Method getByUrl Find a branch by URL.
Method performLookup Find a branch and trailing path according to params
Method getByUrls Find branches by URL.
Method getByLPPath Find the branch associated with an lp: path.
Method getByPath Find the branch associated with a path.
def get(branch_id, default=None):
Return the branch with the given id.

Return the default value if there is no such branch.

def getByHostingPath(path):
Get information about a given codehosting path.

If the path includes a branch, it is returned. Otherwise, None. The portion of the path following the branch's portion is returned as 'trailing'.

ReturnsA tuple of (branch, trailing).
def getByUniqueName(unique_name):
Find a branch by its ~owner/product/name unique name.

Return None if no match was found.

def uriToHostingPath(uri):
Return the path for the URI, if the URI is on codehosting.

This does not ensure that the path is valid. It recognizes the codehosting URIs of remote branches and mirrors, but not their remote URIs.

ParametersuriAn instance of lazr.uri.URI
ReturnsThe path if possible, None if the URI is not a valid codehosting URI.
def getByUrl(url):
Find a branch by URL.

Either from the external specified in Branch.url, from the URL on http://bazaar.launchpad.net/ or the lp: URL.

Return None if no match was found.

def performLookup(lookup):
Find a branch and trailing path according to params
def getByUrls(urls):
Find branches by URL.
ParametersurlsA list of URLs expressed as strings.
ReturnsA dictionary mapping those URLs to IBranch objects. If there is no branch for a URL, the URL is mapped to None instead.
def getByLPPath(path):
Find the branch associated with an lp: path.

Recognized formats:
"~owner/product/name" (same as unique name)
"distro/series/sourcepackage" (official branch for release pocket of
    the version of a sourcepackage in a distro series)
"distro/series-pocket/sourcepackage" (official branch for the given
    pocket of the version of a sourcepackage in a distro series)
"product/series" (branch associated with a product series)
"product" (development focus of product)

:raises InvalidNamespace: If the path looks like a unique branch name
    but doesn't have enough segments to be a unique name.
:raises InvalidProductName: If the given product in a product
    or product series shortcut is an invalid name for a product.

:raises NoSuchBranch: If we can't find a branch that matches the
    branch component of the path.
:raises NoSuchPerson: If we can't find a person who matches the person
    component of the path.
:raises NoSuchProduct: If we can't find a product that matches the
    product component of the path.
:raises NoSuchDistroSeries: If the distro series component doesn't
    match an existing series.
:raises NoSuchSourcePackageName: If the source packagae referred to
    does not exist.

:raises NoLinkedBranch: If the path refers to an existing thing that's
    not a branch and has no default branch associated with it. For
    example, a product without a development focus branch.
:raises CannotHaveLinkedBranch: If the path refers to an existing
    thing that cannot have a linked branch associated with it. For
    example, a distribution.

:return: a tuple of (`IBranch`, extra_path). 'extra_path' is used to
    make things like 'bzr cat lp:~foo/bar/baz/README' work. Trailing
    paths are not handled for shortcut paths.
def getByPath(path):
Find the branch associated with a path.

As with getByLPPath, but returns None instead of raising any of the documented exceptions, and returns only the IBranch on success and not any extra path.

API Documentation for Launchpad, generated by pydoctor at 2019-02-22 00:00:05.