mirror of
https://github.com/ckaczor/vscode-gitlens.git
synced 2026-01-20 01:35:36 -05:00
Adds gitlens.diffWithPrevious command to the explore context menu
Adds output channel logging, controlled by the `gitlens.advanced.output.level` setting Removes all debug logging, unless the `gitlens.advanced.output.debug` settings it on
This commit is contained in:
@@ -5,6 +5,7 @@ import { EditorCommand } from './commands';
|
||||
import { BuiltInCommands, Commands } from '../constants';
|
||||
import BlameAnnotationController from '../blameAnnotationController';
|
||||
import GitProvider from '../gitProvider';
|
||||
import { Logger } from '../logger';
|
||||
import * as path from 'path';
|
||||
|
||||
export default class DiffWithPreviousCommand extends EditorCommand {
|
||||
@@ -22,7 +23,7 @@ export default class DiffWithPreviousCommand extends EditorCommand {
|
||||
return Promise.all([this.git.getVersionedFile(shaUri.fsPath, repoPath, sha), this.git.getVersionedFile(compareWithUri.fsPath, repoPath, compareWithSha)])
|
||||
.then(values => commands.executeCommand(BuiltInCommands.Diff, Uri.file(values[1]), Uri.file(values[0]), `${path.basename(compareWithUri.fsPath)} (${compareWithSha}) ↔ ${path.basename(shaUri.fsPath)} (${sha})`))
|
||||
.then(() => commands.executeCommand(BuiltInCommands.RevealLine, { lineNumber: line, at: 'center' }))
|
||||
.catch(ex => console.error('[GitLens.DiffWithPreviousCommand]', 'getVersionedFile', ex));
|
||||
.catch(ex => Logger.error('[GitLens.DiffWithPreviousCommand]', 'getVersionedFile', ex));
|
||||
}
|
||||
|
||||
if (!(uri instanceof Uri)) {
|
||||
@@ -46,13 +47,13 @@ export default class DiffWithPreviousCommand extends EditorCommand {
|
||||
return commands.executeCommand(Commands.DiffWithPrevious, commit.previousUri, commit.repoPath, commit.previousSha, commit.previousUri, prevCommit.sha, prevCommit.uri, blame.line.originalLine);
|
||||
}
|
||||
catch (ex) {
|
||||
console.error('[GitLens.DiffWithPreviousCommand]', `getBlameForLine(${blame.line.originalLine}, ${commit.previousSha})`, ex);
|
||||
Logger.error('[GitLens.DiffWithPreviousCommand]', `getBlameForLine(${blame.line.originalLine}, ${commit.previousSha})`, ex);
|
||||
}
|
||||
}
|
||||
return commands.executeCommand(Commands.DiffWithPrevious, commit.uri, commit.repoPath, commit.sha, commit.uri, commit.previousSha, commit.previousUri, line);
|
||||
}
|
||||
catch (ex) {
|
||||
console.error('[GitLens.DiffWithPreviousCommand]', `getBlameForLine(${line})`, ex);
|
||||
Logger.error('[GitLens.DiffWithPreviousCommand]', `getBlameForLine(${line})`, ex);
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -66,7 +67,7 @@ export default class DiffWithPreviousCommand extends EditorCommand {
|
||||
return commands.executeCommand(Commands.DiffWithPrevious, commit.uri, commit.repoPath, commit.sha, commit.uri, prevCommit.sha, prevCommit.uri, line);
|
||||
}
|
||||
catch (ex) {
|
||||
console.error('[GitLens.DiffWithPreviousCommand]', `getLogForFile(${uri.fsPath})`, ex);
|
||||
Logger.error('[GitLens.DiffWithPreviousCommand]', `getLogForFile(${uri.fsPath})`, ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user