|
@ -3,7 +3,9 @@ |
|
|
* Licensed under the MIT License. See License.txt in the project root for license information. |
|
|
* Licensed under the MIT License. See License.txt in the project root for license information. |
|
|
*--------------------------------------------------------------------------------------------*/ |
|
|
*--------------------------------------------------------------------------------------------*/ |
|
|
|
|
|
|
|
|
import { Event, Uri } from 'vscode'; |
|
|
|
|
|
|
|
|
import { Disposable, Event, ProviderResult, Uri } from 'vscode'; |
|
|
|
|
|
|
|
|
|
|
|
export { ProviderResult } from 'vscode'; |
|
|
|
|
|
|
|
|
export interface Git { |
|
|
export interface Git { |
|
|
readonly path: string; |
|
|
readonly path: string; |
|
@ -41,7 +43,10 @@ export interface Commit { |
|
|
readonly hash: string; |
|
|
readonly hash: string; |
|
|
readonly message: string; |
|
|
readonly message: string; |
|
|
readonly parents: string[]; |
|
|
readonly parents: string[]; |
|
|
readonly authorEmail?: string | undefined; |
|
|
|
|
|
|
|
|
readonly authorDate?: Date; |
|
|
|
|
|
readonly authorName?: string; |
|
|
|
|
|
readonly authorEmail?: string; |
|
|
|
|
|
readonly commitDate?: Date; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
export interface Submodule { |
|
|
export interface Submodule { |
|
@ -117,6 +122,22 @@ export interface RepositoryUIState { |
|
|
export interface LogOptions { |
|
|
export interface LogOptions { |
|
|
/** Max number of log entries to retrieve. If not specified, the default is 32. */ |
|
|
/** Max number of log entries to retrieve. If not specified, the default is 32. */ |
|
|
readonly maxEntries?: number; |
|
|
readonly maxEntries?: number; |
|
|
|
|
|
readonly path?: string; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
export interface CommitOptions { |
|
|
|
|
|
all?: boolean | 'tracked'; |
|
|
|
|
|
amend?: boolean; |
|
|
|
|
|
signoff?: boolean; |
|
|
|
|
|
signCommit?: boolean; |
|
|
|
|
|
empty?: boolean; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
export interface BranchQuery { |
|
|
|
|
|
readonly remote?: boolean; |
|
|
|
|
|
readonly pattern?: string; |
|
|
|
|
|
readonly count?: number; |
|
|
|
|
|
readonly contains?: string; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
export interface Repository { |
|
|
export interface Repository { |
|
@ -158,6 +179,7 @@ export interface Repository { |
|
|
createBranch(name: string, checkout: boolean, ref?: string): Promise<void>; |
|
|
createBranch(name: string, checkout: boolean, ref?: string): Promise<void>; |
|
|
deleteBranch(name: string, force?: boolean): Promise<void>; |
|
|
deleteBranch(name: string, force?: boolean): Promise<void>; |
|
|
getBranch(name: string): Promise<Branch>; |
|
|
getBranch(name: string): Promise<Branch>; |
|
|
|
|
|
getBranches(query: BranchQuery): Promise<Ref[]>; |
|
|
setBranchUpstream(name: string, upstream: string): Promise<void>; |
|
|
setBranchUpstream(name: string, upstream: string): Promise<void>; |
|
|
|
|
|
|
|
|
getMergeBase(ref1: string, ref2: string): Promise<string>; |
|
|
getMergeBase(ref1: string, ref2: string): Promise<string>; |
|
@ -167,6 +189,7 @@ export interface Repository { |
|
|
|
|
|
|
|
|
addRemote(name: string, url: string): Promise<void>; |
|
|
addRemote(name: string, url: string): Promise<void>; |
|
|
removeRemote(name: string): Promise<void>; |
|
|
removeRemote(name: string): Promise<void>; |
|
|
|
|
|
renameRemote(name: string, newName: string): Promise<void>; |
|
|
|
|
|
|
|
|
fetch(remote?: string, ref?: string, depth?: number): Promise<void>; |
|
|
fetch(remote?: string, ref?: string, depth?: number): Promise<void>; |
|
|
pull(unshallow?: boolean): Promise<void>; |
|
|
pull(unshallow?: boolean): Promise<void>; |
|
@ -174,13 +197,54 @@ export interface Repository { |
|
|
|
|
|
|
|
|
blame(path: string): Promise<string>; |
|
|
blame(path: string): Promise<string>; |
|
|
log(options?: LogOptions): Promise<Commit[]>; |
|
|
log(options?: LogOptions): Promise<Commit[]>; |
|
|
|
|
|
|
|
|
|
|
|
commit(message: string, opts?: CommitOptions): Promise<void>; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
export interface RemoteSource { |
|
|
|
|
|
readonly name: string; |
|
|
|
|
|
readonly description?: string; |
|
|
|
|
|
readonly url: string | string[]; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
export interface RemoteSourceProvider { |
|
|
|
|
|
readonly name: string; |
|
|
|
|
|
readonly icon?: string; // codicon name
|
|
|
|
|
|
readonly supportsQuery?: boolean; |
|
|
|
|
|
getRemoteSources(query?: string): ProviderResult<RemoteSource[]>; |
|
|
|
|
|
publishRepository?(repository: Repository): Promise<void>; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
export interface Credentials { |
|
|
|
|
|
readonly username: string; |
|
|
|
|
|
readonly password: string; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
export interface CredentialsProvider { |
|
|
|
|
|
getCredentials(host: Uri): ProviderResult<Credentials>; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
export interface PushErrorHandler { |
|
|
|
|
|
handlePushError(repository: Repository, remote: Remote, refspec: string, error: Error & { gitErrorCode: GitErrorCodes }): Promise<boolean>; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
export type APIState = 'uninitialized' | 'initialized'; |
|
|
|
|
|
|
|
|
export interface API { |
|
|
export interface API { |
|
|
|
|
|
readonly state: APIState; |
|
|
|
|
|
readonly onDidChangeState: Event<APIState>; |
|
|
readonly git: Git; |
|
|
readonly git: Git; |
|
|
readonly repositories: Repository[]; |
|
|
readonly repositories: Repository[]; |
|
|
readonly onDidOpenRepository: Event<Repository>; |
|
|
readonly onDidOpenRepository: Event<Repository>; |
|
|
readonly onDidCloseRepository: Event<Repository>; |
|
|
readonly onDidCloseRepository: Event<Repository>; |
|
|
|
|
|
|
|
|
|
|
|
toGitUri(uri: Uri, ref: string): Uri; |
|
|
|
|
|
getRepository(uri: Uri): Repository | null; |
|
|
|
|
|
init(root: Uri): Promise<Repository | null>; |
|
|
|
|
|
|
|
|
|
|
|
registerRemoteSourceProvider(provider: RemoteSourceProvider): Disposable; |
|
|
|
|
|
registerCredentialsProvider(provider: CredentialsProvider): Disposable; |
|
|
|
|
|
registerPushErrorHandler(handler: PushErrorHandler): Disposable; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
export interface GitExtension { |
|
|
export interface GitExtension { |
|
@ -218,6 +282,7 @@ export const enum GitErrorCodes { |
|
|
CantOpenResource = 'CantOpenResource', |
|
|
CantOpenResource = 'CantOpenResource', |
|
|
GitNotFound = 'GitNotFound', |
|
|
GitNotFound = 'GitNotFound', |
|
|
CantCreatePipe = 'CantCreatePipe', |
|
|
CantCreatePipe = 'CantCreatePipe', |
|
|
|
|
|
PermissionDenied = 'PermissionDenied', |
|
|
CantAccessRemote = 'CantAccessRemote', |
|
|
CantAccessRemote = 'CantAccessRemote', |
|
|
RepositoryNotFound = 'RepositoryNotFound', |
|
|
RepositoryNotFound = 'RepositoryNotFound', |
|
|
RepositoryIsLocked = 'RepositoryIsLocked', |
|
|
RepositoryIsLocked = 'RepositoryIsLocked', |
|
@ -234,5 +299,6 @@ export const enum GitErrorCodes { |
|
|
CantLockRef = 'CantLockRef', |
|
|
CantLockRef = 'CantLockRef', |
|
|
CantRebaseMultipleBranches = 'CantRebaseMultipleBranches', |
|
|
CantRebaseMultipleBranches = 'CantRebaseMultipleBranches', |
|
|
PatchDoesNotApply = 'PatchDoesNotApply', |
|
|
PatchDoesNotApply = 'PatchDoesNotApply', |
|
|
NoPathFound = 'NoPathFound' |
|
|
|
|
|
|
|
|
NoPathFound = 'NoPathFound', |
|
|
|
|
|
UnknownPath = 'UnknownPath', |
|
|
} |
|
|
} |