Archived
1
0

chore(vscode): update to 1.56.0

This commit is contained in:
Akash Satheesan
2021-04-30 20:25:17 +05:30
1749 changed files with 88014 additions and 43316 deletions

View File

@ -26,6 +26,12 @@
"update-grammar": "node ./build/update-grammars.js",
"test": "node ../../node_modules/mocha/bin/mocha"
},
"capabilities": {
"virtualWorkspaces": true,
"untrustedWorkspaces": {
"supported": true
}
},
"contributes": {
"commands": [
{
@ -1686,19 +1692,10 @@
"default": true
},
"git.autofetch": {
"anyOf": [
{
"type": "boolean"
},
{
"type": "string",
"enum": [
"all"
]
}
],
"type": ["boolean", "string"],
"enum": [true, false, "all"],
"scope": "resource",
"description": "%config.autofetch%",
"markdownDescription": "%config.autofetch%",
"default": false,
"tags": [
"usesOnlineServices"
@ -1707,7 +1704,7 @@
"git.autofetchPeriod": {
"type": "number",
"scope": "resource",
"description": "%config.autofetchPeriod%",
"markdownDescription": "%config.autofetchPeriod%",
"default": 180
},
"git.branchValidationRegex": {
@ -2378,7 +2375,7 @@
"byline": "^5.0.0",
"file-type": "^7.2.0",
"iconv-lite-umd": "0.6.8",
"jschardet": "2.2.1",
"jschardet": "2.3.0",
"vscode-extension-telemetry": "0.1.7",
"vscode-nls": "^4.0.0",
"vscode-uri": "^2.0.0",

View File

@ -101,7 +101,7 @@
"config.autoRepositoryDetection.openEditors": "Scan for parent folders of open files.",
"config.autorefresh": "Whether auto refreshing is enabled.",
"config.autofetch": "When set to true, commits will automatically be fetched from the default remote of the current Git repository. Setting to `all` will fetch from all remotes.",
"config.autofetchPeriod": "Duration in seconds between each automatic git fetch, when `git.autofetch` is enabled.",
"config.autofetchPeriod": "Duration in seconds between each automatic git fetch, when `#git.autofetch#` is enabled.",
"config.confirmSync": "Confirm before synchronizing git repositories.",
"config.countBadge": "Controls the Git count badge.",
"config.countBadge.all": "Count all changes.",

View File

@ -43,18 +43,18 @@ class CheckoutItem implements QuickPickItem {
class CheckoutTagItem extends CheckoutItem {
get description(): string {
override get description(): string {
return localize('tag at', "Tag at {0}", this.shortCommit);
}
}
class CheckoutRemoteHeadItem extends CheckoutItem {
get description(): string {
override get description(): string {
return localize('remote branch at', "Remote branch at {0}", this.shortCommit);
}
async run(repository: Repository, opts?: { detached?: boolean }): Promise<void> {
override async run(repository: Repository, opts?: { detached?: boolean }): Promise<void> {
if (!this.ref.name) {
return;
}
@ -797,7 +797,7 @@ export class CommandCenter {
return;
}
const from = path.relative(repository.root, fromUri.path);
const from = path.relative(repository.root, fromUri.fsPath);
let to = await window.showInputBox({
value: from,
valueSelection: [from.length - path.basename(from).length, from.length]

View File

@ -11,7 +11,7 @@ import * as which from 'which';
import { EventEmitter } from 'events';
import * as iconv from 'iconv-lite-umd';
import * as filetype from 'file-type';
import { assign, groupBy, IDisposable, toDisposable, dispose, mkdirp, readBytes, detectUnicodeEncoding, Encoding, onceEvent, splitInChunks, Limiter } from './util';
import { assign, groupBy, IDisposable, toDisposable, dispose, mkdirp, readBytes, detectUnicodeEncoding, Encoding, onceEvent, splitInChunks, Limiter, Versions } from './util';
import { CancellationToken, Progress, Uri } from 'vscode';
import { detectEncoding } from './encoding';
import { Ref, RefType, Branch, Remote, ForcePushMode, GitErrorCodes, LogOptions, Change, Status, CommitOptions, BranchQuery } from './api/git';
@ -377,6 +377,10 @@ export class Git {
this.env = options.env || {};
}
compareGitVersionTo(version: string): -1 | 0 | 1 {
return Versions.compare(Versions.fromString(this.version), Versions.fromString(version));
}
open(repository: string, dotGit: string): Repository {
return new Repository(this, repository, dotGit);
}
@ -1977,7 +1981,16 @@ export class Repository {
return this.getHEAD();
}
const args = ['for-each-ref', '--format=%(refname)%00%(upstream:short)%00%(upstream:track)%00%(objectname)'];
const args = ['for-each-ref'];
let supportsAheadBehind = true;
if (this._git.compareGitVersionTo('1.9.0') === -1) {
args.push('--format=%(refname)%00%(upstream:short)%00%(objectname)');
supportsAheadBehind = false;
} else {
args.push('--format=%(refname)%00%(upstream:short)%00%(objectname)%00%(upstream:track)');
}
if (/^refs\/(head|remotes)\//i.test(name)) {
args.push(name);
} else {
@ -1986,7 +1999,7 @@ export class Repository {
const result = await this.exec(args);
const branches: Branch[] = result.stdout.trim().split('\n').map<Branch | undefined>(line => {
let [branchName, upstream, status, ref] = line.trim().split('\0');
let [branchName, upstream, ref, status] = line.trim().split('\0');
if (branchName.startsWith('refs/heads/')) {
branchName = branchName.substring(11);
@ -2026,7 +2039,19 @@ export class Repository {
}).filter((b?: Branch): b is Branch => !!b);
if (branches.length) {
return branches[0];
const [branch] = branches;
if (!supportsAheadBehind && branch.upstream) {
try {
const result = await this.exec(['rev-list', '--left-right', '--count', `${branch.name}...${branch.upstream.remote}/${branch.upstream.name}`]);
const [ahead, behind] = result.stdout.trim().split('\t');
(branch as any).ahead = Number(ahead) || 0;
(branch as any).behind = Number(behind) || 0;
} catch { }
}
return branch;
}
return Promise.reject<Branch>(new Error('No such branch'));

View File

@ -1835,7 +1835,10 @@ export class Repository implements Disposable {
// noop
}
const sort = config.get<'alphabetically' | 'committerdate'>('branchSortOrder') || 'alphabetically';
let sort = config.get<'alphabetically' | 'committerdate'>('branchSortOrder') || 'alphabetically';
if (sort !== 'alphabetically' && sort !== 'committerdate') {
sort = 'alphabetically';
}
const [refs, remotes, submodules, rebaseCommit] = await Promise.all([this.repository.getRefs({ sort }), this.repository.getRemotes(), this.repository.getSubmodules(), this.getRebaseCommit()]);
this._HEAD = HEAD;

View File

@ -8,7 +8,7 @@ const testRunner = require('../../../../test/integration/electron/testrunner');
const options: any = {
ui: 'tdd',
color: (!process.env.BUILD_ARTIFACTSTAGINGDIRECTORY && process.platform !== 'win32'),
color: true,
timeout: 60000
};

View File

@ -45,8 +45,10 @@ suite('git smoke test', function () {
cp.execSync('git init', { cwd });
cp.execSync('git config user.name testuser', { cwd });
cp.execSync('git config user.email monacotools@microsoft.com', { cwd });
cp.execSync('git config commit.gpgsign false', { cwd });
cp.execSync('git add .', { cwd });
cp.execSync('git commit -m "initial commit"', { cwd });
cp.execSync('git branch -m main', { cwd });
// make sure git is activated
const ext = extensions.getExtension<GitExtension>('vscode.git');
@ -124,7 +126,7 @@ suite('git smoke test', function () {
assert.equal(repository.state.workingTreeChanges.length, 0);
assert.equal(repository.state.indexChanges.length, 0);
});
test('rename/delete conflict', async function () {
cp.execSync('git branch test', { cwd });
cp.execSync('git checkout test', { cwd });
@ -133,16 +135,16 @@ suite('git smoke test', function () {
cp.execSync('git add .', { cwd });
await repository.commit('commit on test');
cp.execSync('git checkout master', { cwd });
cp.execSync('git checkout main', { cwd });
fs.renameSync(file('app.js'), file('rename.js'));
cp.execSync('git add .', { cwd });
await repository.commit('commit on master');
await repository.commit('commit on main');
try {
cp.execSync('git merge test', { cwd });
} catch (e) { }
setTimeout(() => {
commands.executeCommand('workbench.scm.focus');
}, 2e3);

View File

@ -414,3 +414,56 @@ export class PromiseSource<T> {
}
}
}
export namespace Versions {
declare type VersionComparisonResult = -1 | 0 | 1;
export interface Version {
major: number;
minor: number;
patch: number;
pre?: string;
}
export function compare(v1: string | Version, v2: string | Version): VersionComparisonResult {
if (typeof v1 === 'string') {
v1 = fromString(v1);
}
if (typeof v2 === 'string') {
v2 = fromString(v2);
}
if (v1.major > v2.major) { return 1; }
if (v1.major < v2.major) { return -1; }
if (v1.minor > v2.minor) { return 1; }
if (v1.minor < v2.minor) { return -1; }
if (v1.patch > v2.patch) { return 1; }
if (v1.patch < v2.patch) { return -1; }
if (v1.pre === undefined && v2.pre !== undefined) { return 1; }
if (v1.pre !== undefined && v2.pre === undefined) { return -1; }
if (v1.pre !== undefined && v2.pre !== undefined) {
return v1.pre.localeCompare(v2.pre) as VersionComparisonResult;
}
return 0;
}
export function from(major: string | number, minor: string | number, patch?: string | number, pre?: string): Version {
return {
major: typeof major === 'string' ? parseInt(major, 10) : major,
minor: typeof minor === 'string' ? parseInt(minor, 10) : minor,
patch: patch === undefined || patch === null ? 0 : typeof patch === 'string' ? parseInt(patch, 10) : patch,
pre: pre,
};
}
export function fromString(version: string): Version {
const [ver, pre] = version.split('-');
const [major, minor, patch] = ver.split('.');
return from(major, minor, patch, pre);
}
}

View File

@ -1,5 +1,5 @@
{
"extends": "../shared.tsconfig.json",
"extends": "../tsconfig.base.json",
"compilerOptions": {
"outDir": "./out",
"experimentalDecorators": true,
@ -10,4 +10,4 @@
"include": [
"src/**/*"
]
}
}

View File

@ -117,10 +117,10 @@ isexe@^2.0.0:
resolved "https://registry.yarnpkg.com/isexe/-/isexe-2.0.0.tgz#e8fbf374dc556ff8947a10dcb0572d633f2cfa10"
integrity sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=
jschardet@2.2.1:
version "2.2.1"
resolved "https://registry.yarnpkg.com/jschardet/-/jschardet-2.2.1.tgz#03b0264669a90c7a5c436a68c5a7d4e4cb0c9823"
integrity sha512-Ks2JNuUJoc7PGaZ7bVFtSEvOcr0rBq6Q1J5/7+zKWLT+g+4zziL63O0jg7y2jxhzIa1LVsHUbPXrbaWmz9iwDw==
jschardet@2.3.0:
version "2.3.0"
resolved "https://registry.yarnpkg.com/jschardet/-/jschardet-2.3.0.tgz#06e2636e16c8ada36feebbdc08aa34e6a9b3ff75"
integrity sha512-6I6xT7XN/7sBB7q8ObzKbmv5vN+blzLcboDE1BNEsEfmRXJValMxO6OIRT69ylPBRemS3rw6US+CMCar0OBc9g==
semver@^5.3.0:
version "5.5.0"