Merge from vscode fcf3346a8e9f5ee1e00674461d9e2c2292a14ee3 (#12295)

* Merge from vscode fcf3346a8e9f5ee1e00674461d9e2c2292a14ee3

* Fix test build break

* Update distro

* Fix build errors

* Update distro

* Update REH build file

* Update build task names for REL

* Fix product build yaml

* Fix product REH task name

* Fix type in task name

* Update linux build step

* Update windows build tasks

* Turn off server publish

* Disable REH

* Fix typo

* Bump distro

* Update vscode tests

* Bump distro

* Fix type in disto

* Bump distro

* Turn off docker build

* Remove docker step from release

Co-authored-by: ADS Merger <andresse@microsoft.com>
Co-authored-by: Karl Burtram <karlb@microsoft.com>
This commit is contained in:
Christopher Suh
2020-10-03 14:42:05 -04:00
committed by GitHub
parent 58d02b76db
commit 6ff1e3866b
687 changed files with 10507 additions and 9104 deletions

View File

@@ -216,6 +216,47 @@
"title": "%command.commitAllAmend%",
"category": "Git"
},
{
"command": "git.commitNoVerify",
"title": "%command.commitNoVerify%",
"category": "Git",
"icon": "$(check)"
},
{
"command": "git.commitStagedNoVerify",
"title": "%command.commitStagedNoVerify%",
"category": "Git"
},
{
"command": "git.commitEmptyNoVerify",
"title": "%command.commitEmptyNoVerify%",
"category": "Git"
},
{
"command": "git.commitStagedSignedNoVerify",
"title": "%command.commitStagedSignedNoVerify%",
"category": "Git"
},
{
"command": "git.commitStagedAmendNoVerify",
"title": "%command.commitStagedAmendNoVerify%",
"category": "Git"
},
{
"command": "git.commitAllNoVerify",
"title": "%command.commitAllNoVerify%",
"category": "Git"
},
{
"command": "git.commitAllSignedNoVerify",
"title": "%command.commitAllSignedNoVerify%",
"category": "Git"
},
{
"command": "git.commitAllAmendNoVerify",
"title": "%command.commitAllAmendNoVerify%",
"category": "Git"
},
{
"command": "git.restoreCommitTemplate",
"title": "%command.restoreCommitTemplate%",
@@ -581,6 +622,38 @@
"command": "git.commitAllAmend",
"when": "config.git.enabled && !git.missing && gitOpenRepositoryCount != 0"
},
{
"command": "git.commitNoVerify",
"when": "config.git.enabled && !git.missing && config.git.allowNoVerifyCommit && gitOpenRepositoryCount != 0"
},
{
"command": "git.commitStagedNoVerify",
"when": "config.git.enabled && !git.missing && config.git.allowNoVerifyCommit && gitOpenRepositoryCount != 0"
},
{
"command": "git.commitEmptyNoVerify",
"when": "config.git.enabled && !git.missing && config.git.allowNoVerifyCommit && gitOpenRepositoryCount != 0"
},
{
"command": "git.commitStagedSignedNoVerify",
"when": "config.git.enabled && !git.missing && config.git.allowNoVerifyCommit && gitOpenRepositoryCount != 0"
},
{
"command": "git.commitStagedAmendNoVerify",
"when": "config.git.enabled && !git.missing && config.git.allowNoVerifyCommit && gitOpenRepositoryCount != 0"
},
{
"command": "git.commitAllNoVerify",
"when": "config.git.enabled && !git.missing && config.git.allowNoVerifyCommit && gitOpenRepositoryCount != 0"
},
{
"command": "git.commitAllSignedNoVerify",
"when": "config.git.enabled && !git.missing && config.git.allowNoVerifyCommit && gitOpenRepositoryCount != 0"
},
{
"command": "git.commitAllAmendNoVerify",
"when": "config.git.enabled && !git.missing && config.git.allowNoVerifyCommit && gitOpenRepositoryCount != 0"
},
{
"command": "git.restoreCommitTemplate",
"when": "false"
@@ -1239,13 +1312,38 @@
"command": "git.rebaseAbort",
"group": "1_commit@5"
},
{
"command": "git.commitNoVerify",
"group": "1_commit@6",
"when": "config.git.allowNoVerifyCommit"
},
{
"command": "git.commitStagedNoVerify",
"group": "1_commit@7",
"when": "config.git.allowNoVerifyCommit"
},
{
"command": "git.commitAllNoVerify",
"group": "1_commit@8",
"when": "config.git.allowNoVerifyCommit"
},
{
"command": "git.commitStagedAmend",
"group": "2_amend@1"
},
{
"command": "git.commitAllAmend",
"group": "2_amend@1"
"group": "2_amend@2"
},
{
"command": "git.commitStagedAmendNoVerify",
"group": "2_amend@3",
"when": "config.git.allowNoVerifyCommit"
},
{
"command": "git.commitAllAmendNoVerify",
"group": "2_amend@4",
"when": "config.git.allowNoVerifyCommit"
},
{
"command": "git.commitStagedSigned",
@@ -1254,6 +1352,16 @@
{
"command": "git.commitAllSigned",
"group": "3_signoff@2"
},
{
"command": "git.commitStagedSignedNoVerify",
"group": "3_signoff@3",
"when": "config.git.allowNoVerifyCommit"
},
{
"command": "git.commitAllSignedNoVerify",
"group": "3_signoff@4",
"when": "config.git.allowNoVerifyCommit"
}
],
"git.changes": [
@@ -1407,7 +1515,8 @@
"git.path": {
"type": [
"string",
"null"
"null",
"array"
],
"markdownDescription": "%config.path%",
"default": null,
@@ -1730,6 +1839,16 @@
"default": true,
"description": "%config.confirmForcePush%"
},
"git.allowNoVerifyCommit": {
"type": "boolean",
"default": false,
"description": "%config.allowNoVerifyCommit%"
},
"git.confirmNoVerifyCommit": {
"type": "boolean",
"default": true,
"description": "%config.confirmNoVerifyCommit%"
},
"git.openDiffOnClick": {
"type": "boolean",
"scope": "resource",

View File

@@ -34,6 +34,14 @@
"command.commitAll": "Commit All",
"command.commitAllSigned": "Commit All (Signed Off)",
"command.commitAllAmend": "Commit All (Amend)",
"command.commitNoVerify": "Commit (No Nerify)",
"command.commitStagedNoVerify": "Commit Staged (No Verify)",
"command.commitEmptyNoVerify": "Commit Empty (No Verify)",
"command.commitStagedSignedNoVerify": "Commit Staged (Signed Off, No Verify)",
"command.commitStagedAmendNoVerify": "Commit Staged (Amend, No Verify)",
"command.commitAllNoVerify": "Commit All (No Verify)",
"command.commitAllSignedNoVerify": "Commit All (Signed Off, No Verify)",
"command.commitAllAmendNoVerify": "Commit All (Amend, No Verify)",
"command.restoreCommitTemplate": "Restore Commit Template",
"command.undoCommit": "Undo Last Commit",
"command.checkout": "Checkout to...",
@@ -76,7 +84,7 @@
"command.timelineCopyCommitId": "Copy Commit ID",
"command.timelineCopyCommitMessage": "Copy Commit Message",
"config.enabled": "Whether git is enabled.",
"config.path": "Path and filename of the git executable, e.g. `C:\\Program Files\\Git\\bin\\git.exe` (Windows).",
"config.path": "Path and filename of the git executable, e.g. `C:\\Program Files\\Git\\bin\\git.exe` (Windows). This can also be an array of string values containing multiple paths to look up.",
"config.autoRepositoryDetection": "Configures when repositories should be automatically detected.",
"config.autoRepositoryDetection.true": "Scan for both subfolders of the current opened folder and parent folders of open files.",
"config.autoRepositoryDetection.false": "Disable automatic repository scanning.",
@@ -139,6 +147,8 @@
"config.allowForcePush": "Controls whether force push (with or without lease) is enabled.",
"config.useForcePushWithLease": "Controls whether force pushing uses the safer force-with-lease variant.",
"config.confirmForcePush": "Controls whether to ask for confirmation before force-pushing.",
"config.allowNoVerifyCommit": "Controls whether commits without running pre-commit and commit-msg hooks are allowed.",
"config.confirmNoVerifyCommit": "Controls whether to ask for confirmation before commiting without verification.",
"config.openDiffOnClick": "Controls whether the diff editor should be opened when clicking a change. Otherwise the regular editor will be opened.",
"config.supportCancellation": "Controls whether a notification comes up when running the Sync action, which allows the user to cancel the operation.",
"config.branchSortOrder": "Controls the sort order for branches.",
@@ -166,8 +176,8 @@
"view.workbench.scm.missing": "A valid git installation was not detected, more details can be found in the [git output](command:git.showOutput).\nPlease [install git](https://git-scm.com/), or learn more about how to use git and source control in Azure Data Studio in [our docs](https://aka.ms/vscode-scm).\nIf you're using a different version control system, you can [search the Marketplace](command:workbench.extensions.search?%22%40category%3A%5C%22scm%20providers%5C%22%22) for additional extensions.",
"view.workbench.scm.disabled": "If you would like to use git features, please enable git in your [settings](command:workbench.action.openSettings?%5B%22git.enabled%22%5D).\nTo learn more about how to use git and source control in Azure Data Studio [read our docs](https://aka.ms/vscode-scm).",
"view.workbench.scm.empty": "In order to use git features, you can open a folder containing a git repository or clone from a URL.\n[Open Folder](command:vscode.openFolder)\n[Clone Repository](command:git.clone)\nTo learn more about how to use git and source control in Azure Data Studio [read our docs](https://aka.ms/vscode-scm).",
"view.workbench.scm.folder": "The folder currently open doesn't have a git repository.\n[Initialize Repository](command:git.init?%5Btrue%5D)\nTo learn more about how to use git and source control in Azure Data Studio [read our docs](https://aka.ms/vscode-scm).",
"view.workbench.scm.workspace": "The workspace currently open doesn't have any folders containing git repositories.\n[Initialize Repository](command:git.init)\nTo learn more about how to use git and source control in Azure Data Studio [read our docs](https://aka.ms/vscode-scm).",
"view.workbench.scm.folder": "The folder currently open doesn't have a git repository. You can initialize a repository which will enable source control features powered by git.\n[Initialize Repository](command:git.init?%5Btrue%5D)\nTo learn more about how to use git and source control in Azure Data Studio [read our docs](https://aka.ms/vscode-scm).",
"view.workbench.scm.workspace": "The workspace currently open doesn't have any folders containing git repositories. You can initialize a repository on a folder which will enable source control features powered by git.\n[Initialize Repository](command:git.init)\nTo learn more about how to use git and source control in Azure Data Studio [read our docs](https://aka.ms/vscode-scm).",
"view.workbench.scm.emptyWorkspace": "The workspace currently open doesn't have any folders containing git repositories.\n[Add Folder to Workspace](command:workbench.action.addRootFolder)\nTo learn more about how to use git and source control in Azure Data Studio [read our docs](https://aka.ms/vscode-scm).",
"view.workbench.cloneRepository": "You can also clone a repository from a URL. To learn more about how to use git and source control in Azure Data Studio [read our docs](https://aka.ms/vscode-scm).\n[Clone Repository](command:git.clone)"
}

View File

@@ -130,6 +130,7 @@ export interface CommitOptions {
signoff?: boolean;
signCommit?: boolean;
empty?: boolean;
noVerify?: boolean;
}
export interface BranchQuery {

View File

@@ -6,7 +6,7 @@
import { lstat, Stats } from 'fs';
import * as os from 'os';
import * as path from 'path';
import { commands, Disposable, LineChange, MessageOptions, OutputChannel, Position, ProgressLocation, QuickPickItem, Range, SourceControlResourceState, TextDocumentShowOptions, TextEditor, Uri, ViewColumn, window, workspace, WorkspaceEdit, WorkspaceFolder, TimelineItem, env } from 'vscode';
import { commands, Disposable, LineChange, MessageOptions, OutputChannel, Position, ProgressLocation, QuickPickItem, Range, SourceControlResourceState, TextDocumentShowOptions, TextEditor, Uri, ViewColumn, window, workspace, WorkspaceEdit, WorkspaceFolder, TimelineItem, env, Selection } from 'vscode';
import TelemetryReporter from 'vscode-extension-telemetry';
import * as nls from 'vscode-nls';
import { Branch, GitErrorCodes, Ref, RefType, Status, CommitOptions, RemoteSourceProvider } from './api/git';
@@ -1002,6 +1002,9 @@ export class CommandCenter {
}
await this._stageChanges(textEditor, [changes[index]]);
const firstStagedLine = changes[index].modifiedStartLineNumber - 1;
textEditor.selections = [new Selection(firstStagedLine, 0, firstStagedLine, 0)];
}
@command('git.stageSelectedRanges', { diff: true })
@@ -1049,6 +1052,9 @@ export class CommandCenter {
}
await this._revertChanges(textEditor, [...changes.slice(0, index), ...changes.slice(index + 1)]);
const firstStagedLine = changes[index].modifiedStartLineNumber - 1;
textEditor.selections = [new Selection(firstStagedLine, 0, firstStagedLine, 0)];
}
@command('git.revertSelectedRanges', { diff: true })
@@ -1070,7 +1076,9 @@ export class CommandCenter {
return;
}
const selectionsBeforeRevert = textEditor.selections;
await this._revertChanges(textEditor, selectedChanges);
textEditor.selections = selectionsBeforeRevert;
}
private async _revertChanges(textEditor: TextEditor, changes: LineChange[]): Promise<void> {
@@ -1083,7 +1091,6 @@ export class CommandCenter {
const originalUri = toGitUri(modifiedUri, '~');
const originalDocument = await workspace.openTextDocument(originalUri);
const selectionsBeforeRevert = textEditor.selections;
const visibleRangesBeforeRevert = textEditor.visibleRanges;
const result = applyLineChanges(originalDocument, modifiedDocument, changes);
@@ -1093,7 +1100,6 @@ export class CommandCenter {
await modifiedDocument.save();
textEditor.selections = selectionsBeforeRevert;
textEditor.revealRange(visibleRangesBeforeRevert[0]);
}
@@ -1435,6 +1441,26 @@ export class CommandCenter {
return false;
}
if (opts.noVerify) {
if (!config.get<boolean>('allowNoVerifyCommit')) {
await window.showErrorMessage(localize('no verify commit not allowed', "Commits without verification are not allowed, please enable them with the 'git.allowNoVerifyCommit' setting."));
return false;
}
if (config.get<boolean>('confirmNoVerifyCommit')) {
const message = localize('confirm no verify commit', "You are about to commit your changes without verification, this skips pre-commit hooks and can be undesirable.\n\nAre you sure to continue?");
const yes = localize('ok', "OK");
const neverAgain = localize('never ask again', "OK, Don't Ask Again");
const pick = await window.showWarningMessage(message, { modal: true }, yes, neverAgain);
if (pick === neverAgain) {
config.update('confirmNoVerifyCommit', false, true);
} else if (pick !== yes) {
return false;
}
}
}
const message = await getCommitMessage();
if (!message) {
@@ -1539,8 +1565,7 @@ export class CommandCenter {
await this.commitWithAnyInput(repository, { all: true, amend: true });
}
@command('git.commitEmpty', { repository: true })
async commitEmpty(repository: Repository): Promise<void> {
private async _commitEmpty(repository: Repository, noVerify?: boolean): Promise<void> {
const root = Uri.file(repository.root);
const config = workspace.getConfiguration('git', root);
const shouldPrompt = config.get<boolean>('confirmEmptyCommits') === true;
@@ -1558,7 +1583,52 @@ export class CommandCenter {
}
}
await this.commitWithAnyInput(repository, { empty: true });
await this.commitWithAnyInput(repository, { empty: true, noVerify });
}
@command('git.commitEmpty', { repository: true })
async commitEmpty(repository: Repository): Promise<void> {
await this._commitEmpty(repository);
}
@command('git.commitNoVerify', { repository: true })
async commitNoVerify(repository: Repository): Promise<void> {
await this.commitWithAnyInput(repository, { noVerify: true });
}
@command('git.commitStagedNoVerify', { repository: true })
async commitStagedNoVerify(repository: Repository): Promise<void> {
await this.commitWithAnyInput(repository, { all: false, noVerify: true });
}
@command('git.commitStagedSignedNoVerify', { repository: true })
async commitStagedSignedNoVerify(repository: Repository): Promise<void> {
await this.commitWithAnyInput(repository, { all: false, signoff: true, noVerify: true });
}
@command('git.commitStagedAmendNoVerify', { repository: true })
async commitStagedAmendNoVerify(repository: Repository): Promise<void> {
await this.commitWithAnyInput(repository, { all: false, amend: true, noVerify: true });
}
@command('git.commitAllNoVerify', { repository: true })
async commitAllNoVerify(repository: Repository): Promise<void> {
await this.commitWithAnyInput(repository, { all: true, noVerify: true });
}
@command('git.commitAllSignedNoVerify', { repository: true })
async commitAllSignedNoVerify(repository: Repository): Promise<void> {
await this.commitWithAnyInput(repository, { all: true, signoff: true, noVerify: true });
}
@command('git.commitAllAmendNoVerify', { repository: true })
async commitAllAmendNoVerify(repository: Repository): Promise<void> {
await this.commitWithAnyInput(repository, { all: true, amend: true, noVerify: true });
}
@command('git.commitEmptyNoVerify', { repository: true })
async commitEmptyNoVerify(repository: Repository): Promise<void> {
await this._commitEmpty(repository, true);
}
@command('git.restoreCommitTemplate', { repository: true })

View File

@@ -21,7 +21,7 @@ class GitIgnoreDecorationProvider implements DecorationProvider {
constructor(private model: Model) {
this.onDidChangeDecorations = fireEvent(anyEvent<any>(
filterEvent(workspace.onDidSaveTextDocument, e => e.fileName.endsWith('.gitignore')),
filterEvent(workspace.onDidSaveTextDocument, e => /\.gitignore$|\.git\/info\/exclude$/.test(e.uri.path)),
model.onDidOpenRepository,
model.onDidCloseRepository
));

View File

@@ -139,18 +139,28 @@ function findGitWin32(onLookup: (path: string) => void): Promise<IGit> {
.then(undefined, () => findGitWin32InPath(onLookup));
}
export function findGit(hint: string | undefined, onLookup: (path: string) => void): Promise<IGit> {
const first = hint ? findSpecificGit(hint, onLookup) : Promise.reject<IGit>(null);
export async function findGit(hint: string | string[] | undefined, onLookup: (path: string) => void): Promise<IGit> {
const hints = Array.isArray(hint) ? hint : hint ? [hint] : [];
return first
.then(undefined, () => {
switch (process.platform) {
case 'darwin': return findGitDarwin(onLookup);
case 'win32': return findGitWin32(onLookup);
default: return findSpecificGit('git', onLookup);
}
})
.then(null, () => Promise.reject(new Error('Git installation not found.')));
for (const hint of hints) {
try {
return await findSpecificGit(hint, onLookup);
} catch {
// noop
}
}
try {
switch (process.platform) {
case 'darwin': return await findGitDarwin(onLookup);
case 'win32': return await findGitWin32(onLookup);
default: return await findSpecificGit('git', onLookup);
}
} catch {
// noop
}
throw new Error('Git installation not found.');
}
export interface IExecutionResult<T extends string | Buffer> {
@@ -1322,10 +1332,15 @@ export class Repository {
if (opts.signCommit) {
args.push('-S');
}
if (opts.empty) {
args.push('--allow-empty');
}
if (opts.noVerify) {
args.push('--no-verify');
}
try {
await this.run(args, { input: message || '' });
} catch (commitErr) {

View File

@@ -33,7 +33,7 @@ export async function deactivate(): Promise<any> {
}
async function createModel(context: ExtensionContext, outputChannel: OutputChannel, telemetryReporter: TelemetryReporter, disposables: Disposable[]): Promise<Model> {
const pathHint = workspace.getConfiguration('git').get<string>('path');
const pathHint = workspace.getConfiguration('git').get<string | string[]>('path');
const info = await findGit(pathHint, path => outputChannel.appendLine(localize('looking', "Looking for git in: {0}", path)));
const askpass = await Askpass.create(outputChannel, context.storagePath);

View File

@@ -6,7 +6,7 @@
import { workspace, WorkspaceFoldersChangeEvent, Uri, window, Event, EventEmitter, QuickPickItem, Disposable, SourceControl, SourceControlResourceGroup, TextEditor, Memento, OutputChannel, commands } from 'vscode';
import { Repository, RepositoryState } from './repository';
import { memoize, sequentialize, debounce } from './decorators';
import { dispose, anyEvent, filterEvent, isDescendant, firstIndex, pathEquals, toDisposable, eventToPromise } from './util';
import { dispose, anyEvent, filterEvent, isDescendant, pathEquals, toDisposable, eventToPromise } from './util';
import { Git } from './git';
import * as path from 'path';
import * as fs from 'fs';
@@ -372,7 +372,7 @@ export class Model implements IRemoteSourceProviderRegistry, IPushErrorHandlerRe
const picks = this.openRepositories.map((e, index) => new RepositoryPick(e.repository, index));
const active = window.activeTextEditor;
const repository = active && this.getRepository(active.document.fileName);
const index = firstIndex(picks, pick => pick.repository === repository);
const index = picks.findIndex(pick => pick.repository === repository);
// Move repository pick containing the active text editor to appear first
if (index > -1) {

View File

@@ -182,16 +182,6 @@ export function uniqueFilter<T>(keyFn: (t: T) => string): (t: T) => boolean {
};
}
export function firstIndex<T>(array: T[], fn: (t: T) => boolean): number {
for (let i = 0; i < array.length; i++) {
if (fn(array[i])) {
return i;
}
}
return -1;
}
export function find<T>(array: T[], fn: (t: T) => boolean): T | undefined {
let result: T | undefined = undefined;