mozhg package¶
Subpackages¶
- mozhg.tests package
- Submodules
- mozhg.tests.auth module
- mozhg.tests.test_auth module
TestAuthTestAuth.p()TestAuth.setUp()TestAuth.tearDown()TestAuth.test_container()TestAuth.test_cookie_empty_db()TestAuth.test_cookie_no_db()TestAuth.test_find_profiles_path()TestAuth.test_get_cookie_multiple_paths()TestAuth.test_get_cookie_no_host()TestAuth.test_get_cookie_simple()TestAuth.test_get_profiles_empty()TestAuth.test_get_profiles_single()TestAuth.test_multiple_profiles_age_ordering()TestAuth.test_multiple_profiles_default_first()
create_cookies_db()create_login_cookie()
- Module contents
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:
objectHolds Bugzilla authentication credentials.
- exception mozhg.auth.NoSQLiteError¶
Bases:
ExceptionRaised 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.
- mozhg.auth.get_bugzilla_login_cookie_from_profile(profile, url)¶
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
requireis True, we abort if Bugzilla credentials could not be found.If
profileis 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:
bugzilla.username and bugzilla.apikey from hgrc
bugzilla.userid and bugzilla.cookie from hgrc
bugzilla.username and bugzilla.password from hgrc
login cookies from Firefox profiles
prompt the user
The
bugzilla.firefoxprofileoption 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.configiteminstance.
- mozhg.auth.win_get_folder_path(folder)¶