UNPKG

2.61 kBTypeScriptView Raw
1import { Buf } from "./buf";
2import { Oid } from "./oid";
3import { Repository } from "./repository";
4import { SubmoduleUpdateOptions } from "./submodule-update-options";
5
6export namespace Submodule {
7 const enum IGNORE {
8 UNSPECIFIED = -1,
9 NONE = 1,
10 UNTRACKED = 2,
11 DIRTY = 3,
12 ALL = 4,
13 }
14
15 const enum RECURSE {
16 NO = 0,
17 YES = 1,
18 ONDEMAND = 2,
19 }
20
21 const enum STATUS {
22 IN_HEAD = 1,
23 IN_INDEX = 2,
24 IN_CONFIG = 4,
25 IN_WD = 8,
26 INDEX_ADDED = 16,
27 INDEX_DELETED = 32,
28 INDEX_MODIFIED = 64,
29 WD_UNINITIALIZED = 128,
30 WD_ADDED = 256,
31 WD_DELETED = 512,
32 WD_MODIFIED = 1024,
33 WD_INDEX_MODIFIED = 2048,
34 WD_WD_MODIFIED = 4096,
35 WD_UNTRACKED = 8192,
36 }
37
38 const enum UPDATE {
39 CHECKOUT = 1,
40 REBASE = 2,
41 MERGE = 3,
42 NONE = 4,
43 DEFAULT = 0,
44 }
45}
46
47export class Submodule {
48 static addSetup(repo: Repository, url: string, path: string, useGitLink: number): Promise<Submodule>;
49 static foreach(repo: Repository, callback?: Function): Promise<number>;
50 static lookup(repo: Repository, name: string): Promise<Submodule>;
51 static resolveUrl(repo: Repository, url: string): Promise<Buf>;
52 static setBranch(repo: Repository, name: string, branch: string): number;
53 static setFetchRecurseSubmodules(repo: Repository, name: string, fetchRecurseSubmodules: number): number;
54 static setIgnore(repo: Repository, name: string, ignore: number): Promise<number>;
55 static setUpdate(repo: Repository, name: string, update: number): Promise<number>;
56 static setUrl(repo: Repository, name: string, url: string): Promise<number>;
57 static status(repo: Repository, name: string, ignore: number): Promise<number>;
58 static updateInitOptions(opts: SubmoduleUpdateOptions, version: number): number;
59
60 addFinalize(): Promise<number>;
61 addToIndex(writeIndex: number): Promise<number>;
62 branch(): string;
63 fetchRecurseSubmodules(): number;
64
65 headId(): Oid;
66 ignore(): number;
67 indexId(): Oid;
68 init(overwrite: number): Promise<number>;
69 location(): Promise<number>;
70 name(): string;
71 open(): Promise<Repository>;
72 owner(): Repository;
73 path(): string;
74 reload(force: number): number;
75 repoInit(useGitLink: number): Promise<Repository>;
76 sync(): Promise<number>;
77 /**
78 * Updates a submodule
79 */
80 update(init: number, options?: SubmoduleUpdateOptions): Promise<number>;
81 updateStrategy(): number;
82 url(): string;
83 wdId(): Oid;
84}