mirror of
https://github.com/ckaczor/vscode-gitlens.git
synced 2026-01-14 01:25:43 -05:00
Cleans up some command overrides
This commit is contained in:
@@ -22,10 +22,8 @@ export class OpenBranchInRemoteCommand extends ActiveEditorCommand {
|
||||
protected async preExecute(context: CommandContext, args: OpenBranchInRemoteCommandArgs = {}): Promise<any> {
|
||||
if (isCommandViewContextWithBranch(context)) {
|
||||
args = { ...args };
|
||||
|
||||
args.branch = context.node.branch.name;
|
||||
args.remote = context.node.branch.getRemote();
|
||||
return this.execute(context.editor, context.uri, args);
|
||||
}
|
||||
|
||||
return this.execute(context.editor, context.uri, args);
|
||||
|
||||
@@ -20,7 +20,6 @@ export class OpenBranchesInRemoteCommand extends ActiveEditorCommand {
|
||||
if (isCommandViewContextWithRemote(context)) {
|
||||
args = { ...args };
|
||||
args.remote = context.node.remote.name;
|
||||
return this.execute(context.editor, context.uri, args);
|
||||
}
|
||||
|
||||
return this.execute(context.editor, context.uri, args);
|
||||
|
||||
@@ -20,7 +20,6 @@ export class OpenRepoInRemoteCommand extends ActiveEditorCommand {
|
||||
if (isCommandViewContextWithRemote(context)) {
|
||||
args = { ...args };
|
||||
args.remote = context.node.remote.name;
|
||||
return this.execute(context.editor, context.uri, args);
|
||||
}
|
||||
|
||||
return this.execute(context.editor, context.uri, args);
|
||||
|
||||
@@ -24,16 +24,16 @@ export class ShowQuickCommitDetailsCommand extends ActiveEditorCachedCommand {
|
||||
super(Commands.ShowQuickCommitDetails);
|
||||
}
|
||||
|
||||
protected async preExecute(context: CommandContext, ...args: any[]): Promise<any> {
|
||||
protected async preExecute(context: CommandContext, args: ShowQuickCommitDetailsCommandArgs = {}): Promise<any> {
|
||||
if (context.type === 'view') {
|
||||
args = { ...args };
|
||||
args.sha = context.node.uri.sha;
|
||||
|
||||
if (isCommandViewContextWithCommit(context)) {
|
||||
args = [{ sha: context.node.uri.sha, commit: context.node.commit }];
|
||||
}
|
||||
else {
|
||||
args = [{ sha: context.node.uri.sha }];
|
||||
args.commit = context.node.commit;
|
||||
}
|
||||
}
|
||||
return this.execute(context.editor, context.uri, ...args);
|
||||
return this.execute(context.editor, context.uri, args);
|
||||
}
|
||||
|
||||
async execute(editor?: TextEditor, uri?: Uri, args: ShowQuickCommitDetailsCommandArgs = {}) {
|
||||
|
||||
@@ -24,16 +24,16 @@ export class ShowQuickCommitFileDetailsCommand extends ActiveEditorCachedCommand
|
||||
super(Commands.ShowQuickCommitFileDetails);
|
||||
}
|
||||
|
||||
protected async preExecute(context: CommandContext, ...args: any[]): Promise<any> {
|
||||
protected async preExecute(context: CommandContext, args: ShowQuickCommitFileDetailsCommandArgs = {}): Promise<any> {
|
||||
if (context.type === 'view') {
|
||||
args = { ...args };
|
||||
args.sha = context.node.uri.sha;
|
||||
|
||||
if (isCommandViewContextWithCommit(context)) {
|
||||
args = [{ sha: context.node.uri.sha, commit: context.node.commit }];
|
||||
}
|
||||
else {
|
||||
args = [{ sha: context.node.uri.sha }];
|
||||
args.commit = context.node.commit;
|
||||
}
|
||||
}
|
||||
return this.execute(context.editor, context.uri, ...args);
|
||||
return this.execute(context.editor, context.uri, args);
|
||||
}
|
||||
|
||||
async execute(editor?: TextEditor, uri?: Uri, args: ShowQuickCommitFileDetailsCommandArgs = {}) {
|
||||
|
||||
@@ -28,7 +28,7 @@ export class StashApplyCommand extends Command {
|
||||
return this.execute(args);
|
||||
}
|
||||
|
||||
return super.preExecute(context, args);
|
||||
return this.execute(args);
|
||||
}
|
||||
|
||||
async execute(args: StashApplyCommandArgs = { confirm: true, deleteAfter: false }) {
|
||||
|
||||
@@ -26,7 +26,7 @@ export class StashDeleteCommand extends Command {
|
||||
return this.execute(args);
|
||||
}
|
||||
|
||||
return super.preExecute(context, args);
|
||||
return this.execute(args);
|
||||
}
|
||||
|
||||
async execute(args: StashDeleteCommandArgs = { confirm: true }) {
|
||||
|
||||
@@ -35,7 +35,7 @@ export class StashSaveCommand extends Command {
|
||||
return this.execute(args);
|
||||
}
|
||||
|
||||
async execute(args: StashSaveCommandArgs = { }) {
|
||||
async execute(args: StashSaveCommandArgs = {}) {
|
||||
if (!this.git.repoPath) return undefined;
|
||||
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user