Ggit.Ref¶
| Subclasses: | Ggit.Branch | 
|---|
Methods¶
| Inherited: | GObject.Object (37) | 
|---|---|
| Structs: | GObject.ObjectClass (5) | 
| class | is_valid_name(name) | 
| delete() | |
| delete_log() | |
| get_log() | |
| get_name() | |
| get_owner() | |
| get_reference_type() | |
| get_shorthand() | |
| get_symbolic_target() | |
| get_target() | |
| has_log() | |
| is_branch() | |
| is_note() | |
| is_remote() | |
| is_tag() | |
| lookup() | |
| rename(new_name, force, log_message) | |
| resolve() | |
| set_symbolic_target(target, log_message) | |
| set_target(oid, log_message) | |
| to_string() | 
Virtual Methods¶
| Inherited: | GObject.Object (7) | 
|---|
Properties¶
| Inherited: | Ggit.Native (1) | 
|---|
Signals¶
| Inherited: | GObject.Object (1) | 
|---|
Class Details¶
- 
class Ggit.Ref(**kwargs)¶
- Bases: - Ggit.Native- Abstract: - No - Structure: - Ggit.RefClass- Reprensents a git reference. - 
classmethod is_valid_name(name)¶
- Parameters: - name ( - str) – the name to validate.- Returns: - Trueif name is valid,- Falseotherwise.- Return type: - bool- Check if the given name is a valid name for a reference. Note that name should be the full ref name (including prefixes). - Valid toplevel names can contain only capital letters and underscores and must start and end with a letter (e.g. HEAD, ORIG_HEAD). - Valid refs/ names may contain any characters, except ‘~’, ‘^’, ‘:’, ‘', ‘?’, ‘[’, ‘*’, “..” and “@{”, because they are interpreted by revparse. 
 - 
delete()¶
- Raises: - GLib.Error- Deletes self. - This method works for both direct and symbolic references. - The reference will be immediately removed on disk and from memory. The given reference pointer will no longer be valid. 
 - 
delete_log()¶
- Raises: - GLib.Error- Deletes the log for self, on error error is set. 
 - 
get_log()¶
- Raises: - GLib.Error- Returns: - the reflog or - None.- Return type: - Ggit.Reflogor- None- Gets the - Ggit.Reflogfor self. The reflog will be created if it doesn’t exist yet.
 - 
get_name()¶
- Returns: - the full name of a reference or - None.- Return type: - stror- None- Gets the full name of self. 
 - 
get_owner()¶
- Returns: - the repository where a reference resides or - None.- Return type: - Ggit.Repositoryor- None- Gets the repository where self resides. 
 - 
get_reference_type()¶
- Returns: - the type of a reference. - Return type: - Ggit.RefType- Gets the type of self. Either direct ( - Ggit.RefType.OID) or symbolic (- Ggit.RefType.SYMBOLIC).
 - 
get_shorthand()¶
- Returns: - the shorthand name of a reference or - None.- Return type: - stror- None- Gets the shorthand name of self. 
 - 
get_symbolic_target()¶
- Returns: - the name if available, - Noneotherwise.- Return type: - stror- None- Get full name to the reference pointed to by a symbolic reference. Only available if the reference is symbolic. 
 - 
get_target()¶
- Returns: - a new oid if available, - Noneotherwise.- Return type: - Ggit.OIdor- None- Get the OID pointed to by a direct reference. Only available if the reference is direct (i.e. an object id reference, not a symbolic one). 
 - 
has_log()¶
- Returns: - Trueif self has a log,- Falseotherwise.- Return type: - bool- Get whether self has an existing log. 
 - 
is_branch()¶
- Returns: - Trueif the reference is a branch,- Falseotherwise.- Return type: - bool- Check whether the reference is a branch. 
 - 
is_note()¶
- Returns: - Trueif the reference is a note,- Falseotherwise.- Return type: - bool- Check whether the reference is a note. 
 - 
is_remote()¶
- Returns: - Trueif the reference is a remote,- Falseotherwise.- Return type: - bool- Check whether the reference is a remote. 
 - 
is_tag()¶
- Returns: - Trueif the reference is a tag,- Falseotherwise.- Return type: - bool- Check whether the reference is a tag. 
 - 
lookup()¶
- Raises: - GLib.Error- Returns: - a - Ggit.Objector- None.- Return type: - Ggit.Objector- None- Convenient method to resolve a reference to an object. 
 - 
rename(new_name, force, log_message)¶
- Parameters: - Raises: - Returns: - Return type: - Rename an existing reference. - This method works for both direct and symbolic references. - The new name will be checked for validity. See - ggit_ref_create_symbolic()for rules about valid names.- If not error, self will be deleted from disk and a new - Ggit.Refwill be returned.- The reference will be immediately renamed in-memory and on disk. - If the - forceflag is not enabled, and there’s already a reference with the given name, the renaming will fail.- IMPORTANT: The user needs to write a proper reflog entry if the reflog is enabled for the repository. We only rename the reflog if it exists. 
 - 
resolve()¶
- Raises: - GLib.Error- Returns: - the resolved reference to the peeled one or - None.- Return type: - Ggit.Refor- None- Resolves a symbolic reference. - This method iteratively peels a symbolic reference until it resolves to a direct reference to an OID. - If a direct reference is passed as an argument, that reference is returned immediately. 
 - 
set_symbolic_target(target, log_message)¶
- Parameters: - Raises: - Returns: - Return type: - Create a new reference with the same name as the given reference but a different symbolic target. The reference must be a symbolic reference, otherwise this will fail. - The new reference will be written to disk, overwriting the given reference. - The target name will be checked for validity. See - ggit_ref_create_symbolic()for rules about valid names.
 - 
set_target(oid, log_message)¶
- Parameters: - Raises: - Returns: - Return type: - Create a new reference with the same name as the given reference but a different OID target. The reference must be a direct reference, otherwise this will fail. - The new reference will be written to disk, overwriting the given reference. 
 
- 
classmethod