Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main'
Browse files Browse the repository at this point in the history
  • Loading branch information
dabreadman committed Sep 9, 2024
2 parents 93a4214 + dcc7af1 commit bdd8006
Show file tree
Hide file tree
Showing 90 changed files with 1,174 additions and 1,314 deletions.
2 changes: 1 addition & 1 deletion build/azure-pipelines/cli/install-rust-posix.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
parameters:
- name: channel
type: string
default: 1.77
default: 1.81
- name: targets
default: []
type: object
Expand Down
2 changes: 1 addition & 1 deletion build/azure-pipelines/cli/install-rust-win32.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
parameters:
- name: channel
type: string
default: 1.77
default: 1.81
- name: targets
default: []
type: object
Expand Down
5 changes: 0 additions & 5 deletions build/gulpfile.extensions.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@ const tasks = compilations.map(function (tsconfigFile) {
}

function createPipeline(build, emitError, transpileOnly) {
const nlsDev = require('vscode-nls-dev');
const tsb = require('./lib/tsb');
const sourcemaps = require('gulp-sourcemaps');

Expand All @@ -126,7 +125,6 @@ const tasks = compilations.map(function (tsconfigFile) {
.pipe(tsFilter)
.pipe(util.loadSourcemaps())
.pipe(compilation())
.pipe(build ? nlsDev.rewriteLocalizeCalls() : es.through())
.pipe(build ? util.stripSourceMappingURL() : es.through())
.pipe(sourcemaps.write('.', {
sourceMappingURL: !build ? null : f => `${baseUrl}/${f.relative}.map`,
Expand All @@ -136,9 +134,6 @@ const tasks = compilations.map(function (tsconfigFile) {
sourceRoot: '../src/',
}))
.pipe(tsFilter.restore)
.pipe(build ? nlsDev.bundleMetaDataFiles(headerId, headerOut) : es.through())
// Filter out *.nls.json file. We needed them only to bundle meta data file.
.pipe(filter(['**', '!**/*.nls.json'], { dot: true }))
.pipe(reporter.end(emitError));

return es.duplex(input, output);
Expand Down
1 change: 0 additions & 1 deletion extensions/configuration-editing/.vscodeignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ tsconfig.json
out/**
extension.webpack.config.js
extension-browser.webpack.config.js
yarn.lock
package-lock.json
build/**
schemas/devContainer.codespaces.schema.json
Expand Down
2 changes: 0 additions & 2 deletions extensions/css-language-features/.vscodeignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,8 @@ server/tsconfig.json
server/test/**
server/bin/**
server/build/**
server/yarn.lock
server/package-lock.json
server/.npmignore
yarn.lock
package-lock.json
server/extension.webpack.config.js
extension.webpack.config.js
Expand Down
1 change: 0 additions & 1 deletion extensions/debug-auto-launch/.vscodeignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,4 @@ src/**
tsconfig.json
out/**
extension.webpack.config.js
yarn.lock
package-lock.json
1 change: 0 additions & 1 deletion extensions/debug-server-ready/.vscodeignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,5 @@ src/**
tsconfig.json
out/**
extension.webpack.config.js
yarn.lock
package-lock.json
.vscode
1 change: 0 additions & 1 deletion extensions/emmet/.vscodeignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,5 @@ extension.webpack.config.js
extension-browser.webpack.config.js
CONTRIBUTING.md
cgmanifest.json
yarn.lock
package-lock.json
.vscode
1 change: 0 additions & 1 deletion extensions/extension-editing/.vscodeignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,4 @@ tsconfig.json
out/**
extension.webpack.config.js
extension-browser.webpack.config.js
yarn.lock
package-lock.json
1 change: 0 additions & 1 deletion extensions/git/.vscodeignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,4 @@ out/**
tsconfig.json
build/**
extension.webpack.config.js
yarn.lock
package-lock.json
2 changes: 1 addition & 1 deletion extensions/git/src/decorationProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ class GitIncomingChangesFileDecorationProvider implements FileDecorationProvider
return [];
}

const ancestor = await historyProvider.resolveHistoryItemGroupCommonAncestor([currentHistoryItemGroup.id, currentHistoryItemGroup.remote.id]);
const ancestor = await historyProvider.resolveHistoryItemRefsCommonAncestor([currentHistoryItemGroup.id, currentHistoryItemGroup.remote.id]);
if (!ancestor) {
return [];
}
Expand Down
126 changes: 98 additions & 28 deletions extensions/git/src/historyProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*--------------------------------------------------------------------------------------------*/


import { Disposable, Event, EventEmitter, FileDecoration, FileDecorationProvider, SourceControlHistoryItem, SourceControlHistoryItemChange, SourceControlHistoryItemGroup, SourceControlHistoryOptions, SourceControlHistoryProvider, ThemeIcon, Uri, window, LogOutputChannel, SourceControlHistoryItemLabel } from 'vscode';
import { Disposable, Event, EventEmitter, FileDecoration, FileDecorationProvider, SourceControlHistoryItem, SourceControlHistoryItemChange, SourceControlHistoryItemGroup, SourceControlHistoryOptions, SourceControlHistoryProvider, ThemeIcon, Uri, window, LogOutputChannel, SourceControlHistoryChangeEvent, SourceControlHistoryItemRef, l10n } from 'vscode';
import { Repository, Resource } from './repository';
import { IDisposable, dispose } from './util';
import { toGitUri } from './uri';
Expand All @@ -17,6 +17,9 @@ export class GitHistoryProvider implements SourceControlHistoryProvider, FileDec
private readonly _onDidChangeCurrentHistoryItemGroup = new EventEmitter<void>();
readonly onDidChangeCurrentHistoryItemGroup: Event<void> = this._onDidChangeCurrentHistoryItemGroup.event;

private readonly _onDidChangeHistory = new EventEmitter<SourceControlHistoryChangeEvent>();
readonly onDidChangeHistory: Event<SourceControlHistoryChangeEvent> = this._onDidChangeHistory.event;

private readonly _onDidChangeDecorations = new EventEmitter<Uri[]>();
readonly onDidChangeFileDecorations: Event<Uri[]> = this._onDidChangeDecorations.event;

Expand All @@ -28,12 +31,6 @@ export class GitHistoryProvider implements SourceControlHistoryProvider, FileDec
}

private historyItemDecorations = new Map<string, FileDecoration>();
private historyItemLabels = new Map<string, ThemeIcon>([
['HEAD -> refs/heads/', new ThemeIcon('target')],
['tag: refs/tags/', new ThemeIcon('tag')],
['refs/heads/', new ThemeIcon('git-branch')],
['refs/remotes/', new ThemeIcon('cloud')],
]);

private disposables: Disposable[] = [];

Expand Down Expand Up @@ -85,13 +82,58 @@ export class GitHistoryProvider implements SourceControlHistoryProvider, FileDec
this.logger.trace(`[GitHistoryProvider][onDidRunGitStatus] currentHistoryItemGroup: ${JSON.stringify(this.currentHistoryItemGroup)}`);
}

async provideHistoryItemRefs(): Promise<SourceControlHistoryItemRef[]> {
const refs = await this.repository.getRefs();

const branches: SourceControlHistoryItemRef[] = [];
const remoteBranches: SourceControlHistoryItemRef[] = [];
const tags: SourceControlHistoryItemRef[] = [];

for (const ref of refs) {
switch (ref.type) {
case RefType.RemoteHead:
remoteBranches.push({
id: `refs/remotes/${ref.remote}/${ref.name}`,
name: ref.name ?? '',
description: ref.commit ? l10n.t('Remote branch at {0}', ref.commit.substring(0, 8)) : undefined,
revision: ref.commit,
icon: new ThemeIcon('cloud'),
category: l10n.t('remote branches')
});
break;
case RefType.Tag:
tags.push({
id: `refs/tags/${ref.name}`,
name: ref.name ?? '',
description: ref.commit ? l10n.t('Tag at {0}', ref.commit.substring(0, 8)) : undefined,
revision: ref.commit,
icon: new ThemeIcon('tag'),
category: l10n.t('tags')
});
break;
default:
branches.push({
id: `refs/heads/${ref.name}`,
name: ref.name ?? '',
description: ref.commit ? ref.commit.substring(0, 8) : undefined,
revision: ref.commit,
icon: new ThemeIcon('git-branch'),
category: l10n.t('branches')
});
break;
}
}

return [...branches, ...remoteBranches, ...tags];
}

async provideHistoryItems(options: SourceControlHistoryOptions): Promise<SourceControlHistoryItem[]> {
if (!this.currentHistoryItemGroup || !options.historyItemGroupIds) {
if (!this.currentHistoryItemGroup || !options.historyItemRefs) {
return [];
}

// Deduplicate refNames
const refNames = Array.from(new Set<string>(options.historyItemGroupIds));
const refNames = Array.from(new Set<string>(options.historyItemRefs));

let logOptions: LogOptions = { refNames, shortStats: true };

Expand All @@ -115,7 +157,7 @@ export class GitHistoryProvider implements SourceControlHistoryProvider, FileDec
await ensureEmojis();

return commits.map(commit => {
const labels = this.resolveHistoryItemLabels(commit);
const references = this.resolveHistoryItemRefs(commit);

return {
id: commit.hash,
Expand All @@ -126,7 +168,7 @@ export class GitHistoryProvider implements SourceControlHistoryProvider, FileDec
displayId: commit.hash.substring(0, 8),
timestamp: commit.authorDate?.getTime(),
statistics: commit.shortStat ?? { files: 0, insertions: 0, deletions: 0 },
labels: labels.length !== 0 ? labels : undefined
references: references.length !== 0 ? references : undefined
};
});
} catch (err) {
Expand Down Expand Up @@ -169,21 +211,21 @@ export class GitHistoryProvider implements SourceControlHistoryProvider, FileDec
return historyItemChanges;
}

async resolveHistoryItemGroupCommonAncestor(historyItemGroupIds: string[]): Promise<string | undefined> {
async resolveHistoryItemRefsCommonAncestor(historyItemRefs: string[]): Promise<string | undefined> {
try {
if (historyItemGroupIds.length === 0) {
if (historyItemRefs.length === 0) {
// TODO@lszomoru - log
return undefined;
} else if (historyItemGroupIds.length === 1 && historyItemGroupIds[0] === this.currentHistoryItemGroup?.id) {
} else if (historyItemRefs.length === 1 && historyItemRefs[0] === this.currentHistoryItemGroup?.id) {
// Remote
if (this.currentHistoryItemGroup.remote) {
const ancestor = await this.repository.getMergeBase(historyItemGroupIds[0], this.currentHistoryItemGroup.remote.id);
const ancestor = await this.repository.getMergeBase(historyItemRefs[0], this.currentHistoryItemGroup.remote.id);
return ancestor;
}

// Base
if (this.currentHistoryItemGroup.base) {
const ancestor = await this.repository.getMergeBase(historyItemGroupIds[0], this.currentHistoryItemGroup.base.id);
const ancestor = await this.repository.getMergeBase(historyItemRefs[0], this.currentHistoryItemGroup.base.id);
return ancestor;
}

Expand All @@ -192,13 +234,13 @@ export class GitHistoryProvider implements SourceControlHistoryProvider, FileDec
if (commits.length > 0) {
return commits[0].hash;
}
} else if (historyItemGroupIds.length > 1) {
const ancestor = await this.repository.getMergeBase(historyItemGroupIds[0], historyItemGroupIds[1], ...historyItemGroupIds.slice(2));
} else if (historyItemRefs.length > 1) {
const ancestor = await this.repository.getMergeBase(historyItemRefs[0], historyItemRefs[1], ...historyItemRefs.slice(2));
return ancestor;
}
}
catch (err) {
this.logger.error(`[GitHistoryProvider][resolveHistoryItemGroupCommonAncestor] Failed to resolve common ancestor for ${historyItemGroupIds.join(',')}: ${err}`);
this.logger.error(`[GitHistoryProvider][resolveHistoryItemRefsCommonAncestor] Failed to resolve common ancestor for ${historyItemRefs.join(',')}: ${err}`);
}

return undefined;
Expand All @@ -208,19 +250,47 @@ export class GitHistoryProvider implements SourceControlHistoryProvider, FileDec
return this.historyItemDecorations.get(uri.toString());
}

private resolveHistoryItemLabels(commit: Commit): SourceControlHistoryItemLabel[] {
const labels: SourceControlHistoryItemLabel[] = [];

for (const label of commit.refNames) {
for (const [key, value] of this.historyItemLabels) {
if (label.startsWith(key)) {
labels.push({ title: label.substring(key.length), icon: value });
private resolveHistoryItemRefs(commit: Commit): SourceControlHistoryItemRef[] {
const references: SourceControlHistoryItemRef[] = [];

for (const ref of commit.refNames) {
switch (true) {
case ref.startsWith('HEAD -> refs/heads/'):
references.push({
id: ref.substring('HEAD -> '.length),
name: ref.substring('HEAD -> refs/heads/'.length),
revision: commit.hash,
icon: new ThemeIcon('target')
});
break;
case ref.startsWith('tag: refs/tags/'):
references.push({
id: ref.substring('tag: '.length),
name: ref.substring('tag: refs/tags/'.length),
revision: commit.hash,
icon: new ThemeIcon('tag')
});
break;
case ref.startsWith('refs/heads/'):
references.push({
id: ref,
name: ref.substring('refs/heads/'.length),
revision: commit.hash,
icon: new ThemeIcon('git-branch')
});
break;
case ref.startsWith('refs/remotes/'):
references.push({
id: ref,
name: ref.substring('refs/remotes/'.length),
revision: commit.hash,
icon: new ThemeIcon('cloud')
});
break;
}
}
}

return labels;
return references;
}

private async resolveHEADMergeBase(): Promise<Branch | undefined> {
Expand Down
1 change: 0 additions & 1 deletion extensions/github-authentication/.vscodeignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,4 @@ build/**
extension.webpack.config.js
extension-browser.webpack.config.js
tsconfig.json
yarn.lock
package-lock.json
1 change: 0 additions & 1 deletion extensions/github/.vscodeignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,4 @@ out/**
build/**
extension.webpack.config.js
tsconfig.json
yarn.lock
package-lock.json
1 change: 0 additions & 1 deletion extensions/grunt/.vscodeignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,4 @@ src/**
tsconfig.json
out/**
extension.webpack.config.js
yarn.lock
package-lock.json
1 change: 0 additions & 1 deletion extensions/gulp/.vscodeignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,4 @@ src/**
tsconfig.json
out/**
extension.webpack.config.js
yarn.lock
package-lock.json
2 changes: 0 additions & 2 deletions extensions/html-language-features/.vscodeignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,8 @@ server/test/**
server/bin/**
server/build/**
server/lib/cgmanifest.json
server/yarn.lock
server/package-lock.json
server/.npmignore
yarn.lock
package-lock.json
server/extension.webpack.config.js
extension.webpack.config.js
Expand Down
1 change: 0 additions & 1 deletion extensions/ipynb/.vscodeignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ out/**
tsconfig.json
extension.webpack.config.js
extension-browser.webpack.config.js
yarn.lock
package-lock.json
.gitignore
esbuild.js
1 change: 0 additions & 1 deletion extensions/jake/.vscodeignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,4 @@ src/**
tsconfig.json
out/**
extension.webpack.config.js
yarn.lock
package-lock.json
2 changes: 0 additions & 2 deletions extensions/json-language-features/.vscodeignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,9 @@ server/tsconfig.json
server/test/**
server/bin/**
server/build/**
server/yarn.lock
server/package-lock.json
server/.npmignore
server/README.md
yarn.lock
package-lock.json
CONTRIBUTING.md
server/extension.webpack.config.js
Expand Down
1 change: 0 additions & 1 deletion extensions/json-language-features/server/.npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ src/
test/
tsconfig.json
.gitignore
yarn.lock
package-lock.json
extension.webpack.config.js
vscode-json-languageserver-*.tgz
1 change: 0 additions & 1 deletion extensions/markdown-language-features/.vscodeignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ out/**
extension.webpack.config.js
extension-browser.webpack.config.js
cgmanifest.json
yarn.lock
package-lock.json
preview-src/**
webpack.config.js
Expand Down
Loading

0 comments on commit bdd8006

Please sign in to comment.