mozhg package

Submodules

mozhg.auth module

Shared Mercurial code related to authentication.

class mozhg.auth.BugzillaAuth(userid=None, cookie=None, username=None, password=None, apikey=None)

Bases: object

Holds Bugzilla authentication credentials.

exception mozhg.auth.NoSQLiteError

Bases: exceptions.Exception

Raised when SQLite3 is not available.

mozhg.auth.configureautobmoapikeyauth(ui)

Automatically use Bugzilla API Key auth over HTTP for known services.

Bugzilla credentials are stored in the [bugzilla] section. Mercurial has its own [auth] section for declaring credentials for remotes. This function carries over the [bugzilla] entries to [auth] entries for trusted services.

mozhg.auth.find_profiles_path()

Find the path containing Firefox profiles.

The location of Firefox profiles is OS dependent. This function handles the differences.

Given a Firefox profile path, try to find the login cookies for the given bugzilla URL.

mozhg.auth.get_profiles(profilesdir)

Obtain information about available Firefox profiles.

The Firefox profiles from the specified path will be loaded. A list of dicts describing each profile will be returned. The list is sorted according to profile preference. The default profile is always first.

mozhg.auth.getbugzillaauth(ui, require=False, profile=None)

Obtain Bugzilla authentication credentials from any possible source.

This returns a BugzillaAuth instance on success or None on failure.

If require is True, we abort if Bugzilla credentials could not be found.

If profile is defined, we will only consult the profile having this name. The default behavior is to examine all available profiles.

The order of preference for Bugzilla credentials is as follows:

  1. bugzilla.username and bugzilla.apikey from hgrc
  2. bugzilla.userid and bugzilla.cookie from hgrc
  3. bugzilla.username and bugzilla.password from hgrc
  4. login cookies from Firefox profiles
  5. prompt the user

The bugzilla.firefoxprofile option is interpreted as a list of Firefox profiles from which data should be read. This overrides the default sort order.

mozhg.auth.matching_path_len(cookie_path, url_path)
mozhg.auth.register_config_items(configitem)

Registers config items with Mercurial’s registrar.

The argument is a registrar.configitem instance.

mozhg.auth.win_get_folder_path(folder)

Module contents