Permalink
Switch branches/tags
1.11 aeschli/bundled-app-insights aeschli/json-tests aeschli/tokenizersupport-initialization alex/binary-rpc alex/snapshot2 alex/35225 alexr00/problemMatcher alexr00/rerunTask alexr00/taskToObject avoid-fssync build-using-ts-3.0 chines-locale chrmarti/cloudshellts chrmarti/embeddedEditorBackground chrmarti/quickinputapi chrmarti/quickinputapioptions chrmarti/quickinputapiwip chrmarti/vsc-proxy chrmarti/51986 chrmarti/57850 chrmarti/59343 chrmarti/60243 chrmarti/62716 core-lang css-json-shrinkwrap dbaeumer/47386 dbaeumer/48032 dbaeumer/50588 dbaeumer/50799 dbaeumer/54111 dbaeumer/56721 dbaeumer/57148 dbaeumer/61543 dbaeumer/64918 dockfind electron-3.0.x electron-4.0.x err-telemetry error file-ext-tag-telemetry fix-64613 fix-indent fix-menu-leak for-christof hackathon/profile implementation-progress isidorn/buildTest isidorn/debugLogging isidorn/explorerNewTree isidorn/lazyFormatter isidorn/loadedScriptSchedulers isidorn/normalizePaths isidorn/openEditorsContext isidorn/replDynamicHeight isidorn/resourceTrimTrailingSlash isidorn/taskActiveEvent isidorn/zenModeRestore joao/build joao/clean-deps joao/compile-es6 joao/darwin-executable-name joao/data-tree-model joao/git-api joao/inno-signtool joao/ipc-cancellation joao/ipc-rpc joao/keyvault joao/linux-integration-tests joao/list-dnd joao/list-selectable-rows joao/log-path joao/next joao/tree-filter joao/tree joao/uninstaller joao/wip-tree joaomoreno-patch-1 joh/brackets joh/fix59538 joh/leak joh/log-appender joh/next joh/outline joh/perf-canary joh/promise-finally joh/search-cancel joh/webpack-json kieferrm/errortel kieferrm/mainDebug kieferrm/terminal-cwd master misolori/a11y-themes misolori/activity-bar-update misolori/light-theme-icons-selection-dont-work misolori/light-theme-icons misolori/open-change-icons misolori/seti-update misolori/welcome-screen-keys mjbvz/fix-60315 mjbvz/remove-std-fork mjbvz/trigger-context octref/contributing octref/web-component octref/58555 octref/64993 optout-locale php-html-enter-rules prompt-lang-pack ramyar/copy-suggest-docs ramyar/reload-subtext ramyar/suggest-no-icons rebornix/ESM rebornix/FastTokenization rebornix/commentsgrouping rebornix/nativeWordOperation rebornix/review rebornix/search-in-parallel release/1.14 release/1.15 release/1.16 release/1.17 release/1.18 release/1.19 release/1.20 release/1.21 release/1.22 release/1.23 release/1.24 release/1.25 release/1.26 release/1.27 release/1.28 release/1.29 release/1.30 reuse-focuseditem revert-52782-electron-2.0.x revert-54854-revert-52782-electron-2.0.x rmacfarlane/debug-process rmacfarlane/delete-comments rmacfarlane/unsupported roblou/cachedSearchProvider roblou/caseInsensitiveGlobs roblou/ehSearch roblou/fileSearchChanges roblou/fileTextSearchSep roblou/findFilesUri roblou/fixCRLFmultiline roblou/fixSearchCancel roblou/promoteExtLogAPI roblou/searchAPIchanges roblou/settingsEditorAsTree roblou/settingsSearchIdChanges sandy081/fix62411 sandy081/openUri sandy081/treeItemDecorations sandy081/vnext sandy081/54315 sandy081/54746 sandy081/55879 sandy081/59603 settings-contrib settings-polish show-english standalone/0.1.x standalone/0.1.1 standalone/0.6.x standalone/0.7.x standalone/0.8.x standalone/0.10.x standalone/0.11.x standalone/0.12.x standalone/0.13.x standalone/0.14.x standalone/0.15.x triggerExpansionOnTab tsalinger/multipath-handling-quoted-backslash-in-linux tsalinger/multipath-reveal-children tyriar/conpty tyriar/dom_render tyriar/electron-1.8.2 tyriar/snap tyriar/term_ligatures tyriar/term_ligatures2 tyriar/term_tele tyriar/54093_buffering umd update-event win32-ia32-builds win32-sign
Nothing to show
Find file Copy path
218 lines (182 sloc) 6 KB
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { Uri, SourceControlInputBox, Event, CancellationToken } from 'vscode';
export interface Git {
readonly path: string;
}
export interface InputBox {
value: string;
}
export const enum RefType {
Head,
RemoteHead,
Tag
}
export interface Ref {
readonly type: RefType;
readonly name?: string;
readonly commit?: string;
readonly remote?: string;
}
export interface UpstreamRef {
readonly remote: string;
readonly name: string;
}
export interface Branch extends Ref {
readonly upstream?: UpstreamRef;
readonly ahead?: number;
readonly behind?: number;
}
export interface Commit {
readonly hash: string;
readonly message: string;
readonly parents: string[];
}
export interface Submodule {
readonly name: string;
readonly path: string;
readonly url: string;
}
export interface Remote {
readonly name: string;
readonly fetchUrl?: string;
readonly pushUrl?: string;
readonly isReadOnly: boolean;
}
export const enum Status {
INDEX_MODIFIED,
INDEX_ADDED,
INDEX_DELETED,
INDEX_RENAMED,
INDEX_COPIED,
MODIFIED,
DELETED,
UNTRACKED,
IGNORED,
ADDED_BY_US,
ADDED_BY_THEM,
DELETED_BY_US,
DELETED_BY_THEM,
BOTH_ADDED,
BOTH_DELETED,
BOTH_MODIFIED
}
export interface Change {
/**
* Returns either `originalUri` or `renameUri`, depending
* on whether this change is a rename change. When
* in doubt always use `uri` over the other two alternatives.
*/
readonly uri: Uri;
readonly originalUri: Uri;
readonly renameUri: Uri | undefined;
readonly status: Status;
}
export interface RepositoryState {
readonly HEAD: Branch | undefined;
readonly refs: Ref[];
readonly remotes: Remote[];
readonly submodules: Submodule[];
readonly rebaseCommit: Commit | undefined;
readonly mergeChanges: Change[];
readonly indexChanges: Change[];
readonly workingTreeChanges: Change[];
readonly onDidChange: Event<void>;
}
export interface RepositoryUIState {
readonly selected: boolean;
readonly onDidChange: Event<void>;
}
export interface Repository {
readonly rootUri: Uri;
readonly inputBox: InputBox;
readonly state: RepositoryState;
readonly ui: RepositoryUIState;
getConfigs(): Promise<{ key: string; value: string; }[]>;
getConfig(key: string): Promise<string>;
setConfig(key: string, value: string): Promise<string>;
getObjectDetails(treeish: string, path: string): Promise<{ mode: string, object: string, size: number }>;
detectObjectType(object: string): Promise<{ mimetype: string, encoding?: string }>;
buffer(ref: string, path: string): Promise<Buffer>;
show(ref: string, path: string): Promise<string>;
getCommit(ref: string): Promise<Commit>;
clean(paths: string[]): Promise<void>;
apply(patch: string, reverse?: boolean): Promise<void>;
diff(cached?: boolean): Promise<string>;
diffWithHEAD(path: string): Promise<string>;
diffWith(ref: string, path: string): Promise<string>;
diffIndexWithHEAD(path: string): Promise<string>;
diffIndexWith(ref: string, path: string): Promise<string>;
diffBlobs(object1: string, object2: string): Promise<string>;
diffBetween(ref1: string, ref2: string, path: string): Promise<string>;
hashObject(data: string): Promise<string>;
createBranch(name: string, checkout: boolean, ref?: string): Promise<void>;
deleteBranch(name: string, force?: boolean): Promise<void>;
getBranch(name: string): Promise<Branch>;
setBranchUpstream(name: string, upstream: string): Promise<void>;
getMergeBase(ref1: string, ref2: string): Promise<string>;
status(): Promise<void>;
checkout(treeish: string): Promise<void>;
addRemote(name: string, url: string): Promise<void>;
removeRemote(name: string): Promise<void>;
fetch(remote?: string, ref?: string): Promise<void>;
pull(): Promise<void>;
push(remoteName?: string, branchName?: string, setUpstream?: boolean): Promise<void>;
}
export interface API {
readonly git: Git;
readonly repositories: Repository[];
readonly onDidOpenRepository: Event<Repository>;
readonly onDidCloseRepository: Event<Repository>;
}
export interface GitExtension {
readonly enabled: boolean;
readonly onDidChangeEnablement: Event<boolean>;
/**
* Returns a specific API version.
*
* Throws error if git extension is disabled. You can listed to the
* [GitExtension.onDidChangeEnablement](#GitExtension.onDidChangeEnablement) event
* to know when the extension becomes enabled/disabled.
*
* @param version Version number.
* @returns API instance
*/
getAPI(version: 1): API;
}
export const enum GitErrorCodes {
BadConfigFile = 'BadConfigFile',
AuthenticationFailed = 'AuthenticationFailed',
NoUserNameConfigured = 'NoUserNameConfigured',
NoUserEmailConfigured = 'NoUserEmailConfigured',
NoRemoteRepositorySpecified = 'NoRemoteRepositorySpecified',
NotAGitRepository = 'NotAGitRepository',
NotAtRepositoryRoot = 'NotAtRepositoryRoot',
Conflict = 'Conflict',
StashConflict = 'StashConflict',
UnmergedChanges = 'UnmergedChanges',
PushRejected = 'PushRejected',
RemoteConnectionError = 'RemoteConnectionError',
DirtyWorkTree = 'DirtyWorkTree',
CantOpenResource = 'CantOpenResource',
GitNotFound = 'GitNotFound',
CantCreatePipe = 'CantCreatePipe',
CantAccessRemote = 'CantAccessRemote',
RepositoryNotFound = 'RepositoryNotFound',
RepositoryIsLocked = 'RepositoryIsLocked',
BranchNotFullyMerged = 'BranchNotFullyMerged',
NoRemoteReference = 'NoRemoteReference',
InvalidBranchName = 'InvalidBranchName',
BranchAlreadyExists = 'BranchAlreadyExists',
NoLocalChanges = 'NoLocalChanges',
NoStashFound = 'NoStashFound',
LocalChangesOverwritten = 'LocalChangesOverwritten',
NoUpstreamBranch = 'NoUpstreamBranch',
IsInSubmodule = 'IsInSubmodule',
WrongCase = 'WrongCase',
CantLockRef = 'CantLockRef',
CantRebaseMultipleBranches = 'CantRebaseMultipleBranches',
PatchDoesNotApply = 'PatchDoesNotApply'
}