Browse Source

Fixes issue with compare files not showing changes

main
Eric Amodio 4 years ago
parent
commit
4b8e92cc8f
5 changed files with 27 additions and 13 deletions
  1. +1
    -1
      src/views/nodes/commitFileNode.ts
  2. +1
    -1
      src/views/nodes/commitNode.ts
  3. +1
    -1
      src/views/nodes/resultsFileNode.ts
  4. +1
    -1
      src/views/nodes/statusFileNode.ts
  5. +23
    -9
      src/views/viewCommands.ts

+ 1
- 1
src/views/nodes/commitFileNode.ts View File

@ -203,7 +203,7 @@ export class CommitFileNode extends ViewRefFileNode {
},
};
return {
title: 'Compare File with Previous Revision',
title: 'Open Changes with Previous Revision',
command: Commands.DiffWithPrevious,
arguments: [GitUri.fromFile(this.file, this.commit.repoPath), commandArgs],
};

+ 1
- 1
src/views/nodes/commitNode.ts View File

@ -110,7 +110,7 @@ export class CommitNode extends ViewRefNode {
},
};
return {
title: 'Compare File with Previous Revision',
title: 'Open Changes with Previous Revision',
command: Commands.DiffWithPrevious,
arguments: [this.uri, commandArgs],
};

+ 1
- 1
src/views/nodes/resultsFileNode.ts View File

@ -127,7 +127,7 @@ export class ResultsFileNode extends ViewRefFileNode {
return {
title: 'Open Changes',
command: Commands.DiffWith,
arguments: [this.uri, commandArgs],
arguments: [commandArgs],
};
}
}

+ 1
- 1
src/views/nodes/statusFileNode.ts View File

@ -232,7 +232,7 @@ export class StatusFileNode extends ViewNode {
},
};
return {
title: 'Compare File with Previous Revision',
title: 'Open Changes with Previous Revision',
command: Commands.DiffWithPrevious,
arguments: [GitUri.fromFile(this.file, this.repoPath), commandArgs],
};

+ 23
- 9
src/views/viewCommands.ts View File

@ -5,6 +5,8 @@ import {
DiffWithCommandArgs,
DiffWithPreviousCommandArgs,
DiffWithWorkingCommandArgs,
executeCommand,
executeEditorCommand,
findOrOpenEditor,
GitActions,
OpenFileAtRevisionCommandArgs,
@ -571,7 +573,7 @@ export class ViewCommands {
this._selectedFile = undefined;
void setCommandContext(CommandContext.ViewsCanCompareFile, false);
const diffArgs: DiffWithCommandArgs = {
return executeCommand<DiffWithCommandArgs>(Commands.DiffWith, {
repoPath: selected.repoPath,
lhs: {
sha: selected.ref,
@ -581,8 +583,7 @@ export class ViewCommands {
sha: node.ref,
uri: node.uri,
},
};
return commands.executeCommand(Commands.DiffWith, diffArgs);
});
}
private _selectedFile: CompareSelectedInfo | undefined;
@ -625,14 +626,27 @@ export class ViewCommands {
@debug()
private openChanges(node: ViewRefFileNode | StatusFileNode) {
if (!(node instanceof ViewRefFileNode) && !(node instanceof StatusFileNode)) return undefined;
if (!(node instanceof ViewRefFileNode) && !(node instanceof StatusFileNode)) return;
const command = node.getCommand();
if (command === undefined || command.arguments === undefined) return undefined;
const [uri, args] = command.arguments as [Uri, DiffWithPreviousCommandArgs];
args.showOptions!.preview = false;
return commands.executeCommand(command.command, uri, args);
if (command?.arguments == null) return;
switch (command.command) {
case Commands.DiffWith: {
const [args] = command.arguments as [DiffWithCommandArgs];
args.showOptions!.preview = false;
void executeCommand<DiffWithCommandArgs>(command.command, args);
break;
}
case Commands.DiffWithPrevious: {
const [uri, args] = command.arguments as [Uri, DiffWithPreviousCommandArgs];
args.showOptions!.preview = false;
void executeEditorCommand<DiffWithPreviousCommandArgs>(command.command, uri, args);
break;
}
default:
throw new Error(`Unexpected command: ${command.command}`);
}
// TODO@eamodio Revisit this
// return GitActions.Commit.openChanges(node.file, node instanceof ViewRefFileNode ? node.ref : node.commit, {

Loading…
Cancel
Save