Vscode merge (#4582)

* Merge from vscode 37cb23d3dd4f9433d56d4ba5ea3203580719a0bd

* fix issues with merges

* bump node version in azpipe

* replace license headers

* remove duplicate launch task

* fix build errors

* fix build errors

* fix tslint issues

* working through package and linux build issues

* more work

* wip

* fix packaged builds

* working through linux build errors

* wip

* wip

* wip

* fix mac and linux file limits

* iterate linux pipeline

* disable editor typing

* revert series to parallel

* remove optimize vscode from linux

* fix linting issues

* revert testing change

* add work round for new node

* readd packaging for extensions

* fix issue with angular not resolving decorator dependencies
This commit is contained in:
Anthony Dresser
2019-03-19 17:44:35 -07:00
committed by GitHub
parent 833d197412
commit 87765e8673
1879 changed files with 54505 additions and 38058 deletions

View File

@@ -65,7 +65,7 @@ export class Askpass implements Disposable {
return ipcHandlePath;
}
private onRequest(req: http.ServerRequest, res: http.ServerResponse): void {
private onRequest(req: http.IncomingMessage, res: http.ServerResponse): void {
const chunks: string[] = [];
req.setEncoding('utf8');
req.on('data', (d: string) => chunks.push(d));

View File

@@ -649,14 +649,16 @@ export class CommandCenter {
if (!(resource instanceof Resource)) {
// can happen when called from a keybinding
console.log('WHAT');
resource = this.getSCMResource();
}
if (resource) {
const resources = ([resource, ...resourceStates] as Resource[])
.filter(r => r.type !== Status.DELETED && r.type !== Status.INDEX_DELETED);
uris = resources.map(r => r.resourceUri);
uris = ([resource, ...resourceStates] as Resource[])
.filter(r => r.type !== Status.DELETED && r.type !== Status.INDEX_DELETED)
.map(r => r.resourceUri);
} else if (window.activeTextEditor) {
uris = [window.activeTextEditor.document.uri];
}
}
@@ -665,6 +667,7 @@ export class CommandCenter {
}
const activeTextEditor = window.activeTextEditor;
for (const uri of uris) {
const opts: TextDocumentShowOptions = {
preserveFocus,
@@ -1458,8 +1461,7 @@ export class CommandCenter {
name.trim().replace(/^\.|\/\.|\.\.|~|\^|:|\/$|\.lock$|\.lock\/|\\|\*|\s|^\s*$|\.$|\[|\]$/g, branchWhitespaceChar)
: name;
const rawBranchName = await window.showInputBox({
value: defaultName,
const rawBranchName = defaultName || await window.showInputBox({
placeHolder: localize('branch name', "Branch name"),
prompt: localize('provide branch name', "Please provide a branch name"),
ignoreFocusOut: true,
@@ -1480,7 +1482,7 @@ export class CommandCenter {
}
const picks = [new HEADItem(repository), ...createCheckoutItems(repository)];
const placeHolder = localize('select a ref to create a new branch from', 'Select a ref to create a new branch from');
const placeHolder = localize('select a ref to create a new branch from', 'Select a ref to create the \'{0}\' branch from', branchName);
const target = await window.showQuickPick(picks, { placeHolder });
if (!target) {
@@ -1801,6 +1803,72 @@ export class CommandCenter {
await this._push(repository, { pushType: PushType.PushTo, forcePush: true });
}
@command('git.addRemote', { repository: true })
async addRemote(repository: Repository): Promise<void> {
const remotes = repository.remotes;
const sanitize = (name: string) => {
name = name.trim();
return name && name.replace(/^\.|\/\.|\.\.|~|\^|:|\/$|\.lock$|\.lock\/|\\|\*|\s|^\s*$|\.$|\[|\]$/g, '-');
};
const resultName = await window.showInputBox({
placeHolder: localize('remote name', "Remote name"),
prompt: localize('provide remote name', "Please provide a remote name"),
ignoreFocusOut: true,
validateInput: (name: string) => {
if (sanitize(name)) {
return null;
}
return localize('remote name format invalid', "Remote name format invalid");
}
});
const name = sanitize(resultName || '');
if (!name) {
return;
}
if (remotes.find(r => r.name === name)) {
window.showErrorMessage(localize('remote already exists', "Remote '{0}' already exists.", name));
return;
}
const url = await window.showInputBox({
placeHolder: localize('remote url', "Remote URL"),
prompt: localize('provide remote URL', "Enter URL for remote \"{0}\"", name),
ignoreFocusOut: true
});
if (!url) {
return;
}
await repository.addRemote(name, url);
}
@command('git.removeRemote', { repository: true })
async removeRemote(repository: Repository): Promise<void> {
const remotes = repository.remotes;
if (remotes.length === 0) {
window.showErrorMessage(localize('no remotes added', "Your repository has no remotes."));
return;
}
const picks = remotes.map(r => r.name);
const placeHolder = localize('remove remote', "Pick a remote to remove");
const remoteName = await window.showQuickPick(picks, { placeHolder });
if (!remoteName) {
return;
}
await repository.removeRemote(remoteName);
}
private async _sync(repository: Repository, rebase: boolean): Promise<void> {
const HEAD = repository.HEAD;
@@ -2118,6 +2186,7 @@ export class CommandCenter {
uri = uri ? uri : (window.activeTextEditor && window.activeTextEditor.document.uri);
this.outputChannel.appendLine(`git.getSCMResource.uri ${uri && uri.toString()}`);
for (const r of this.model.repositories.map(r => r.root)) {
this.outputChannel.appendLine(`repo root ${r}`);
}

View File

@@ -20,7 +20,6 @@ class GitIgnoreDecorationProvider implements DecorationProvider {
private disposables: Disposable[] = [];
constructor(private model: Model) {
//todo@joh -> events when the ignore status actually changes, not only when the file changes
this.onDidChangeDecorations = fireEvent(anyEvent<any>(
filterEvent(workspace.onDidSaveTextDocument, e => e.fileName.endsWith('.gitignore')),
model.onDidOpenRepository,
@@ -119,7 +118,7 @@ class GitDecorationProvider implements DecorationProvider {
const uris = new Set([...this.decorations.keys()].concat([...newDecorations.keys()]));
this.decorations = newDecorations;
this._onDidChangeDecorations.fire([...uris.values()].map(Uri.parse));
this._onDidChangeDecorations.fire([...uris.values()].map(value => Uri.parse(value, true)));
}
private collectDecorationData(group: GitResourceGroup, bucket: Map<string, DecorationData>): void {

View File

@@ -349,7 +349,7 @@ export class Git {
await mkdirp(parentPath);
try {
await this.exec(parentPath, ['clone', url, folderPath], { cancellationToken });
await this.exec(parentPath, ['clone', url.includes(' ') ? encodeURI(url) : url, folderPath], { cancellationToken });
} catch (err) {
if (err.stderr) {
err.stderr = err.stderr.replace(/^Cloning.+$/m, '').trim();
@@ -1201,7 +1201,7 @@ export class Repository {
}
async branch(name: string, checkout: boolean, ref?: string): Promise<void> {
const args = checkout ? ['checkout', '-q', '-b', name] : ['branch', '-q', name];
const args = checkout ? ['checkout', '-q', '-b', name, '--no-track'] : ['branch', '-q', name];
if (ref) {
args.push(ref);
@@ -1456,14 +1456,14 @@ export class Repository {
async createStash(message?: string, includeUntracked?: boolean): Promise<void> {
try {
const args = ['stash', 'save'];
const args = ['stash', 'push'];
if (includeUntracked) {
args.push('-u');
}
if (message) {
args.push('--', message);
args.push('-m', message);
}
await this.run(args);

View File

@@ -206,7 +206,7 @@ export class Resource implements SourceControlResourceState {
case Status.INDEX_ADDED:
case Status.INTENT_TO_ADD:
return new ThemeColor('gitDecoration.addedResourceForeground');
case Status.INDEX_RENAMED: // todo@joh - special color?
case Status.INDEX_RENAMED:
case Status.UNTRACKED:
return new ThemeColor('gitDecoration.untrackedResourceForeground');
case Status.IGNORED:
@@ -673,20 +673,6 @@ export class Repository implements Disposable {
}
}
// const subjectThreshold =
// Math.max(config.get<number>('inputValidationLength') || 50, config.get<number>('subjectValidationLength') || 50, 0) || 50;
if (line.length <= threshold) {
if (setting !== 'always') {
return;