UNPKG

3.19 kBTypeScriptView Raw
1import { Buf } from "./buf";
2import { Enums } from "./enums";
3import { FetchOptions } from "./fetch-options";
4import { PushOptions } from "./push-options";
5import { Refspec } from "./ref-spec";
6import { RemoteCallbacks } from "./remote-callbacks";
7import { Repository } from "./repository";
8import { Strarray } from "./str-array";
9import { TransferProgress } from "./transfer-progress";
10
11export namespace Remote {
12 const enum AUTOTAG_OPTION {
13 DOWNLOAD_TAGS_UNSPECIFIED = 0,
14 DOWNLOAD_TAGS_AUTO = 1,
15 DOWNLOAD_TAGS_NONE = 2,
16 DOWNLOAD_TAGS_ALL = 3,
17 }
18
19 const enum COMPLETION_TYPE {
20 COMPLETION_DOWNLOAD = 0,
21 COMPLETION_INDEXING = 1,
22 COMPLETION_ERROR = 2,
23 }
24}
25
26export class Remote {
27 static addFetch(repo: Repository, remote: string, refspec: string): number;
28 static addPush(repo: Repository, remote: string, refspec: string): number;
29 static create(repo: Repository, name: string, url: string): Promise<Remote>;
30 static createAnonymous(repo: Repository, url: string): Promise<Remote>;
31 static createDetached(url: string): Promise<Remote>;
32 static createWithFetchspec(repo: Repository, name: string, url: string, fetch: string): Promise<Remote>;
33 static delete(repo: Repository, name: string): Promise<number>;
34 static initCallbacks(opts: RemoteCallbacks, version: number): number;
35 static isValidName(remoteName: string): boolean;
36 static list(repo: Repository): Promise<any[]>;
37 static lookup(repo: Repository, name: string | Remote, callback?: Function): Promise<Remote>;
38 static rename(repo: Repository, oldName: string, newName: string): Promise<void>;
39 static setAutotag(repo: Repository, remote: string, value: number): number;
40 static setPushurl(repo: Repository, remote: string, url: string): number;
41 static setUrl(repo: Repository, remote: string, url: string): number;
42
43 autotag(): number;
44 connect(direction: Enums.DIRECTION, callbacks: RemoteCallbacks, callback?: Function): Promise<number>;
45 connected(): number;
46 defaultBranch(): Promise<string>;
47 disconnect(): Promise<void>;
48 download(refSpecs: any[], opts?: FetchOptions, callback?: Function): Promise<number>;
49 dup(): Promise<Remote>;
50 fetch(refSpecs: any[], opts: FetchOptions, message: string, callback?: Function): Promise<number>;
51
52 getFetchRefspecs(): Promise<any[]>;
53 getPushRefspecs(): Promise<any[]>;
54 getRefspec(n: number): Refspec;
55 name(): string;
56 owner(): Repository;
57 prune(callbacks: RemoteCallbacks): number;
58 pruneRefs(): number;
59 push(refSpecs: any[], options?: PushOptions, callback?: Function): Promise<number>;
60 pushurl(): string;
61 refspecCount(): number;
62 stats(): TransferProgress;
63
64 stop(): void;
65 updateTips(
66 callbacks: RemoteCallbacks,
67 updateFetchhead: number,
68 downloadTags: number,
69 reflogMessage: string,
70 ): number;
71 upload(refspecs: Strarray | string | string[], opts?: PushOptions): number;
72 url(): string;
73 /**
74 * Lists advertised references from a remote. You must connect to the remote before using referenceList.
75 */
76 referenceList(): Promise<any[]>;
77}