Ggit.Commit

g GObject.Object GObject.Object Ggit.ObjectFactoryBase Ggit.ObjectFactoryBase GObject.Object->Ggit.ObjectFactoryBase Ggit.Commit Ggit.Commit Ggit.Native Ggit.Native Ggit.Object Ggit.Object Ggit.Native->Ggit.Object Ggit.Object->Ggit.Commit Ggit.ObjectFactoryBase->Ggit.Native

Subclasses:

None

Methods

Inherited:

Ggit.Object (2), GObject.Object (37)

Structs:

GObject.ObjectClass (5)

amend (update_ref, author, committer, message_encoding, message, tree)

get_author ()

get_committer ()

get_message ()

get_message_encoding ()

get_nth_ancestor (n)

get_parents ()

get_subject ()

get_tree ()

get_tree_id ()

Virtual Methods

Inherited:

GObject.Object (7)

Properties

Inherited:

Ggit.Native (1)

Signals

Inherited:

GObject.Object (1)

Fields

Inherited:

GObject.Object (1)

Name

Type

Access

Description

parent_instance

Ggit.Object

r

Class Details

class Ggit.Commit(**kwargs)
Bases:

Ggit.Object

Abstract:

No

Structure:

Ggit.CommitClass

Represents a commit object.

amend(update_ref, author, committer, message_encoding, message, tree)
Parameters:
  • update_ref (str or None) – name of the reference to update.

  • author (Ggit.Signature) – author signature.

  • committer (Ggit.Signature) – committer signature (and time of commit).

  • message_encoding (str or None) – message encoding.

  • message (str) – commit message.

  • tree (Ggit.Tree) – the tree of objects to commit.

Raises:

GLib.Error

Returns:

the Ggit.OId of the created commit object, or None in case of an error.

Return type:

Ggit.OId or None

Amend an existing commit. If update_ref is not None, the given reference will be updated to point to the newly created commit. Use “HEAD” to update the HEAD of the current branch and make it point to this commit.

If message_encoding is set to None, “UTF-8” encoding is assumed for the provided message. Note that message will not be cleaned up automatically. You can use Ggit.message_prettify to do this yourself if needed.

get_author()
Returns:

the author of the commit.

Return type:

Ggit.Signature or None

Gets the author of self. The returned value must be free’d with GObject.Object.unref().

get_committer()
Returns:

the committer of the commit.

Return type:

Ggit.Signature or None

Gets the committer of self. The returned value must be free’d with GObject.Object.unref().

get_message()
Returns:

the message of the commit.

Return type:

str or None

Gets the full message of self. The resulting message is always encoded in UTF-8.

get_message_encoding()
Returns:

the encoding of the commit message or None.

Return type:

str or None

Get the encoding for the message of a commit, as a string representing a standard encoding name.

The encoding may be None if the ‘encoding’ header in the commit is missing; in that case UTF-8 is assumed.

get_nth_ancestor(n)
Parameters:

n (int) – the requested ancestor.

Raises:

GLib.Error

Returns:

the n ancestor commit.

Return type:

Ggit.Commit or None

Gets the commit object that is the n-th generation ancestor of the named commit object, following only the first parents. Passing %0 to the n parameter returns another instance of self.

get_parents()
Returns:

the parents collection of the commit.

Return type:

Ggit.CommitParents or None

Gets the parents collection for self.

get_subject()
Returns:

the subject of the commit.

Return type:

str or None

Gets the subject of self. The subject of a commit is the first line of the commit message (as per convention). The resulting subject is always encoded in UTF-8.

get_tree()
Returns:

a Ggit.Tree.

Return type:

Ggit.Tree or None

Get the tree object for self.

get_tree_id()
Returns:

a Ggit.OId.

Return type:

Ggit.OId or None

Get the Ggit.OId of the tree of self. Note that this is more efficient than getting the tree object with Ggit.Commit.get_tree() because no additional files need to be read from disk.