GgitRevisionWalker

GgitRevisionWalker

Properties

GgitRepository * repository Read / Write / Construct

Types and Values

Object Hierarchy

    GObject
    ╰── GgitObjectFactoryBase
        ╰── GgitNative
            ╰── GgitRevisionWalker

Implemented Interfaces

GgitRevisionWalker implements GInitable.

Description

Functions

ggit_revision_walker_new ()

GgitRevisionWalker *
ggit_revision_walker_new (GgitRepository *repository,
                          GError **error);

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.

Parameters

repository

a GgitRepository.

 

error

a GError for error reporting, or NULL.

 

Returns

a new GgitRevisionWalker.

[transfer full]


ggit_revision_walker_reset ()

void
ggit_revision_walker_reset (GgitRevisionWalker *walker);

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.

Parameters

walker

a GgitRevisionWalker.

 

ggit_revision_walker_push ()

void
ggit_revision_walker_push (GgitRevisionWalker *walker,
                           GgitOId *oid,
                           GError **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.

Parameters

walker

a GgitRevisionWalker.

 

oid

a GgitOId.

 

error

a GError for error reporting, or NULL.

 

ggit_revision_walker_hide ()

void
ggit_revision_walker_hide (GgitRevisionWalker *walker,
                           GgitOId *oid,
                           GError **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.

Parameters

walker

a GgitRevisionWalker.

 

oid

a GgitOId.

 

error

a GError for error reporting, or NULL.

 

ggit_revision_walker_hide_glob ()

void
ggit_revision_walker_hide_glob (GgitRevisionWalker *walker,
                                const gchar *item,
                                GError **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 '['.

Parameters

walker

a GgitRevisionWalker.

 

item

the glob to hide.

 

error

a GError.

 

ggit_revision_walker_hide_head ()

void
ggit_revision_walker_hide_head (GgitRevisionWalker *walker,
                                GError **error);

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

Parameters

walker

a GgitRevisionWalker.

 

error

a GError.

 

ggit_revision_walker_hide_ref ()

void
ggit_revision_walker_hide_ref (GgitRevisionWalker *walker,
                               const gchar *item,
                               GError **error);

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

Parameters

walker

a GgitRevisionWalker.

 

item

the reference to hide.

 

error

a GError.

 

ggit_revision_walker_push_glob ()

void
ggit_revision_walker_push_glob (GgitRevisionWalker *walker,
                                const gchar *item,
                                GError **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 '['.

Parameters

walker

a GgitRevisionWalker.

 

item

the glob to push.

 

error

a GError.

 

ggit_revision_walker_push_head ()

void
ggit_revision_walker_push_head (GgitRevisionWalker *walker,
                                GError **error);

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

Parameters

walker

a GgitRevisionWalker.

 

error

a GError.

 

ggit_revision_walker_push_range ()

void
ggit_revision_walker_push_range (GgitRevisionWalker *walker,
                                 const gchar *range,
                                 GError **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.

Parameters

walker

a GgitRevisionWalker.

 

range

the range to push.

 

error

a GError.

 

ggit_revision_walker_push_ref ()

void
ggit_revision_walker_push_ref (GgitRevisionWalker *walker,
                               const gchar *item,
                               GError **error);

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

Parameters

walker

a GgitRevisionWalker.

 

item

the reference to push.

 

error

a GError.

 

ggit_revision_walker_next ()

GgitOId *
ggit_revision_walker_next (GgitRevisionWalker *walker,
                           GError **error);

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.

Parameters

walker

a GgitRevisionWalker.

 

error

a GError for error reporting, or NULL.

 

Returns

the next commit from the revision walk.

[transfer full]


ggit_revision_walker_set_sort_mode ()

void
ggit_revision_walker_set_sort_mode (GgitRevisionWalker *walker,
                                    GgitSortMode sort_mode);

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

Changing the sorting mode resets the walker.

Parameters

walker

a GgitRevisionWalker.

 

sort_mode

a GgitSortMode value.

 

ggit_revision_walker_get_repository ()

GgitRepository *
ggit_revision_walker_get_repository (GgitRevisionWalker *walker);

Gets the repository on which this walker is operating.

Parameters

walker

a GgitRepository.

 

Returns

the repository on which this walker is operating.

[transfer none]

Types and Values

GgitRevisionWalker

typedef struct _GgitRevisionWalker GgitRevisionWalker;

Represents a revision walker.


struct GgitRevisionWalkerClass

struct GgitRevisionWalkerClass {
};

The class structure for GgitRevisionWalkerClass.

Members


enum GgitSortMode

The type of sorting mode for the revision walker.

Members

GGIT_SORT_NONE

Sorts the repository contents in no particular ordering; this sorting is arbitrary, implementation-specific and subject to change at any time.

 

GGIT_SORT_TOPOLOGICAL

Sorts the repository contents in topological order (parents before children); this sorting mode can be combined with time sorting.

 

GGIT_SORT_TIME

Sort the repository contents by commit time; this sorting mode can be combined with topological sorting.

 

GGIT_SORT_REVERSE

Iterate through the repository contents in reverse order; this sorting mode can be combined with any of the above.

 

Property Details

The “repository” property

  “repository”               GgitRepository *

The repository where to make the walking.

Flags: Read / Write / Construct