1 | import { EventEmitter } from "events";
|
2 |
|
3 | import { Buf } from "./buf";
|
4 | import { Diff } from "./diff";
|
5 | import { Error } from "./error";
|
6 | import { Object } from "./object";
|
7 | import { Oid } from "./oid";
|
8 | import { Repository } from "./repository";
|
9 | import { Signature } from "./signature";
|
10 | import { Tree } from "./tree";
|
11 | import { TreeEntry } from "./tree-entry";
|
12 |
|
13 | export interface HistoryEventEmitter extends EventEmitter {
|
14 | start(): void;
|
15 | }
|
16 |
|
17 | export class Commit {
|
18 | static create(
|
19 | repo: Repository,
|
20 | updateRef: string,
|
21 | author: Signature,
|
22 | committer: Signature,
|
23 | messageEncoding: string,
|
24 | message: string,
|
25 | tree: Tree,
|
26 | parentCount: number,
|
27 | parents: any[],
|
28 | ): Oid;
|
29 | static createV(
|
30 | id: Oid,
|
31 | repo: Repository,
|
32 | updateRef: string,
|
33 | author: Signature,
|
34 | committer: Signature,
|
35 | messageEncoding: string,
|
36 | message: string,
|
37 | tree: Tree,
|
38 | parentCount: number,
|
39 | ): number;
|
40 | |
41 |
|
42 |
|
43 | static lookup(repo: Repository, id: string | Oid | Commit): Promise<Commit>;
|
44 | static lookupPrefix(repo: Repository, id: Oid, len: number): Promise<Commit>;
|
45 | static createWithSignature(
|
46 | repo: Repository,
|
47 | commitContent: string,
|
48 | signature: string,
|
49 | signatureField: string,
|
50 | ): Promise<Oid>;
|
51 |
|
52 | amend(
|
53 | updateRef: string,
|
54 | author: Signature,
|
55 | committer: Signature,
|
56 | messageEncoding: string,
|
57 | message: string,
|
58 | tree: Tree | Oid,
|
59 | ): Promise<Oid>;
|
60 | amendWithSignature(
|
61 | updateRef: string,
|
62 | author: Signature,
|
63 | committer: Signature,
|
64 | messageEncoding: string,
|
65 | message: string,
|
66 | tree: Tree | Oid,
|
67 | onSignature: (
|
68 | data: string,
|
69 | ) =>
|
70 | | Promise<{ code: Error.CODE; field?: string | undefined; signedData: string }>
|
71 | | { code: Error.CODE; field?: string | undefined; signedData: string },
|
72 | ): Promise<Oid>;
|
73 | author(): Signature;
|
74 | committer(): Signature;
|
75 |
|
76 | headerField(field: string): Promise<Buf>;
|
77 | id(): Oid;
|
78 | message(): string;
|
79 | messageEncoding(): string;
|
80 | messageRaw(): string;
|
81 | nthGenAncestor(n: number): Promise<Commit>;
|
82 | owner(): Repository;
|
83 | parent(n: number): Promise<Commit>;
|
84 | parentId(n: number): Oid;
|
85 | parentcount(): number;
|
86 | rawHeader(): string;
|
87 | summary(): string;
|
88 | time(): number;
|
89 | timeOffset(): number;
|
90 | tree(treeOut: Tree): number;
|
91 | treeId(): Oid;
|
92 | |
93 |
|
94 |
|
95 | sha(): string;
|
96 | |
97 |
|
98 |
|
99 | timeMs(): number;
|
100 | |
101 |
|
102 |
|
103 | date(): Date;
|
104 | |
105 |
|
106 |
|
107 | getTree(): Promise<Tree>;
|
108 | |
109 |
|
110 |
|
111 | getEntry(path: string): Promise<TreeEntry>;
|
112 | |
113 |
|
114 |
|
115 |
|
116 |
|
117 | history(): HistoryEventEmitter;
|
118 | |
119 |
|
120 |
|
121 | getParents(limit: number, callback?: Function): Promise<Commit[]>;
|
122 | |
123 |
|
124 |
|
125 | parents(): Oid[];
|
126 | |
127 |
|
128 |
|
129 | getDiff(callback?: Function): Promise<Diff[]>;
|
130 | |
131 |
|
132 |
|
133 | getDiffWithOptions(options: Object, callback?: Function): Promise<Diff[]>;
|
134 | |
135 |
|
136 |
|
137 | toString(): string;
|
138 | dup(): Promise<Commit>;
|
139 | |
140 |
|
141 |
|
142 | body(): string;
|
143 |
|
144 | getSignature(field?: string): Promise<{
|
145 | signature: string;
|
146 | signedData: string;
|
147 | }>;
|
148 | }
|