UNPKG

1.74 kBTypeScriptView Raw
1import { Repository } from './repository';
2import { Oid } from './oid';
3import { Commit } from './commit';
4import { Diff } from './diff';
5
6export namespace Revwalk {
7 const enum SORT {
8 NONE = 0,
9 TOPOLOGICAL = 1,
10 TIME = 2,
11 REVERSE = 4,
12 }
13 interface HistoryEntry {
14 commit: Commit;
15 status: Diff.DELTA;
16 newName: string;
17 oldName: string;
18 }
19}
20
21export class Revwalk {
22 static create(repo: Repository): Revwalk;
23
24 hide(commitId: Oid): number;
25 hideGlob(glob: string): number;
26 hideHead(): number;
27 hideRef(refname: string): number;
28 next(): Promise<Oid>;
29 push(id: Oid): number;
30 pushGlob(glob: string): number;
31 pushHead(): number;
32 pushRange(range: string): number;
33 pushRef(refname: string): number;
34 repository(): Repository;
35
36 reset(): void;
37
38 simplifyFirstParent(): void;
39 /**
40 * Set the sort order for the revwalk. This function takes variable arguments like revwalk.sorting(NodeGit.RevWalk.Topological, NodeGit.RevWalk.Reverse).
41 */
42 sorting(...sort: number[]): void;
43 commitWalk(maxCount: number): Promise<Commit[]>;
44 fastWalk(maxCount: number): Promise<Oid[]>;
45 fileHistoryWalk(filePath: string, maxCount: number): Promise<Revwalk.HistoryEntry[]>;
46 /**
47 * 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).
48 */
49 walk(oid: Oid, callback?: Function): Commit;
50 /**
51 * Walk the history grabbing commits until the checkFn called with the current commit returns false.
52 */
53 getCommitsUntil(checkFn: Function): Promise<Commit[]>;
54 getCommits(count: number): Promise<Commit[]>;
55}