Browse Source

Adds apply changes command to status file nodes

main
Eric Amodio 6 years ago
parent
commit
427fcdeec3
3 changed files with 11 additions and 4 deletions
  1. +1
    -1
      package.json
  2. +3
    -2
      src/views/explorerCommands.ts
  3. +7
    -1
      src/views/statusFileNode.ts

+ 1
- 1
package.json View File

@ -2892,7 +2892,7 @@
},
{
"command": "gitlens.explorers.applyChanges",
"when": "viewItem == gitlens:file:commit",
"when": "viewItem =~ /gitlens:file:(commit|status)\\b/",
"group": "5_gitlens_1@1"
},
{

+ 3
- 2
src/views/explorerCommands.ts View File

@ -8,6 +8,7 @@ import { Commands, DiffWithCommandArgs, DiffWithCommandArgsRevision, DiffWithPre
import { GitService, GitUri } from '../gitService';
import { RepositoryNode } from './repositoryNode';
import { StatusNode } from './statusNode';
import { StatusFileNode } from './statusFileNode';
export interface RefreshNodeCommandArgs {
maxCount?: number;
@ -66,7 +67,7 @@ export class ExplorerCommands extends Disposable {
this._disposable && this._disposable.dispose();
}
private async applyChanges(node: CommitFileNode | StashFileNode) {
private async applyChanges(node: CommitFileNode | StashFileNode | StatusFileNode) {
await Container.git.checkoutFile(node.uri);
return this.openFile(node);
}
@ -148,7 +149,7 @@ export class ExplorerCommands extends Disposable {
return commands.executeCommand(Commands.DiffWithWorking, node.commit.toGitUri(), args);
}
private openFile(node: CommitFileNode | StashFileNode | StatusFileCommitsNode) {
private openFile(node: CommitFileNode | StashFileNode | StatusFileCommitsNode | StatusFileNode) {
return openEditor(node.uri, { preserveFocus: true, preview: false });
}

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

@ -15,7 +15,13 @@ export class StatusFileNode extends ExplorerNode {
private readonly ref2: string,
private readonly explorer: Explorer
) {
super(GitUri.fromFileStatus(status, repoPath));
super(GitUri.fromFileStatus(
status,
repoPath,
ref1
? ref1
: ref2 ? ref2 : undefined
));
}
getChildren(): ExplorerNode[] {

Loading…
Cancel
Save