1 | import { EventEmitter } from 'events';
|
2 |
|
3 | import { Repository } from './repository';
|
4 | import { Signature } from './signature';
|
5 | import { Oid } from './oid';
|
6 | import { Buf } from './buf';
|
7 | import { Object } from './object';
|
8 | import { Tree } from './tree';
|
9 | import { TreeEntry } from './tree-entry';
|
10 | import { Diff } from './diff';
|
11 | import { Error } from './error';
|
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 |
|
44 |
|
45 | static lookup(repo: Repository, id: string | Oid | Commit): Promise<Commit>;
|
46 | static lookupPrefix(repo: Repository, id: Oid, len: number): Promise<Commit>;
|
47 | static createWithSignature(
|
48 | repo: Repository,
|
49 | commitContent: string,
|
50 | signature: string,
|
51 | signatureField: string,
|
52 | ): Promise<Oid>;
|
53 |
|
54 | amend(
|
55 | updateRef: string,
|
56 | author: Signature,
|
57 | committer: Signature,
|
58 | messageEncoding: string,
|
59 | message: string,
|
60 | tree: Tree | Oid,
|
61 | ): Promise<Oid>;
|
62 | amendWithSignature(
|
63 | updateRef: string,
|
64 | author: Signature,
|
65 | committer: Signature,
|
66 | messageEncoding: string,
|
67 | message: string,
|
68 | tree: Tree | Oid,
|
69 | onSignature: (
|
70 | data: string,
|
71 | ) =>
|
72 | | Promise<{ code: Error.CODE; field?: string | undefined; signedData: string }>
|
73 | | { code: Error.CODE; field?: string | undefined; signedData: string },
|
74 | ): Promise<Oid>;
|
75 | author(): Signature;
|
76 | committer(): Signature;
|
77 |
|
78 | free(): void;
|
79 | headerField(field: string): Promise<Buf>;
|
80 | id(): Oid;
|
81 | message(): string;
|
82 | messageEncoding(): string;
|
83 | messageRaw(): string;
|
84 | nthGenAncestor(n: number): Promise<Commit>;
|
85 | owner(): Repository;
|
86 | parent(n: number): Promise<Commit>;
|
87 | parentId(n: number): Oid;
|
88 | parentcount(): number;
|
89 | rawHeader(): string;
|
90 | summary(): string;
|
91 | time(): number;
|
92 | timeOffset(): number;
|
93 | tree(treeOut: Tree): number;
|
94 | treeId(): Oid;
|
95 | |
96 |
|
97 |
|
98 |
|
99 |
|
100 | sha(): string;
|
101 | |
102 |
|
103 |
|
104 |
|
105 |
|
106 | timeMs(): number;
|
107 | |
108 |
|
109 |
|
110 |
|
111 |
|
112 | date(): Date;
|
113 | |
114 |
|
115 |
|
116 |
|
117 |
|
118 | getTree(): Promise<Tree>;
|
119 | |
120 |
|
121 |
|
122 |
|
123 |
|
124 | getEntry(path: string): Promise<TreeEntry>;
|
125 | |
126 |
|
127 |
|
128 |
|
129 |
|
130 |
|
131 |
|
132 | history(): HistoryEventEmitter;
|
133 | |
134 |
|
135 |
|
136 |
|
137 |
|
138 | getParents(limit: number, callback?: Function): Promise<Commit[]>;
|
139 | |
140 |
|
141 |
|
142 |
|
143 |
|
144 | parents(): Oid[];
|
145 | |
146 |
|
147 |
|
148 |
|
149 |
|
150 | getDiff(callback?: Function): Promise<Diff[]>;
|
151 | |
152 |
|
153 |
|
154 |
|
155 |
|
156 | getDiffWithOptions(options: Object, callback?: Function): Promise<Diff[]>;
|
157 | |
158 |
|
159 |
|
160 |
|
161 |
|
162 | toString(): string;
|
163 | dup(): Promise<Commit>;
|
164 | |
165 |
|
166 |
|
167 |
|
168 |
|
169 | body(): string;
|
170 |
|
171 | getSignature(field?: string): Promise<{
|
172 | signature: string;
|
173 | signedData: string;
|
174 | }>;
|
175 | }
|