Kaynağa Gözat

Avoids remote disambiguation quick pick

main
Eric Amodio 7 yıl önce
ebeveyn
işleme
6d759daaad
4 değiştirilmiş dosya ile 17 ekleme ve 8 silme
  1. +4
    -0
      src/commands/openBranchInRemote.ts
  2. +2
    -4
      src/commands/openBranchesInRemote.ts
  3. +9
    -0
      src/commands/openInRemote.ts
  4. +2
    -4
      src/commands/openRepoInRemote.ts

+ 4
- 0
src/commands/openBranchInRemote.ts Dosyayı Görüntüle

@ -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);
}

+ 2
- 4
src/commands/openBranchesInRemote.ts Dosyayı Görüntüle

@ -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);
}

+ 9
- 0
src/commands/openInRemote.ts Dosyayı Görüntüle

@ -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);

+ 2
- 4
src/commands/openRepoInRemote.ts Dosyayı Görüntüle

@ -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);
}

Yükleniyor…
İptal
Kaydet