Ggit.RevisionWalker

g GObject.GInterface GObject.GInterface Gio.Initable Gio.Initable GObject.GInterface->Gio.Initable GObject.Object GObject.Object Ggit.ObjectFactoryBase Ggit.ObjectFactoryBase GObject.Object->Ggit.ObjectFactoryBase Ggit.Native Ggit.Native Ggit.RevisionWalker Ggit.RevisionWalker Ggit.Native->Ggit.RevisionWalker Ggit.ObjectFactoryBase->Ggit.Native Gio.Initable->Ggit.RevisionWalker

Subclasses:

None

Methods

Inherited:

GObject.Object (37), Gio.Initable (2)

Structs:

GObject.ObjectClass (5)

class

new (repository)

get_repository ()

hide (oid)

hide_glob (item)

hide_head ()

hide_ref (item)

next ()

push (oid)

push_glob (item)

push_head ()

push_range (range)

push_ref (item)

reset ()

set_sort_mode (sort_mode)

Virtual Methods

Inherited:

GObject.Object (7), Gio.Initable (1)

Properties

Inherited:

Ggit.Native (1)

Name

Type

Flags

Short Description

repository

Ggit.Repository

r/w/c

The repository where to make the walking

Signals

Inherited:

GObject.Object (1)

Fields

Inherited:

GObject.Object (1)

Name

Type

Access

Description

parent_instance

Ggit.Native

r

Class Details

class Ggit.RevisionWalker(**kwargs)
Bases:

Ggit.Native, Gio.Initable

Abstract:

No

Structure:

Ggit.RevisionWalkerClass

Represents a revision walker.

classmethod new(repository)
Parameters:

repository (Ggit.Repository) – a Ggit.Repository.

Raises:

GLib.Error

Returns:

a new Ggit.RevisionWalker or None.

Return type:

Ggit.RevisionWalker or None

Creates a new revision walker to iterate through repository.

This revision walker uses a custom memory pool and an internal commit cache, so it is relatively expensive to allocate.

For maximum performance, this revision walker should be reused for different walks.

This revision walker is *not* thread safe: it may only be used to walk a repository on a single thread; however, it is possible to have several revision walkers in several different threads walking the same repository.

get_repository()
Returns:

the repository on which this walker is operating or None.

Return type:

Ggit.Repository or None

Gets the repository on which this walker is operating.

hide(oid)
Parameters:

oid (Ggit.OId) – a Ggit.OId.

Raises:

GLib.Error

Marks a commit (and its ancestors) uninteresting for the output.

The given OID must belong to a commit on the walked repository.

The resolved commit and all its parents will be hidden from the output on the revision walk.

hide_glob(item)
Parameters:

item (str) – the glob to hide.

Raises:

GLib.Error

Hide all OIDs pointed to by references that match the given glob pattern to the revsision walker. A leading ‘refs/’ is implied if not present, as well as a trailing ‘/ \ *’ if the glob lacks ‘?’, ‘\ *’ or ‘[‘.

hide_head()
Raises:

GLib.Error

Hide the OID of the current HEAD to the revision walker.

hide_ref(item)
Parameters:

item (str) – the reference to hide.

Raises:

GLib.Error

Hide the OID pointed to by the named reference to the revision walker.

next()
Raises:

GLib.Error

Returns:

the next commit from the revision walk or None.

Return type:

Ggit.OId or None

Gets the next commit from the revision walk.

The initial call to this method is *not* blocking when iterating through a repository with a time-sorting mode.

Iterating with Topological or inverted modes makes the initial call blocking to preprocess the commit list, but this block should be mostly unnoticeable on most repositories (topological preprocessing times at 0.3s on the git.git repo).

The revision walker is reset when the walk is over.

push(oid)
Parameters:

oid (Ggit.OId) – a Ggit.OId.

Raises:

GLib.Error

Marks a commit to start traversal from.

The given OID must belong to a commit on the walked repository.

The given commit will be used as one of the roots when starting the revision walk. At least one commit must be pushed the repository before a walk can be started.

push_glob(item)
Parameters:

item (str) – the glob to push.

Raises:

GLib.Error

Push all OIDs pointed to by references that match the given glob pattern to the revsision walker. A leading ‘refs/’ is implied if not present, as well as a trailing ‘/ \ *’ if the glob lacks ‘?’, ‘\ *’ or ‘[‘.

push_head()
Raises:

GLib.Error

Push the OID of the current HEAD to the revision walker.

push_range(range)
Parameters:

range (str) – the range to push.

Raises:

GLib.Error

Push and hide the respective endpoints of the given range. The range should be of the form: &ltcommit&gt..<commit>, where each <commit> is in the form accepted by revparse. The left-hand commit will be hidden and the right-hand commit pushed.

push_ref(item)
Parameters:

item (str) – the reference to push.

Raises:

GLib.Error

Push the OID pointed to by the named reference to the revision walker.

reset()

Resets the revision walker for reuse.

This will clear all the pushed and hidden commits, and leave the walker in a blank state (just like at creation) ready to receive new commit pushes and start a new walk.

The revision walk is automatically reset when a walk is over.

set_sort_mode(sort_mode)
Parameters:

sort_mode (Ggit.SortMode) – a Ggit.SortMode value.

Change the sorting mode when iterating through the repository’s contents.

Changing the sorting mode resets the walker.

Property Details

Ggit.RevisionWalker.props.repository
Name:

repository

Type:

Ggit.Repository

Default Value:

None

Flags:

READABLE, WRITABLE, CONSTRUCT

The repository where to make the walking