Ggit.Config¶
- Subclasses:
None
Methods¶
- Inherited:
- Structs:
class |
|
class |
|
class |
|
class |
|
class |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Virtual Methods¶
- Inherited:
Properties¶
- Inherited:
Signals¶
- Inherited:
Fields¶
- Inherited:
Class Details¶
- class Ggit.Config(**kwargs)¶
- Bases:
- Abstract:
No
- Structure:
Represents a git configuration.
- classmethod find_global()¶
-
Find the file representing the users global git configuration. This file is usually located at $HOME/.gitconfig. This function will try to guess the full path to that file, if the file exists. The returned file may then be used with
Ggit.Config.new_from_file
orGgit.Config.add_file
. This function returnsNone
if the global config could not be found.
- classmethod find_system()¶
-
Find the file representing the systems global git configuration. This file is usually located at /etc/gitconfig on UNIX type systems or %PROGRAMFILES%\Git\etc\gitconfig on windows. This function will try to guess the full path to that file, if the file exists. The returned file may then be used with
Ggit.Config.new_from_file
orGgit.Config.add_file
. This function returnsNone
if the system config could not be found.
- classmethod new()¶
- Returns:
a
Ggit.Config
.- Return type:
Create a new config. See also ggit_config_get_default() to get a
Ggit.Config
representing the global, XDG and system configuration files. To get aGgit.Config
for a repository useGgit.Repository.get_config
instead.
- classmethod new_default()¶
- Raises:
- Returns:
- Return type:
Get the global, XDG and system configuration files merged into one
Ggit.Config
with their appropriate priority levels. If an error occured trying to load the various configuration files, this function will returnNone
and error will be set accordingly.
- classmethod new_from_file(file)¶
- Parameters:
file (
Gio.File
) – the file to load.- Raises:
- Returns:
a
Ggit.Config
.- Return type:
Create a new config from a single on disk file. This is a convenience API and is exactly the same as creating an empty
Ggit.Config
usingGgit.Config.new
and adding the file withGgit.Config.add_file
. The level will be set toGgit.ConfigLevel.LOCAL
. If the config could not be loaded this function returnsNone
and error will be set accordingly.
- add_file(file, level, force)¶
- Parameters:
level (
Ggit.ConfigLevel
) – aGgit.ConfigLevel
.force (
bool
) – if a config file already exists for the given priority level, replace it.
- Raises:
Add an on-disk config file instance to an existing config
The on-disk file pointed at by file will be opened and parsed; it’s expected to be a native Git config file following the default Git config syntax (see man git-config).
Further queries on this config object will access each of the config file instances in order (instances with a higher priority level will be accessed first).
- delete_entry(name)¶
- Parameters:
name (
str
) – the configuration value.- Raises:
- Returns:
True
if the configuration value was deleted,False
otherwise.- Return type:
Delete a config variable from the config file.
- foreach(callback, *user_data)¶
- Parameters:
callback (
Ggit.ConfigCallback
) – aGgit.ConfigCallback
.
- Raises:
- Returns:
- Return type:
Call callback for each configuration value.
- get_bool(name)¶
- Parameters:
name (
str
) – the name of the configuration value.- Raises:
- Returns:
the value.
- Return type:
Get a boolean configuration value.
- get_entry(name)¶
- Parameters:
name (
str
) – the configuration name.- Raises:
- Returns:
the entry of name, or
None
if such a value does not exist.- Return type:
Get
Ggit.ConfigEntry
of a config variable.
- get_int32(name)¶
- Parameters:
name (
str
) – the name of the configuration value.- Raises:
- Returns:
the value.
- Return type:
Get a int32 configuration value.
- get_int64(name)¶
- Parameters:
name (
str
) – the name of the configuration value.- Raises:
- Returns:
the value.
- Return type:
Get a int64 configuration value.
- get_string(name)¶
- Parameters:
name (
str
) – the name of the configuration value.- Raises:
- Returns:
the string value of name, or
None
if such a value does not exist- Return type:
Get the configuration value of name as string.
- match(regex)¶
- Parameters:
regex (
GLib.Regex
) – aGLib.Regex
.- Raises:
- Returns:
the value of that matched configuration
- match_info:
- Return type:
(
str
orNone
, match_info:GLib.MatchInfo
)
Matches a configuration against a regular expression. match_info will contain the match information if the return value is not
None
, otherwise error will be set.
- match_foreach(regex, callback, *user_data)¶
- Parameters:
regex (
GLib.Regex
) – aGLib.Regex
.callback (
Ggit.ConfigMatchCallback
) – aGgit.ConfigMatchCallback
.
- Raises:
- Returns:
- Return type:
Call callback for all configurations matching regex.
- open_level(level)¶
- Parameters:
level (
Ggit.ConfigLevel
) – the level to open.- Raises:
- Returns:
the configuration at level, or
None
.- Return type:
Open a specific level config derived from a multi-level one.
- set_bool(name, value)¶
- Parameters:
- Raises:
- Returns:
- Return type:
Set a boolean value.
- set_int32(name, value)¶
- Parameters:
- Raises:
- Returns:
- Return type:
Set a int32 value.
- set_int64(name, value)¶
- Parameters:
- Raises:
- Returns:
- Return type:
Set a int64 value.
- set_string(name, value)¶
- Parameters:
- Raises:
- Returns:
- Return type:
Set a new string value of a configuration.
- snapshot()¶
- Raises:
- Returns:
a new
Ggit.Config
, orNone
if an error occurred.- Return type:
Create a snapshot of the current state of the configuration, which allows you to look into a consistent view of the configuration for looking up complex values (e.g. a remote, submodule).