Adds Apply Changes command to custom view files

Adds Stash Changes command to SCM view items
This commit is contained in:
Eric Amodio
2017-09-03 12:58:05 -04:00
parent 35b16a78ba
commit d31eb25451
5 changed files with 1212 additions and 1137 deletions

View File

@@ -43,6 +43,7 @@ export class GitExplorer implements TreeDataProvider<ExplorerNode> {
commands.registerCommand('gitlens.gitExplorer.openFileRevisionInRemote', this.openFileRevisionInRemote, this);
commands.registerCommand('gitlens.gitExplorer.openChangedFiles', this.openChangedFiles, this);
commands.registerCommand('gitlens.gitExplorer.openChangedFileRevisions', this.openChangedFileRevisions, this);
commands.registerCommand('gitlens.gitExplorer.applyChanges', this.applyChanges, this);
const fn = Functions.debounce(this.onActiveEditorChanged, 500);
context.subscriptions.push(window.onDidChangeActiveTextEditor(fn, this));
@@ -110,6 +111,11 @@ export class GitExplorer implements TreeDataProvider<ExplorerNode> {
this.refresh();
}
private async applyChanges(node: CommitNode | StashNode) {
await this.git.checkoutFile(node.uri);
return this.openFile(node);
}
private openChanges(node: CommitNode | StashNode) {
const command = node.getCommand();
if (command === undefined || command.arguments === undefined) return;