mirror of
https://github.com/ckaczor/vscode-gitlens.git
synced 2026-02-16 10:58:34 -05:00
Changes diff to compare
This commit is contained in:
@@ -27,7 +27,7 @@ export class DiffDirectoryCommand extends ActiveEditorCommand {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
const repoPath = await this.git.getRepoPathFromUri(uri);
|
const repoPath = await this.git.getRepoPathFromUri(uri);
|
||||||
if (!repoPath) return window.showWarningMessage(`Unable to open directory diff`);
|
if (!repoPath) return window.showWarningMessage(`Unable to open directory compare`);
|
||||||
|
|
||||||
if (!shaOrBranch1) {
|
if (!shaOrBranch1) {
|
||||||
const branches = await this.git.getBranches(repoPath);
|
const branches = await this.git.getBranches(repoPath);
|
||||||
@@ -49,7 +49,7 @@ export class DiffDirectoryCommand extends ActiveEditorCommand {
|
|||||||
}
|
}
|
||||||
catch (ex) {
|
catch (ex) {
|
||||||
Logger.error(ex, 'DiffDirectoryCommand');
|
Logger.error(ex, 'DiffDirectoryCommand');
|
||||||
return window.showErrorMessage(`Unable to open directory diff. See output channel for more details`);
|
return window.showErrorMessage(`Unable to open directory compare. See output channel for more details`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -31,7 +31,7 @@ export class DiffLineWithPreviousCommand extends ActiveEditorCommand {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
const blame = await this.git.getBlameForLine(gitUri, blameline);
|
const blame = await this.git.getBlameForLine(gitUri, blameline);
|
||||||
if (!blame) return window.showWarningMessage(`Unable to open diff. File is probably not under source control`);
|
if (!blame) return window.showWarningMessage(`Unable to open compare. File is probably not under source control`);
|
||||||
|
|
||||||
commit = blame.commit;
|
commit = blame.commit;
|
||||||
|
|
||||||
@@ -50,7 +50,7 @@ export class DiffLineWithPreviousCommand extends ActiveEditorCommand {
|
|||||||
}
|
}
|
||||||
catch (ex) {
|
catch (ex) {
|
||||||
Logger.error(ex, 'DiffWithPreviousLineCommand', `getBlameForLine(${blameline})`);
|
Logger.error(ex, 'DiffWithPreviousLineCommand', `getBlameForLine(${blameline})`);
|
||||||
return window.showErrorMessage(`Unable to open diff. See output channel for more details`);
|
return window.showErrorMessage(`Unable to open compare. See output channel for more details`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -65,7 +65,7 @@ export class DiffLineWithPreviousCommand extends ActiveEditorCommand {
|
|||||||
}
|
}
|
||||||
catch (ex) {
|
catch (ex) {
|
||||||
Logger.error(ex, 'DiffWithPreviousLineCommand', 'getVersionedFile');
|
Logger.error(ex, 'DiffWithPreviousLineCommand', 'getVersionedFile');
|
||||||
return window.showErrorMessage(`Unable to open diff. See output channel for more details`);
|
return window.showErrorMessage(`Unable to open compare. See output channel for more details`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -29,7 +29,7 @@ export class DiffLineWithWorkingCommand extends ActiveEditorCommand {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
const blame = await this.git.getBlameForLine(gitUri, blameline);
|
const blame = await this.git.getBlameForLine(gitUri, blameline);
|
||||||
if (!blame) return window.showWarningMessage(`Unable to open diff. File is probably not under source control`);
|
if (!blame) return window.showWarningMessage(`Unable to open compare. File is probably not under source control`);
|
||||||
|
|
||||||
commit = blame.commit;
|
commit = blame.commit;
|
||||||
// If the line is uncommitted, find the previous commit
|
// If the line is uncommitted, find the previous commit
|
||||||
@@ -40,7 +40,7 @@ export class DiffLineWithWorkingCommand extends ActiveEditorCommand {
|
|||||||
}
|
}
|
||||||
catch (ex) {
|
catch (ex) {
|
||||||
Logger.error(ex, 'DiffLineWithWorkingCommand', `getBlameForLine(${blameline})`);
|
Logger.error(ex, 'DiffLineWithWorkingCommand', `getBlameForLine(${blameline})`);
|
||||||
return window.showErrorMessage(`Unable to open diff. See output channel for more details`);
|
return window.showErrorMessage(`Unable to open compare. See output channel for more details`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ export class DiffWithBranchCommand extends ActiveEditorCommand {
|
|||||||
}
|
}
|
||||||
catch (ex) {
|
catch (ex) {
|
||||||
Logger.error(ex, 'DiffWithBranchCommand', 'getVersionedFile');
|
Logger.error(ex, 'DiffWithBranchCommand', 'getVersionedFile');
|
||||||
return window.showErrorMessage(`Unable to open diff. See output channel for more details`);
|
return window.showErrorMessage(`Unable to open compare. See output channel for more details`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -43,13 +43,13 @@ export class DiffWithNextCommand extends ActiveEditorCommand {
|
|||||||
const sha = (commit && commit.sha) || gitUri.sha;
|
const sha = (commit && commit.sha) || gitUri.sha;
|
||||||
|
|
||||||
const log = await this.git.getLogForFile(gitUri.repoPath, gitUri.fsPath, undefined, sha ? undefined : 2, rangeOrLine as Range);
|
const log = await this.git.getLogForFile(gitUri.repoPath, gitUri.fsPath, undefined, sha ? undefined : 2, rangeOrLine as Range);
|
||||||
if (!log) return window.showWarningMessage(`Unable to open diff. File is probably not under source control`);
|
if (!log) return window.showWarningMessage(`Unable to open compare. File is probably not under source control`);
|
||||||
|
|
||||||
commit = (sha && log.commits.get(sha)) || Iterables.first(log.commits.values());
|
commit = (sha && log.commits.get(sha)) || Iterables.first(log.commits.values());
|
||||||
}
|
}
|
||||||
catch (ex) {
|
catch (ex) {
|
||||||
Logger.error(ex, 'DiffWithNextCommand', `getLogForFile(${gitUri.repoPath}, ${gitUri.fsPath})`);
|
Logger.error(ex, 'DiffWithNextCommand', `getLogForFile(${gitUri.repoPath}, ${gitUri.fsPath})`);
|
||||||
return window.showErrorMessage(`Unable to open diff. See output channel for more details`);
|
return window.showErrorMessage(`Unable to open compare. See output channel for more details`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -67,7 +67,7 @@ export class DiffWithNextCommand extends ActiveEditorCommand {
|
|||||||
}
|
}
|
||||||
catch (ex) {
|
catch (ex) {
|
||||||
Logger.error(ex, 'DiffWithNextCommand', 'getVersionedFile');
|
Logger.error(ex, 'DiffWithNextCommand', 'getVersionedFile');
|
||||||
return window.showErrorMessage(`Unable to open diff. See output channel for more details`);
|
return window.showErrorMessage(`Unable to open compare. See output channel for more details`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -44,13 +44,13 @@ export class DiffWithPreviousCommand extends ActiveEditorCommand {
|
|||||||
const sha = (commit && commit.sha) || gitUri.sha;
|
const sha = (commit && commit.sha) || gitUri.sha;
|
||||||
|
|
||||||
const log = await this.git.getLogForFile(gitUri.repoPath, gitUri.fsPath, undefined, sha ? undefined : 2, rangeOrLine as Range);
|
const log = await this.git.getLogForFile(gitUri.repoPath, gitUri.fsPath, undefined, sha ? undefined : 2, rangeOrLine as Range);
|
||||||
if (!log) return window.showWarningMessage(`Unable to open diff. File is probably not under source control`);
|
if (!log) return window.showWarningMessage(`Unable to open compare. File is probably not under source control`);
|
||||||
|
|
||||||
commit = (sha && log.commits.get(sha)) || Iterables.first(log.commits.values());
|
commit = (sha && log.commits.get(sha)) || Iterables.first(log.commits.values());
|
||||||
}
|
}
|
||||||
catch (ex) {
|
catch (ex) {
|
||||||
Logger.error(ex, 'DiffWithPreviousCommand', `getLogForFile(${gitUri.repoPath}, ${gitUri.fsPath})`);
|
Logger.error(ex, 'DiffWithPreviousCommand', `getLogForFile(${gitUri.repoPath}, ${gitUri.fsPath})`);
|
||||||
return window.showErrorMessage(`Unable to open diff. See output channel for more details`);
|
return window.showErrorMessage(`Unable to open compare. See output channel for more details`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -69,7 +69,7 @@ export class DiffWithPreviousCommand extends ActiveEditorCommand {
|
|||||||
}
|
}
|
||||||
catch (ex) {
|
catch (ex) {
|
||||||
Logger.error(ex, 'DiffWithPreviousCommand', 'getVersionedFile');
|
Logger.error(ex, 'DiffWithPreviousCommand', 'getVersionedFile');
|
||||||
return window.showErrorMessage(`Unable to open diff. See output channel for more details`);
|
return window.showErrorMessage(`Unable to open compare. See output channel for more details`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -28,11 +28,11 @@ export class DiffWithWorkingCommand extends ActiveEditorCommand {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
commit = await this.git.getLogCommit(gitUri.repoPath, gitUri.fsPath, gitUri.sha, { firstIfMissing: true });
|
commit = await this.git.getLogCommit(gitUri.repoPath, gitUri.fsPath, gitUri.sha, { firstIfMissing: true });
|
||||||
if (!commit) return window.showWarningMessage(`Unable to open diff. File is probably not under source control`);
|
if (!commit) return window.showWarningMessage(`Unable to open compare. File is probably not under source control`);
|
||||||
}
|
}
|
||||||
catch (ex) {
|
catch (ex) {
|
||||||
Logger.error(ex, 'DiffWithWorkingCommand', `getLogCommit(${gitUri.repoPath}, ${gitUri.fsPath}, ${gitUri.sha})`);
|
Logger.error(ex, 'DiffWithWorkingCommand', `getLogCommit(${gitUri.repoPath}, ${gitUri.fsPath}, ${gitUri.sha})`);
|
||||||
return window.showErrorMessage(`Unable to open diff. See output channel for more details`);
|
return window.showErrorMessage(`Unable to open compare. See output channel for more details`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -47,7 +47,7 @@ export class DiffWithWorkingCommand extends ActiveEditorCommand {
|
|||||||
}
|
}
|
||||||
catch (ex) {
|
catch (ex) {
|
||||||
Logger.error(ex, 'DiffWithWorkingCommand', 'getVersionedFile');
|
Logger.error(ex, 'DiffWithWorkingCommand', 'getVersionedFile');
|
||||||
return window.showErrorMessage(`Unable to open diff. See output channel for more details`);
|
return window.showErrorMessage(`Unable to open compare. See output channel for more details`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user