1 | import { AnnotatedCommit } from './annotated-commit';
|
2 | import { Blob } from './blob';
|
3 | import { CheckoutOptions } from './checkout-options';
|
4 | import { Commit } from './commit';
|
5 | import { Config } from './config';
|
6 | import { DiffLine } from './diff-line';
|
7 | import { Error } from './error';
|
8 | import { FetchOptions } from './fetch-options';
|
9 | import { Index } from './index_';
|
10 | import { Merge } from './merge';
|
11 | import { MergeOptions } from './merge-options';
|
12 | import { Odb } from './odb';
|
13 | import { Oid } from './oid';
|
14 | import { Refdb } from './ref-db';
|
15 | import { Reference } from './reference';
|
16 | import { Remote } from './remote';
|
17 | import { Revwalk } from './rev-walk';
|
18 | import { Signature } from './signature';
|
19 | import { StatusFile } from './status-file';
|
20 | import { StatusOptions } from './status-options';
|
21 | import { Submodule } from './submodule';
|
22 | import { Tag } from './tag';
|
23 | import { Tree } from './tree';
|
24 | import { Treebuilder } from './tree-builder';
|
25 | import { Worktree } from './worktree';
|
26 |
|
27 | export interface RepositoryInitOptions {
|
28 | description?: string;
|
29 | flags?: number;
|
30 | initialHead?: string;
|
31 | mode?: number;
|
32 | originUrl?: string;
|
33 | templatePath?: string;
|
34 | version?: number;
|
35 | workdirPath?: string;
|
36 | }
|
37 |
|
38 | export class Repository {
|
39 | |
40 |
|
41 |
|
42 | static discover(startPath: string, acrossFs: number, ceilingDirs: string): Promise<string>;
|
43 | static init(path: string, isBare: number): Promise<Repository>;
|
44 | static initExt(repoPath: string, options?: RepositoryInitOptions): Promise<Repository>;
|
45 | static open(path: string): Promise<Repository>;
|
46 | static openBare(barePath: string): Promise<Repository>;
|
47 | static openExt(path: string, flags?: number, ceilingDirs?: string): Promise<Repository>;
|
48 | static openFromWorktree(wt: Worktree): Promise<Repository>;
|
49 | static wrapOdb(odb: Odb): Promise<Repository>;
|
50 |
|
51 | cleanup(): Promise<void>;
|
52 | commondir(): string;
|
53 | config(): Promise<Config>;
|
54 | configSnapshot(): Promise<Config>;
|
55 | detachHead(): number;
|
56 | fetchheadForeach(callback?: Function): Promise<any>;
|
57 |
|
58 | free(): void;
|
59 | getNamespace(): string;
|
60 | getSubmodules(): Promise<Submodule[]>;
|
61 | head(): Promise<Reference>;
|
62 | headDetached(): number;
|
63 | headUnborn(): number;
|
64 | index(): Promise<Index>;
|
65 | isBare(): number;
|
66 | isEmpty(): number;
|
67 | isShallow(): number;
|
68 | itemPath(item: number): Promise<string>;
|
69 | mergeheadForeach(callback?: Function): Promise<any>;
|
70 | messageRemove(): number;
|
71 | odb(): Promise<Odb>;
|
72 | path(): string;
|
73 | refdb(): Promise<Refdb>;
|
74 | refreshReferences(): Promise<void>;
|
75 | setHead(refname: string): Promise<number>;
|
76 | setHeadDetached(commitish: Oid): number;
|
77 | setHeadDetachedFromAnnotated(commitish: AnnotatedCommit): number;
|
78 | setIdent(name: string, email: string): number;
|
79 | setNamespace(nmspace: string): number;
|
80 | setWorkdir(workdir: string, updateGitLink: number): number;
|
81 | state(): number;
|
82 | stateCleanup(): number;
|
83 | workdir(): string;
|
84 | |
85 |
|
86 |
|
87 | createBranch(name: string, commit: Commit | string | Oid, force?: boolean): Promise<Reference>;
|
88 | |
89 |
|
90 |
|
91 | getReferenceCommit(name: string | Reference): Promise<Commit>;
|
92 | |
93 |
|
94 |
|
95 | getBranch(name: string | Reference): Promise<Reference>;
|
96 | |
97 |
|
98 |
|
99 | getBranchCommit(name: string | Reference): Promise<Commit>;
|
100 | |
101 |
|
102 |
|
103 | getCurrentBranch(): Promise<Reference>;
|
104 | |
105 |
|
106 |
|
107 | getReference(name: string | Reference): Promise<Reference>;
|
108 | |
109 |
|
110 |
|
111 | getReferences(): Promise<Reference[]>;
|
112 | |
113 |
|
114 |
|
115 | getReferenceNames(type: Reference.TYPE): Promise<string[]>;
|
116 | getCommit(string: string | Commit | Oid): Promise<Commit>;
|
117 | |
118 |
|
119 |
|
120 | getBlob(string: string | Oid): Promise<Blob>;
|
121 | |
122 |
|
123 |
|
124 | getTree(string: string | Oid): Promise<Tree>;
|
125 | createTag(string: string | Oid, name: string, message: string): Promise<Tag>;
|
126 | |
127 |
|
128 |
|
129 | createLightweightTag(string: string | Oid, name: string): Promise<Reference>;
|
130 | |
131 |
|
132 |
|
133 | getTag(string: string | Oid): Promise<Tag>;
|
134 | |
135 |
|
136 |
|
137 | getTagByName(Short: string): Promise<Tag>;
|
138 | |
139 |
|
140 |
|
141 | deleteTagByName(Short: string): Promise<number>;
|
142 | |
143 |
|
144 |
|
145 | createRevWalk(): Revwalk;
|
146 | |
147 |
|
148 |
|
149 | getMasterCommit(): Promise<Commit>;
|
150 | |
151 |
|
152 |
|
153 | getHeadCommit(): Promise<Commit>;
|
154 | createCommit(
|
155 | updateRef: string,
|
156 | author: Signature,
|
157 | committer: Signature,
|
158 | message: string,
|
159 | Tree: Tree | Oid | string,
|
160 | parents: Array<string | Commit | Oid>,
|
161 | callback?: Function,
|
162 | ): Promise<Oid>;
|
163 | createCommitWithSignature(
|
164 | updateRef: string,
|
165 | author: Signature,
|
166 | committer: Signature,
|
167 | message: string,
|
168 | Tree: Tree | Oid | string,
|
169 | parents: Array<string | Commit | Oid>,
|
170 | onSignature: (
|
171 | data: string,
|
172 | ) =>
|
173 | | Promise<{ code: Error.CODE; field?: string | undefined; signedData: string }>
|
174 | | { code: Error.CODE; field?: string | undefined; signedData: string },
|
175 | ): Promise<Oid>;
|
176 | |
177 |
|
178 |
|
179 | createCommitOnHead(filesToAdd: string[], author: Signature, committer: Signature, message: string): Promise<Oid>;
|
180 | |
181 |
|
182 |
|
183 | createBlobFromBuffer(buffer: Buffer): Promise<Oid>;
|
184 | treeBuilder(tree: Tree): Promise<Treebuilder>;
|
185 | |
186 |
|
187 |
|
188 | defaultSignature(): Signature;
|
189 | |
190 |
|
191 |
|
192 | getRemoteNames(): Promise<string[]>;
|
193 | |
194 |
|
195 |
|
196 | getRemotes(callback?: Function): Promise<Remote[]>;
|
197 | |
198 |
|
199 |
|
200 | getRemote(remote: string | Remote, callback?: Function): Promise<Remote>;
|
201 | |
202 |
|
203 |
|
204 | fetch(remote: string | Remote, fetchOptions?: FetchOptions): Promise<void>;
|
205 | |
206 |
|
207 |
|
208 | fetchAll(fetchOptions?: FetchOptions, callback?: Function): Promise<void>;
|
209 | mergeBranches(
|
210 | to: string | Reference,
|
211 | from: string | Reference,
|
212 | signature?: Signature,
|
213 | mergePreference?: Merge.PREFERENCE,
|
214 | mergeOptions?: MergeOptions,
|
215 | ): Promise<Oid>;
|
216 | |
217 |
|
218 |
|
219 | rebaseBranches(
|
220 | branch: string,
|
221 | upstream: string,
|
222 | onto: string,
|
223 | signature: Signature,
|
224 | beforeNextFn: Function,
|
225 | ): Promise<Oid>;
|
226 | continueRebase(signature: Signature, beforeNextFn: Function): Promise<Oid>;
|
227 | |
228 |
|
229 |
|
230 | getStatus(opts?: StatusOptions): Promise<StatusFile[]>;
|
231 | |
232 |
|
233 |
|
234 | getStatusExt(opts?: StatusOptions): Promise<StatusFile[]>;
|
235 | |
236 |
|
237 |
|
238 | getSubmoduleNames(): Promise<string[]>;
|
239 | |
240 |
|
241 |
|
242 | checkoutRef(reference: Reference, opts?: CheckoutOptions): Promise<Reference>;
|
243 | |
244 |
|
245 |
|
246 | checkoutBranch(branch: string | Reference, opts?: CheckoutOptions): Promise<Reference>;
|
247 | |
248 |
|
249 |
|
250 | stageFilemode(filePath: string | string[], stageNew: boolean): Promise<number>;
|
251 | |
252 |
|
253 |
|
254 | stageLines(filePath: string, newLines: DiffLine[], isStaged: boolean): Promise<number>;
|
255 | |
256 |
|
257 |
|
258 | isDefaultState(): boolean;
|
259 | |
260 |
|
261 |
|
262 | isApplyingMailbox(): boolean;
|
263 | |
264 |
|
265 |
|
266 | isBisecting(): boolean;
|
267 | |
268 |
|
269 |
|
270 | isCherrypicking(): boolean;
|
271 | |
272 |
|
273 |
|
274 | isMerging(): boolean;
|
275 | |
276 |
|
277 |
|
278 | isRebasing(): boolean;
|
279 | |
280 |
|
281 |
|
282 | isReverting(): boolean;
|
283 | |
284 |
|
285 |
|
286 | discardLines(filePath: string, selectedLines: DiffLine[]): Promise<number>;
|
287 | |
288 |
|
289 |
|
290 | refreshIndex(): Promise<Index>;
|
291 | }
|