From 91a02c7a0afb18e784a67c3add1a94bd0768a287 Mon Sep 17 00:00:00 2001 From: Joao Moreno Date: Mon, 26 Jun 2017 16:14:29 +0200 Subject: [PATCH] :lipstick: --- extensions/git/package.json | 10 +++++----- extensions/git/package.nls.json | 2 +- extensions/git/src/commands.ts | 19 ++++++++----------- 3 files changed, 14 insertions(+), 17 deletions(-) diff --git a/extensions/git/package.json b/extensions/git/package.json index 00ce8d23cb5..92453166d8a 100644 --- a/extensions/git/package.json +++ b/extensions/git/package.json @@ -60,8 +60,8 @@ } }, { - "command": "git.openOldFile", - "title": "%command.openOldFile%", + "command": "git.openHEADFile", + "title": "%command.openHEADFile%", "category": "Git" }, { @@ -252,7 +252,7 @@ "when": "config.git.enabled && scmProvider == git && gitState == idle" }, { - "command": "git.openOldFile", + "command": "git.openHEADFile", "when": "config.git.enabled && scmProvider == git && gitState == idle" }, { @@ -523,7 +523,7 @@ "group": "navigation" }, { - "command": "git.openOldFile", + "command": "git.openHEADFile", "when": "config.git.enabled && scmProvider == git && gitState == idle && scmResourceGroup == index", "group": "navigation" }, @@ -543,7 +543,7 @@ "group": "navigation" }, { - "command": "git.openOldFile", + "command": "git.openHEADFile", "when": "config.git.enabled && scmProvider == git && gitState == idle && scmResourceGroup == workingTree", "group": "navigation" }, diff --git a/extensions/git/package.nls.json b/extensions/git/package.nls.json index fd186e240f6..bc8bc381786 100644 --- a/extensions/git/package.nls.json +++ b/extensions/git/package.nls.json @@ -4,7 +4,7 @@ "command.refresh": "Refresh", "command.openChange": "Open Changes", "command.openFile": "Open File", - "command.openOldFile": "Open Old File", + "command.openHEADFile": "Open File (HEAD)", "command.stage": "Stage Changes", "command.stageAll": "Stage All Changes", "command.stageSelectedRanges": "Stage Selected Ranges", diff --git a/extensions/git/src/commands.ts b/extensions/git/src/commands.ts index dfdb91ac140..f71e3b723f0 100644 --- a/extensions/git/src/commands.ts +++ b/extensions/git/src/commands.ts @@ -313,13 +313,12 @@ export class CommandCenter { return await commands.executeCommand('vscode.open', uri, viewColumn); } - @command('git.openOldFile') - async openOldFile(arg?: Resource | Uri): Promise { + @command('git.openHEADFile') + async openHEADFile(arg?: Resource | Uri): Promise { let resource: Resource | undefined = undefined; if (arg instanceof Resource) { resource = arg; - } else if (arg instanceof Uri) { resource = this.getSCMResource(arg); } else { @@ -329,17 +328,15 @@ export class CommandCenter { if (!resource) { return; } - return await this._openOldResource(resource); - } - private async _openOldResource(resource: Resource): Promise { - const old = this.getLeftResource(resource); - const current = this.getRightResource(resource); + const HEAD = this.getLeftResource(resource); - if (!old) { - return await commands.executeCommand('vscode.open', current); + if (!HEAD) { + window.showWarningMessage(localize('HEAD not available', "HEAD version of '{0}' is not available.", path.basename(resource.resourceUri.fsPath))); + return; } - return await commands.executeCommand('vscode.open', old); + + return await commands.executeCommand('vscode.open', HEAD); } @command('git.openChange')