Foundry.GitCommitBuilder¶
- Subclasses:
None
Methods¶
- Inherited:
- Structs:
class |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Virtual Methods¶
- Inherited:
Properties¶
Name |
Type |
Flags |
Short Description |
|---|---|---|---|
r/w/en |
|||
r/w/en |
|||
r |
|||
r/w/en |
|||
r/w/en |
|||
r/w/en |
|||
r |
|||
r |
|||
r |
|||
r/w/en |
Signals¶
- Inherited:
Fields¶
- Inherited:
Class Details¶
- class Foundry.GitCommitBuilder(**kwargs)¶
- Bases:
- Abstract:
No
- Structure:
- classmethod new(vcs, parent, context_lines)¶
- Parameters:
vcs (
Foundry.GitVcs) – a [class`Foundry`.GitVcs]parent (
Foundry.GitCommitorNone) – a [class`Foundry`.GitCommit]context_lines (
int) – the number of context lines to use for diffs or 0 for default
- Returns:
a [class`Dex`.Future] that resolves to a [class`Foundry`.GitCommitBuilder].
- Return type:
Creates a new builder using parent as the parent commit.
If parent is
None, then the last commit on the current branch will be used as the parent.The context_lines parameter controls how many lines of context are included around each change in the diff. The default is 3 lines.
New in version 1.1.
- commit()¶
- Returns:
a [class`Dex`.Future] that resolves to a [class`Foundry`.GitCommit] or rejects with error
- Return type:
Creates a commit using the fields from the builder.
New in version 1.1.
- dup_author_email()¶
- Returns:
the author email, or
Noneif not set. The caller should free the returned string withGLib.free() when done.- Return type:
Gets the author email address that will be used for the commit.
New in version 1.1.
- dup_author_name()¶
- Returns:
the author name, or
Noneif not set. The caller should free the returned string withGLib.free() when done.- Return type:
Gets the author name that will be used for the commit.
New in version 1.1.
- dup_message()¶
- Returns:
the commit message, or
Noneif not set. The caller should free the returned string withGLib.free() when done.- Return type:
Gets the commit message that will be used for the commit.
New in version 1.1.
- dup_signing_format()¶
- Returns:
the signing format (e.g. “gpg” or “ssh”), or
Noneif not set. The caller should free the returned string withGLib.free() when done.- Return type:
Gets the signing format that will be used for signing the commit.
New in version 1.1.
- dup_signing_key()¶
- Returns:
the signing key identifier, or
Noneif not set. The caller should free the returned string withGLib.free() when done.- Return type:
Gets the signing key identifier that will be used for signing the commit.
New in version 1.1.
- dup_when()¶
- Returns:
a [struct`GLib`.DateTime] representing the commit timestamp, or
Noneif not set. The caller should free the returned object withGLib.DateTime.unref() when done.- Return type:
Gets the timestamp that will be used for the commit.
New in version 1.1.
- get_can_commit()¶
-
Checks whether the builder has sufficient information to create a commit.
Returns
Trueif both a non-empty commit message and at least one staged file are present. ReturnsFalseotherwise.New in version 1.1.
- is_untracked(file)¶
- Parameters:
file (
Gio.File) – a [iface`Gio`.File] to check- Returns:
Trueif file was untracked when the builder was created,Falseotherwise- Return type:
Checks whether file was untracked when the commit builder was created.
This method checks if the file was in the untracked files list at the time the commit builder was initialized. Note that this reflects the state when the builder was created, not the current git status.
New in version 1.1.
- list_staged()¶
- Returns:
a [iface`Gio`.ListModel] of [class`Foundry`.GitStatusEntry] objects representing staged files
- Return type:
Gets a list model containing all files that are currently staged for commit.
The list model contains [class`Foundry`.GitStatusEntry] objects representing files in the working tree that have been staged. The list is updated automatically as files are staged or unstaged.
New in version 1.1.
- list_unstaged()¶
- Returns:
a [iface`Gio`.ListModel] of [class`Foundry`.GitStatusEntry] objects representing files with unstaged changes
- Return type:
Gets a list model containing all files that have unstaged changes.
The list model contains [class`Foundry`.GitStatusEntry] objects representing files in the working tree that have been modified but not staged. The list is updated automatically as files are staged or unstaged.
New in version 1.1.
- list_untracked()¶
- Returns:
a [iface`Gio`.ListModel] of [class`Foundry`.GitStatusEntry] objects representing untracked files
- Return type:
Gets a list model containing all untracked files in the working tree.
The list model contains [class`Foundry`.GitStatusEntry] objects representing files in the working tree that are not tracked by git. The list is updated automatically as files are staged or untracked files are added.
New in version 1.1.
- load_staged_delta(file)¶
- Parameters:
file (
Gio.File) – a [iface`Gio`.File] in the working tree- Returns:
a [class`Dex`.Future] that resolves to a [class`Foundry`.GitDelta] or rejects with error.
- Return type:
Loads the delta for file comparing the index against the parent commit. This delta represents staged changes and can be used to toggle individual lines on/off for staging in the background.
New in version 1.1.
- load_unstaged_delta(file)¶
- Parameters:
file (
Gio.File) – a [iface`Gio`.File] in the working tree- Returns:
a [class`Dex`.Future] that resolves to a [class`Foundry`.GitDelta] or rejects with error.
- Return type:
Loads the delta for file comparing the working directory against the index. This delta represents unstaged changes and can be used to toggle individual lines on/off for staging in the background.
New in version 1.1.
- load_untracked_delta(file)¶
- Parameters:
file (
Gio.File) – a [iface`Gio`.File] in the working tree- Returns:
a [class`Dex`.Future] that resolves to a [class`Foundry`.GitDelta] or rejects with error.
- Return type:
Loads the delta for an untracked file. This creates a synthetic delta that represents adding the entire file, allowing the same API semantics for new files as for modified files. The delta can be used to toggle individual lines on/off for staging in the background.
The file must be untracked (not in git’s index) when the commit builder was created. Since untracked files are new files, the delta will contain a single hunk with all lines marked as additions.
New in version 1.1.
- new_similar()¶
- Returns:
a [class`Dex`.Future] that resolves to a [class`Foundry`.GitCommitBuilder].
- Return type:
Creates a new builder similar to self, copying all string and
GLib.DateTimeproperties from the existing builder.The new builder will use the same VCS instance, parent commit (or HEAD if no parent was set), context lines, author name, author email, signing key, signing format, and timestamp as self.
New in version 1.1.
- set_author_email(author_email)¶
-
Sets the author email address that will be used for the commit.
If set to
Noneor not set, the value from git config “user.email” will be used when creating the commit.New in version 1.1.
- set_author_name(author_name)¶
-
Sets the author name that will be used for the commit.
If set to
Noneor not set, the value from git config “user.name” will be used when creating the commit.New in version 1.1.
- set_message(message)¶
-
Sets the commit message that will be used for the commit.
This must be set to a non-empty string before a commit can be created. Setting this will automatically update the [property`Foundry`.GitCommitBuilder:can-commit] property.
New in version 1.1.
- set_signing_format(signing_format)¶
- Parameters:
signing_format (
strorNone) – the signing format to use (e.g. “gpg” or “ssh”), orNonefor default
Sets the signing format that will be used for signing the commit.
Common values are “gpg” for GPG signatures or “ssh” for SSH signatures. If set to
None, defaults to “gpg”.New in version 1.1.
- set_signing_key(signing_key)¶
- Parameters:
signing_key (
strorNone) – the signing key identifier to use, orNoneto disable signing
Sets the signing key identifier that will be used for signing the commit.
If set, the commit will be signed using the specified key and the signing format. If set to
None, the commit will not be signed.New in version 1.1.
- set_when(when)¶
- Parameters:
when (
GLib.DateTimeorNone) – the timestamp to use for the commit, orNoneto use current time
Sets the timestamp that will be used for the commit.
If set to
Noneor not set, the current time will be used when creating the commit. The builder takes ownership of when.New in version 1.1.
- stage_file(file)¶
- Parameters:
file (
Gio.File) – a [iface`Gio`.File] in the working tree- Returns:
a [class`Dex`.Future] that resolves to any value or rejects with error
- Return type:
Stages the file using the version from the stored diff/delta. This stages the fully applied version (all changes from the delta).
New in version 1.1.
- stage_hunks(file, hunks)¶
- Parameters:
file (
Gio.File) – a [iface`Gio`.File] in the working treehunks (
Gio.ListModel) – a [iface`Gio`.ListModel] of [class`Foundry`.GitDiffHunk]
- Returns:
a [class`Dex`.Future] that resolves to any value or rejects with error
- Return type:
Stages the selected hunks from the file.
New in version 1.1.
- stage_lines(file, lines)¶
- Parameters:
file (
Gio.File) – a [iface`Gio`.File] in the working treelines (
Gio.ListModel) – a [iface`Gio`.ListModel] of [class`Foundry`.GitDiffLine]
- Returns:
a [class`Dex`.Future] that resolves to any value or rejects with error
- Return type:
Stages the selected lines from the file.
New in version 1.1.
- unstage_file(file)¶
- Parameters:
file (
Gio.File) – a [iface`Gio`.File] in the working tree- Returns:
a [class`Dex`.Future] that resolves to any value or rejects with error
- Return type:
Unstages the file using the version from the stored diff/delta. This restores the file to the fully unapplied version (HEAD version).
New in version 1.1.
- unstage_hunks(file, hunks)¶
- Parameters:
file (
Gio.File) – a [iface`Gio`.File] in the working treehunks (
Gio.ListModel) – a [iface`Gio`.ListModel] of [class`Foundry`.GitDiffHunk]
- Returns:
a [class`Dex`.Future] that resolves to any value or rejects with error
- Return type:
Unstages the selected hunks from the file.
New in version 1.1.
- unstage_lines(file, lines)¶
- Parameters:
file (
Gio.File) – a [iface`Gio`.File] in the working treelines (
Gio.ListModel) – a [iface`Gio`.ListModel] of [class`Foundry`.GitDiffLine]
- Returns:
a [class`Dex`.Future] that resolves to any value or rejects with error
- Return type:
Unstages the selected lines from the file.
New in version 1.1.
Property Details¶
- Foundry.GitCommitBuilder.props.author_email¶
- Name:
author-email- Type:
- Default Value:
- Flags:
The email address of the commit author.
If not set, the value from git config “user.email” will be used when creating the commit.
- Foundry.GitCommitBuilder.props.author_name¶
- Name:
author-name- Type:
- Default Value:
- Flags:
The name of the commit author.
If not set, the value from git config “user.name” will be used when creating the commit.
- Foundry.GitCommitBuilder.props.can_commit¶
-
Whether the builder has sufficient information to create a commit.
This property is
Truewhen both a non-empty commit message and at least one staged file are present. It is read-only and will be updated automatically as files are staged or unstaged and as the message changes.
- Foundry.GitCommitBuilder.props.message¶
- Name:
message- Type:
- Default Value:
- Flags:
The commit message.
This must be set to a non-empty string before a commit can be created.
- Foundry.GitCommitBuilder.props.signing_format¶
- Name:
signing-format- Type:
- Default Value:
'gpg'- Flags:
The format to use for signing commits.
Common values are “gpg” for GPG signatures or “ssh” for SSH signatures. Defaults to “gpg” if not set.
- Foundry.GitCommitBuilder.props.signing_key¶
- Name:
signing-key- Type:
- Default Value:
- Flags:
The key identifier to use for signing the commit.
If set, the commit will be signed using the specified key and the signing format. If not set, the commit will not be signed.
- Foundry.GitCommitBuilder.props.staged¶
- Name:
staged- Type:
- Default Value:
- Flags:
A list model containing all files that are currently staged for commit.
The list model contains [class`Foundry`.GitStatusEntry] objects representing files in the working tree that have been staged. The list is updated automatically as files are staged or unstaged.
- Foundry.GitCommitBuilder.props.unstaged¶
- Name:
unstaged- Type:
- Default Value:
- Flags:
A list model containing all files that have unstaged changes.
The list model contains [class`Foundry`.GitStatusEntry] objects representing files in the working tree that have been modified but not staged. The list is updated automatically as files are staged or unstaged.
- Foundry.GitCommitBuilder.props.untracked¶
- Name:
untracked- Type:
- Default Value:
- Flags:
A list model containing all untracked files in the working tree.
The list model contains [class`Foundry`.GitStatusEntry] objects representing files in the working tree that are not tracked by git. The list is updated automatically as files are staged or untracked files are added.
- Foundry.GitCommitBuilder.props.when¶
- Name:
when- Type:
- Default Value:
- Flags:
The timestamp for the commit.
If not set, the current time will be used when creating the commit.