Skip to content

Commit

Permalink
Update to the latest version of vscode-git
Browse files Browse the repository at this point in the history
Source code updated from VS Code 1.43.1

Partial fix for eclipse-che/che#16041

Signed-off-by: Eric Williams <[email protected]>
  • Loading branch information
ericwill committed Mar 17, 2020
1 parent ed98620 commit c63a3e4
Show file tree
Hide file tree
Showing 78 changed files with 4,326 additions and 3,823 deletions.
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,4 @@ coverage/
test_data/
test-results/
yarn-error.log
*.vsix
.idea/
.idea/
16 changes: 0 additions & 16 deletions build/update-grammars.js

This file was deleted.

66 changes: 0 additions & 66 deletions cgmanifest.json

This file was deleted.

64 changes: 54 additions & 10 deletions src/api/api1.ts → dist/api/api1.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@

import { Model } from '../model';
import { Repository as BaseRepository, Resource } from '../repository';
import { InputBox, Git, API, Repository, Remote, RepositoryState, Branch, Ref, Submodule, Commit, Change, RepositoryUIState, Status } from './git';
import { InputBox, Git, API, Repository, Remote, RepositoryState, Branch, Ref, Submodule, Commit, Change, RepositoryUIState, Status, LogOptions, APIState, CommitOptions } from './git';
import { Event, SourceControlInputBox, Uri, SourceControl } from 'vscode';
import { mapEvent } from '../util';
import { toGitUri } from '../uri';

