Skip to content

Commit e14b2ab

Browse files
committed
Merge remote-tracking branch 'origin/master' into pr/baileyherbert/90631
2 parents e3dc04a + bb04e41 commit e14b2ab

150 files changed

Lines changed: 4174 additions & 1627 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

build/builtInExtensions.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
},
4747
{
4848
"name": "ms-vscode.js-debug-nightly",
49-
"version": "2020.2.1117",
49+
"version": "2020.2.1317",
5050
"forQualities": [
5151
"insider"
5252
],

extensions/git/package.json

Lines changed: 78 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -447,6 +447,22 @@
447447
"command": "git.stashDrop",
448448
"title": "%command.stashDrop%",
449449
"category": "Git"
450+
},
451+
{
452+
"command": "git.timeline.openDiff",
453+
"title": "%command.timelineOpenDiff%",
454+
"icon": "$(compare-changes)",
455+
"category": "Git"
456+
},
457+
{
458+
"command": "git.timeline.copyCommitId",
459+
"title": "%command.timelineCopyCommitId%",
460+
"category": "Git"
461+
},
462+
{
463+
"command": "git.timeline.copyCommitMessage",
464+
"title": "%command.timelineCopyCommitMessage%",
465+
"category": "Git"
450466
}
451467
],
452468
"menus": {
@@ -718,14 +734,21 @@
718734
{
719735
"command": "git.stashDrop",
720736
"when": "config.git.enabled && gitOpenRepositoryCount != 0"
737+
},
738+
{
739+
"command": "git.timeline.openDiff",
740+
"when": "false"
741+
},
742+
{
743+
"command": "git.timeline.copyCommitId",
744+
"when": "false"
745+
},
746+
{
747+
"command": "git.timeline.copyCommitMessage",
748+
"when": "false"
721749
}
722750
],
723751
"scm/title": [
724-
{
725-
"command": "git.init",
726-
"group": "navigation",
727-
"when": "config.git.enabled && !scmProvider && gitOpenRepositoryCount == 0 && workspaceFolderCount != 0"
728-
},
729752
{
730753
"command": "git.commit",
731754
"group": "navigation",
@@ -1248,6 +1271,28 @@
12481271
"command": "git.revertChange",
12491272
"when": "originalResourceScheme == git"
12501273
}
1274+
],
1275+
"timeline/item/context": [
1276+
{
1277+
"command": "git.timeline.openDiff",
1278+
"group": "inline",
1279+
"when": "timelineItem =~ /git:file\\b/"
1280+
},
1281+
{
1282+
"command": "git.timeline.openDiff",
1283+
"group": "1_timeline",
1284+
"when": "timelineItem =~ /git:file\\b/"
1285+
},
1286+
{
1287+
"command": "git.timeline.copyCommitId",
1288+
"group": "2_timeline@1",
1289+
"when": "timelineItem =~ /git:file:commit\\b/"
1290+
},
1291+
{
1292+
"command": "git.timeline.copyCommitMessage",
1293+
"group": "2_timeline@2",
1294+
"when": "timelineItem =~ /git:file:commit\\b/"
1295+
}
12511296
]
12521297
},
12531298
"configuration": {
@@ -1761,7 +1806,34 @@
17611806
72
17621807
]
17631808
}
1764-
}
1809+
},
1810+
"viewsWelcome": [
1811+
{
1812+
"view": "workbench.scm",
1813+
"contents": "%view.workbench.scm.disabled%",
1814+
"when": "!config.git.enabled"
1815+
},
1816+
{
1817+
"view": "workbench.scm",
1818+
"contents": "%view.workbench.scm.missing%",
1819+
"when": "config.git.enabled && git.missing"
1820+
},
1821+
{
1822+
"view": "workbench.scm",
1823+
"contents": "%view.workbench.scm.empty%",
1824+
"when": "config.git.enabled && !git.missing && workbenchState == empty"
1825+
},
1826+
{
1827+
"view": "workbench.scm",
1828+
"contents": "%view.workbench.scm.folder%",
1829+
"when": "config.git.enabled && !git.missing && workbenchState == folder"
1830+
},
1831+
{
1832+
"view": "workbench.scm",
1833+
"contents": "%view.workbench.scm.workspace%",
1834+
"when": "config.git.enabled && !git.missing && workbenchState == workspace"
1835+
}
1836+
]
17651837
},
17661838
"dependencies": {
17671839
"byline": "^5.0.0",

extensions/git/package.nls.json

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,9 @@
7070
"command.stashApply": "Apply Stash...",
7171
"command.stashApplyLatest": "Apply Latest Stash",
7272
"command.stashDrop": "Drop Stash...",
73+
"command.timelineOpenDiff": "Open Changes",
74+
"command.timelineCopyCommitId": "Copy Commit ID",
75+
"command.timelineCopyCommitMessage": "Copy Commit Message",
7376
"config.enabled": "Whether git is enabled.",
7477
"config.path": "Path and filename of the git executable, e.g. `C:\\Program Files\\Git\\bin\\git.exe` (Windows).",
7578
"config.autoRepositoryDetection": "Configures when repositories should be automatically detected.",
@@ -127,7 +130,7 @@
127130
"config.showProgress": "Controls whether git actions should show progress.",
128131
"config.rebaseWhenSync": "Force git to use rebase when running the sync command.",
129132
"config.confirmEmptyCommits": "Always confirm the creation of empty commits for the 'Git: Commit Empty' command.",
130-
"config.fetchOnPull": "Fetch all branches when pulling or just the current one.",
133+
"config.fetchOnPull": "When enabled, fetch all branches when pulling. Otherwise, fetch just the current one.",
131134
"config.pullTags": "Fetch all tags when pulling.",
132135
"config.autoStash": "Stash any changes before pulling and restore them after successful pull.",
133136
"config.allowForcePush": "Controls whether force push (with or without lease) is enabled.",
@@ -146,5 +149,10 @@
146149
"colors.untracked": "Color for untracked resources.",
147150
"colors.ignored": "Color for ignored resources.",
148151
"colors.conflict": "Color for resources with conflicts.",
149-
"colors.submodule": "Color for submodule resources."
152+
"colors.submodule": "Color for submodule resources.",
153+
"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 VS Code 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.",
154+
"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 VS Code [read our docs](https://aka.ms/vscode-scm).",
155+
"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 from URL](command:git.clone)\nTo learn more about how to use Git and source control in VS Code [read our docs](https://aka.ms/vscode-scm).",
156+
"view.workbench.scm.folder": "The folder currently open doesn't have a git repository.\n[Initialize Repository](command:git.init)\nTo learn more about how to use Git and source control in VS Code [read our docs](https://aka.ms/vscode-scm).",
157+
"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 VS Code [read our docs](https://aka.ms/vscode-scm)."
150158
}

