mirror of
https://github.com/ckaczor/vscode-gitlens.git
synced 2026-01-14 01:25:43 -05:00
Avoids remote disambiguation quick pick
This commit is contained in:
@@ -10,6 +10,7 @@ import { OpenInRemoteCommandArgs } from './openInRemote';
|
||||
|
||||
export interface OpenBranchInRemoteCommandArgs {
|
||||
branch?: string;
|
||||
remote?: string;
|
||||
}
|
||||
|
||||
export class OpenBranchInRemoteCommand extends ActiveEditorCommand {
|
||||
@@ -21,7 +22,9 @@ 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);
|
||||
}
|
||||
|
||||
@@ -57,6 +60,7 @@ export class OpenBranchInRemoteCommand extends ActiveEditorCommand {
|
||||
type: 'branch',
|
||||
branch: args.branch
|
||||
},
|
||||
remote: args.remote,
|
||||
remotes
|
||||
} as OpenInRemoteCommandArgs);
|
||||
}
|
||||
|
||||
@@ -35,15 +35,13 @@ export class OpenBranchesInRemoteCommand extends ActiveEditorCommand {
|
||||
if (!repoPath) return undefined;
|
||||
|
||||
try {
|
||||
let remotes = Arrays.uniqueBy(await this.git.getRemotes(repoPath), r => r.url, r => !!r.provider);
|
||||
if (args.remote !== undefined) {
|
||||
remotes = remotes.filter(r => r.name === args.remote);
|
||||
}
|
||||
const remotes = Arrays.uniqueBy(await this.git.getRemotes(repoPath), r => r.url, r => !!r.provider);
|
||||
|
||||
return commands.executeCommand(Commands.OpenInRemote, uri, {
|
||||
resource: {
|
||||
type: 'branches'
|
||||
},
|
||||
remote: args.remote,
|
||||
remotes
|
||||
} as OpenInRemoteCommandArgs);
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ import { Logger } from '../logger';
|
||||
import { CommandQuickPickItem, OpenRemoteCommandQuickPickItem, RemotesQuickPick } from '../quickPicks';
|
||||
|
||||
export interface OpenInRemoteCommandArgs {
|
||||
remote?: string;
|
||||
remotes?: GitRemote[];
|
||||
resource?: RemoteResource;
|
||||
|
||||
@@ -26,6 +27,14 @@ export class OpenInRemoteCommand extends ActiveEditorCommand {
|
||||
args = { ...args };
|
||||
if (args.remotes === undefined || args.resource === undefined) return undefined;
|
||||
|
||||
if (args.remote !== undefined) {
|
||||
const remotes = args.remotes.filter(r => r.name === args.remote);
|
||||
// Only filter if we get some results
|
||||
if (remotes.length > 0) {
|
||||
args.remotes = remotes;
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
if (args.remotes.length === 1) {
|
||||
this.ensureRemoteBranchName(args);
|
||||
|
||||
@@ -35,15 +35,13 @@ export class OpenRepoInRemoteCommand extends ActiveEditorCommand {
|
||||
if (!repoPath) return undefined;
|
||||
|
||||
try {
|
||||
let remotes = Arrays.uniqueBy(await this.git.getRemotes(repoPath), r => r.url, r => !!r.provider);
|
||||
if (args.remote !== undefined) {
|
||||
remotes = remotes.filter(r => r.name === args.remote);
|
||||
}
|
||||
const remotes = Arrays.uniqueBy(await this.git.getRemotes(repoPath), r => r.url, r => !!r.provider);
|
||||
|
||||
return commands.executeCommand(Commands.OpenInRemote, uri, {
|
||||
resource: {
|
||||
type: 'repo'
|
||||
},
|
||||
remote: args.remote,
|
||||
remotes
|
||||
} as OpenInRemoteCommandArgs);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user