class ApiInputBox implements InputBox {
set value(value: string) { this._inputBox.value = value; }
Expand Down Expand Up @@ -76,6 +77,10 @@ export class ApiRepository implements Repository {
return this._repository.setConfig(key, value);
}

getGlobalConfig(key: string): Promise<string> {
return this._repository.getGlobalConfig(key);
}

getObjectDetails(treeish: string, path: string): Promise<{ mode: string; object: string; size: number; }> {
return this._repository.getObjectDetails(treeish, path);
}
Expand Down Expand Up @@ -104,27 +109,37 @@ export class ApiRepository implements Repository {
return this._repository.diff(cached);
}

diffWithHEAD(path: string): Promise<string> {
diffWithHEAD(): Promise<Change[]>;
diffWithHEAD(path: string): Promise<string>;
diffWithHEAD(path?: string): Promise<string | Change[]> {
return this._repository.diffWithHEAD(path);
}

diffWith(ref: string, path: string): Promise<string> {
diffWith(ref: string): Promise<Change[]>;
diffWith(ref: string, path: string): Promise<string>;
diffWith(ref: string, path?: string): Promise<string | Change[]> {
return this._repository.diffWith(ref, path);
}

diffIndexWithHEAD(path: string): Promise<string> {
diffIndexWithHEAD(): Promise<Change[]>;
diffIndexWithHEAD(path: string): Promise<string>;
diffIndexWithHEAD(path?: string): Promise<string | Change[]> {
return this._repository.diffIndexWithHEAD(path);
}

diffIndexWith(ref: string, path: string): Promise<string> {
diffIndexWith(ref: string): Promise<Change[]>;
diffIndexWith(ref: string, path: string): Promise<string>;
diffIndexWith(ref: string, path?: string): Promise<string | Change[]> {
return this._repository.diffIndexWith(ref, path);
}

diffBlobs(object1: string, object2: string): Promise<string> {
return this._repository.diffBlobs(object1, object2);
}

diffBetween(ref1: string, ref2: string, path: string): Promise<string> {
diffBetween(ref1: string, ref2: string): Promise<Change[]>;
diffBetween(ref1: string, ref2: string, path: string): Promise<string>;
diffBetween(ref1: string, ref2: string, path?: string): Promise<string | Change[]> {
return this._repository.diffBetween(ref1, ref2, path);
}

Expand Down Expand Up @@ -168,17 +183,29 @@ export class ApiRepository implements Repository {
return this._repository.removeRemote(name);
}

fetch(remote?: string | undefined, ref?: string | undefined): Promise<void> {
return this._repository.fetch(remote, ref);
fetch(remote?: string | undefined, ref?: string | undefined, depth?: number | undefined): Promise<void> {
return this._repository.fetch(remote, ref, depth);
}

pull(): Promise<void> {
return this._repository.pull();
pull(unshallow?: boolean): Promise<void> {
return this._repository.pull(undefined, unshallow);
}

push(remoteName?: string, branchName?: string, setUpstream: boolean = false): Promise<void> {
return this._repository.pushTo(remoteName, branchName, setUpstream);
}

blame(path: string): Promise<string> {
return this._repository.blame(path);
}

log(options?: LogOptions): Promise<Commit[]> {
return this._repository.log(options);
}

commit(message: string, opts?: CommitOptions): Promise<void> {
return this._repository.commit(message, opts);
}
}

export class ApiGit implements Git {
Expand All @@ -192,6 +219,14 @@ export class ApiImpl implements API {

readonly git = new ApiGit(this._model);

get state(): APIState {
return this._model.state;
}

get onDidChangeState(): Event<APIState> {
return this._model.onDidChangeState;
}

get onDidOpenRepository(): Event<Repository> {
return mapEvent(this._model.onDidOpenRepository, r => new ApiRepository(r));
}
Expand All @@ -204,5 +239,14 @@ export class ApiImpl implements API {
return this._model.repositories.map(r => new ApiRepository(r));
}

toGitUri(uri: Uri, ref: string): Uri {
return toGitUri(uri, ref);
}

getRepository(uri: Uri): Repository | null {
const result = this._model.getRepository(uri);
return result ? new ApiRepository(result) : null;
}

constructor(private _model: Model) { }
}
File renamed without changes.
48 changes: 45 additions & 3 deletions src/api/git.d.ts → dist/api/git.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ export interface Commit {
readonly hash: string;
readonly message: string;
readonly parents: string[];
readonly authorDate?: Date;
readonly authorName?: string;
readonly authorEmail?: string;
readonly commitDate?: Date;
}

export interface Submodule {
Expand All @@ -67,6 +71,7 @@ export const enum Status {
DELETED,
UNTRACKED,
IGNORED,
INTENT_TO_ADD,

ADDED_BY_US,
ADDED_BY_THEM,
Expand Down Expand Up @@ -109,6 +114,22 @@ export interface RepositoryUIState {
readonly onDidChange: Event<void>;
}

/**
* Log options.
*/
export interface LogOptions {
/** Max number of log entries to retrieve. If not specified, the default is 32. */
readonly maxEntries?: number;
}

export interface CommitOptions {
all?: boolean | 'tracked';
amend?: boolean;
signoff?: boolean;
signCommit?: boolean;
empty?: boolean;
}

export interface Repository {

readonly rootUri: Uri;
Expand All @@ -119,6 +140,7 @@ export interface Repository {
getConfigs(): Promise<{ key: string; value: string; }[]>;
getConfig(key: string): Promise<string>;
setConfig(key: string, value: string): Promise<string>;
getGlobalConfig(key: string): Promise<string>;

getObjectDetails(treeish: string, path: string): Promise<{ mode: string, object: string, size: number }>;
detectObjectType(object: string): Promise<{ mimetype: string, encoding?: string }>;
Expand All @@ -130,11 +152,16 @@ export interface Repository {

apply(patch: string, reverse?: boolean): Promise<void>;
diff(cached?: boolean): Promise<string>;
diffWithHEAD(): Promise<Change[]>;
diffWithHEAD(path: string): Promise<string>;
diffWith(ref: string): Promise<Change[]>;
diffWith(ref: string, path: string): Promise<string>;
diffIndexWithHEAD(): Promise<Change[]>;
diffIndexWithHEAD(path: string): Promise<string>;
diffIndexWith(ref: string): Promise<Change[]>;
diffIndexWith(ref: string, path: string): Promise<string>;
diffBlobs(object1: string, object2: string): Promise<string>;
diffBetween(ref1: string, ref2: string): Promise<Change[]>;
diffBetween(ref1: string, ref2: string, path: string): Promise<string>;

hashObject(data: string): Promise<string>;
Expand All @@ -152,16 +179,28 @@ export interface Repository {
addRemote(name: string, url: string): Promise<void>;
removeRemote(name: string): Promise<void>;

fetch(remote?: string, ref?: string): Promise<void>;
pull(): Promise<void>;
fetch(remote?: string, ref?: string, depth?: number): Promise<void>;
pull(unshallow?: boolean): Promise<void>;
push(remoteName?: string, branchName?: string, setUpstream?: boolean): Promise<void>;

blame(path: string): Promise<string>;
log(options?: LogOptions): Promise<Commit[]>;

commit(message: string, opts?: CommitOptions): Promise<void>;
}

export type APIState = 'uninitialized' | 'initialized';

export interface API {
readonly state: APIState;
readonly onDidChangeState: Event<APIState>;
readonly git: Git;
readonly repositories: Repository[];
readonly onDidOpenRepository: Event<Repository>;
readonly onDidCloseRepository: Event<Repository>;

toGitUri(uri: Uri, ref: string): Uri;
getRepository(uri: Uri): Repository | null;
}

export interface GitExtension {
Expand Down Expand Up @@ -214,4 +253,7 @@ export const enum GitErrorCodes {
WrongCase = 'WrongCase',
CantLockRef = 'CantLockRef',
CantRebaseMultipleBranches = 'CantRebaseMultipleBranches',
}
PatchDoesNotApply = 'PatchDoesNotApply',
NoPathFound = 'NoPathFound',
UnknownPath = 'UnknownPath',
}
File renamed without changes.
2 changes: 2 additions & 0 deletions dist/askpass-main.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions dist/askpass-main.js.map

Large diffs are not rendered by default.

Loading

0 comments on commit c63a3e4

Please sign in to comment.