extensions/git/src/commands.ts

Lines changed: 32 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import { lstat, Stats } from 'fs';
77
import * as os from 'os';
88
import * as path from 'path';
9-
import { commands, Disposable, LineChange, MessageOptions, OutputChannel, Position, ProgressLocation, QuickPickItem, Range, SourceControlResourceState, TextDocumentShowOptions, TextEditor, Uri, ViewColumn, window, workspace, WorkspaceEdit, WorkspaceFolder } from 'vscode';
9+
import { commands, Disposable, LineChange, MessageOptions, OutputChannel, Position, ProgressLocation, QuickPickItem, Range, SourceControlResourceState, TextDocumentShowOptions, TextEditor, Uri, ViewColumn, window, workspace, WorkspaceEdit, WorkspaceFolder, TimelineItem, env } from 'vscode';
1010
import TelemetryReporter from 'vscode-extension-telemetry';
1111
import * as nls from 'vscode-nls';
1212
import { Branch, GitErrorCodes, Ref, RefType, Status, CommitOptions } from './api/git';
@@ -17,6 +17,7 @@ import { applyLineChanges, getModifiedRange, intersectDiffWithRange, invertLineC
1717
import { fromGitUri, toGitUri, isGitUri } from './uri';
1818
import { grep, isDescendant, pathEquals } from './util';
1919
import { Log, LogLevel } from './log';
20+
import { GitTimelineItem } from './timelineProvider';
2021

2122
const localize = nls.loadMessageBundle();
2223

@@ -2331,23 +2332,47 @@ export class CommandCenter {
23312332
return result && result.stash;
23322333
}
23332334

2334-
@command('git.openDiff', { repository: false })
2335-
async openDiff(uri: Uri, lhs: string, rhs: string) {
2335+
@command('git.timeline.openDiff', { repository: false })
2336+
async timelineOpenDiff(item: TimelineItem, uri: Uri | undefined, _source: string) {
2337+
// eslint-disable-next-line eqeqeq
2338+
if (uri == null || !GitTimelineItem.is(item)) {
2339+
return undefined;
2340+
}
2341+
23362342
const basename = path.basename(uri.fsPath);
23372343

23382344
let title;
2339-
if ((lhs === 'HEAD' || lhs === '~') && rhs === '') {
2345+
if ((item.previousRef === 'HEAD' || item.previousRef === '~') && item.ref === '') {
23402346
title = `${basename} (Working Tree)`;
23412347
}
2342-
else if (lhs === 'HEAD' && rhs === '~') {
2348+
else if (item.previousRef === 'HEAD' && item.ref === '~') {
23432349
title = `${basename} (Index)`;
23442350
} else {
2345-
title = `${basename} (${lhs.endsWith('^') ? `${lhs.substr(0, 8)}^` : lhs.substr(0, 8)}) \u27f7 ${basename} (${rhs.endsWith('^') ? `${rhs.substr(0, 8)}^` : rhs.substr(0, 8)})`;
2351+
title = `${basename} (${item.shortPreviousRef}) \u27f7 ${basename} (${item.shortRef})`;
2352+
}
2353+
2354+
return commands.executeCommand('vscode.diff', toGitUri(uri, item.previousRef), item.ref === '' ? uri : toGitUri(uri, item.ref), title);
2355+
}
2356+
2357+
@command('git.timeline.copyCommitId', { repository: false })
2358+
async timelineCopyCommitId(item: TimelineItem, _uri: Uri | undefined, _source: string) {
2359+
if (!GitTimelineItem.is(item)) {
2360+
return;
23462361
}
23472362

2348-
return commands.executeCommand('vscode.diff', toGitUri(uri, lhs), rhs === '' ? uri : toGitUri(uri, rhs), title);
2363+
env.clipboard.writeText(item.ref);
23492364
}
23502365

2366+
@command('git.timeline.copyCommitMessage', { repository: false })
2367+
async timelineCopyCommitMessage(item: TimelineItem, _uri: Uri | undefined, _source: string) {
2368+
if (!GitTimelineItem.is(item)) {
2369+
return;
2370+
}
2371+
2372+
env.clipboard.writeText(item.message);
2373+
}
2374+
2375+
23512376
private createCommand(id: string, key: string, method: Function, options: CommandOptions): (...args: any[]) => any {
23522377
const result = (...args: any[]) => {
23532378
let result: Promise<any>;

extensions/git/src/main.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,7 @@ export async function activate(context: ExtensionContext): Promise<GitExtension>
175175
console.warn(err.message);
176176
outputChannel.appendLine(err.message);
177177

178+
commands.executeCommand('setContext', 'git.missing', true);
178179
warnAboutMissingGit();
179180

180181
return new GitExtensionImpl();

0 commit comments

Comments
 (0)