layout
default
menu_item
api
title
Revwalk
description
Version 0.5.0
return_to
API Documentation Index
/api/
sections
create
#getCommits
#getCommitsUntil
#hide
#hideGlob
#hideHead
#hideRef
#next
#push
#pushGlob
#pushHead
#pushRange
#pushRef
#repository
#reset
#simplifyFirstParent
#sorting
#walk
SORT
#create
#getCommits
#getCommitsUntil
#hide
#hideGlob
#hideHead
#hideRef
#next
#push
#pushGlob
#pushHead
#pushRange
#pushRef
#repository
#reset
#simplifyFirstParent
#sorting
#walk
#SORT
var revwalk = Revwalk . create ( repo ) ;
Parameters
Type
repo
Repository
the repo to walk through
var arrayCommit = revwalk . getCommits ( count ) ;
Get a number of commits.
| Parameters | Type |
| --- | --- | --- |
| count | Number | (default: 10) |
Revwalk# getCommitsUntil Sync
var array = revwalk . getCommitsUntil ( checkFn ) ;
Walk the history grabbing commits until the checkFn called with the
current commit returns false.
| Parameters | Type |
| --- | --- | --- |
| checkFn | Function | function returns false to stop walking |
var result = revwalk . hide ( commit_id ) ;
| Parameters | Type |
| --- | --- | --- |
| commit_id | Oid | the oid of commit that will be ignored during the traversal |
Returns
Number
0 or an error code
var result = revwalk . hideGlob ( glob ) ;
| Parameters | Type |
| --- | --- | --- |
| glob | String | the glob pattern references should match |
Returns
Number
0 or an error code
var result = revwalk . hideHead ( ) ;
Returns
Number
0 or an error code
var result = revwalk . hideRef ( refname ) ;
| Parameters | Type |
| --- | --- | --- |
| refname | String | the reference to hide |
Returns
Number
0 or an error code
revwalk . next ( ) . then ( function ( oid ) {
// Use oid
} ) ;
Returns
Oid
the oid of the next commit
var result = revwalk . push ( id ) ;
| Parameters | Type |
| --- | --- | --- |
| id | Oid | the oid of the commit to start from. |
Returns
Number
0 or an error code
var result = revwalk . pushGlob ( glob ) ;
| Parameters | Type |
| --- | --- | --- |
| glob | String | the glob pattern references should match |
Returns
Number
0 or an error code
var result = revwalk . pushHead ( ) ;
Returns
Number
0 or an error code
var result = revwalk . pushRange ( range ) ;
| Parameters | Type |
| --- | --- | --- |
| range | String | the range |
Returns
Number
0 or an error code
var result = revwalk . pushRef ( refname ) ;
| Parameters | Type |
| --- | --- | --- |
| refname | String | the reference to push |
Returns
Number
0 or an error code
var repository = revwalk . repository ( ) ;
Revwalk# simplifyFirstParent Sync
revwalk . simplifyFirstParent ( ) ;
Set the sort order for the revwalk. This function takes variable arguments
like revwalk.sorting(NodeGit.RevWalk.SORT.Topological, NodeGit.RevWalk.SORT.Reverse).
| Parameters | Type |
| --- | --- | --- |
| sort | Number | |
var commit = revwalk . walk ( oid , callback ) ;
Walk the history from the given oid. The callback is invoked for each commit;
When the walk is over, the callback is invoked with (null, null).
| Parameters | Type |
| --- | --- | --- |
| oid | Oid | |
| callback | Function | |
| Flag | Value |
| --- | --- | --- |
| Revwalk.SORT. NONE | 0 |
| Revwalk.SORT. TOPOLOGICAL | 1 |
| Revwalk.SORT. TIME | 2 |
| Revwalk.SORT. REVERSE | 4 |