Module RevWalk

Class "RevWalk".

Functions

RevWalk.new (repo) Create a new RevWalk object.
RevWalk:close () Destroy this object (will be called by Garbage Collector).
RevWalk:hide (id) object method.
RevWalk:next () object method.
RevWalk:push (id) object method.
RevWalk:repository () object method.
RevWalk:reset () object method.
RevWalk:sorting (sort_mode) object method.


Functions

RevWalk.new (repo)
Create a new RevWalk object.

Calls git_revwalk_new:

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

  • repo: the repo to walk through. Must be of type Repository.

Return values:

  1. RevWalk or nil on error.
  2. Error string.
RevWalk:close ()
Destroy this object (will be called by Garbage Collector).

Calls git_revwalk_free:

RevWalk:hide (id)
object method.

Calls git_revwalk_hide:

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

  • id: Must be of type OID.

Return values:

  1. true if no error.
  2. Error string.
RevWalk:next ()
object method.

Calls git_revwalk_next:

The initial call to this method is *not* blocking when iterating through a repo 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.

Return values:

  1. OID or nil on error.
  2. Error string.
RevWalk:push (id)
object method.

Calls git_revwalk_push:

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

  • id: Must be of type OID.

Return values:

  1. true if no error.
  2. Error string.
RevWalk:repository ()
object method.

Calls git_revwalk_repository:

Return value:

Repository.
RevWalk:reset ()
object method.

Calls git_revwalk_reset:

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.

RevWalk:sorting (sort_mode)
object method.

Calls git_revwalk_sorting:

Changing the sorting mode resets the walker.

Parameters

  • sort_mode: combination of GIT_SORT_XXX flags. Must be of type integer.

Valid XHTML 1.0!