File tree Expand file tree Collapse file tree 4 files changed +17
-8
lines changed Expand file tree Collapse file tree 4 files changed +17
-8
lines changed Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ import { OpenInRemoteCommandArgs } from './openInRemote';
1010
1111export interface OpenBranchInRemoteCommandArgs {
1212 branch ?: string ;
13+ remote ?: string ;
1314}
1415
1516export class OpenBranchInRemoteCommand extends ActiveEditorCommand {
@@ -21,7 +22,9 @@ export class OpenBranchInRemoteCommand extends ActiveEditorCommand {
2122 protected async preExecute ( context : CommandContext , args : OpenBranchInRemoteCommandArgs = { } ) : Promise < any > {
2223 if ( isCommandViewContextWithBranch ( context ) ) {
2324 args = { ...args } ;
25+
2426 args . branch = context . node . branch . name ;
27+ args . remote = context . node . branch . getRemote ( ) ;
2528 return this . execute ( context . editor , context . uri , args ) ;
2629 }
2730
@@ -57,6 +60,7 @@ export class OpenBranchInRemoteCommand extends ActiveEditorCommand {
5760 type : 'branch' ,
5861 branch : args . branch
5962 } ,
63+ remote : args . remote ,
6064 remotes
6165 } as OpenInRemoteCommandArgs ) ;
6266 }
Original file line number Diff line number Diff line change @@ -35,15 +35,13 @@ export class OpenBranchesInRemoteCommand extends ActiveEditorCommand {
3535 if ( ! repoPath ) return undefined ;
3636
3737 try {
38- let remotes = Arrays . uniqueBy ( await this . git . getRemotes ( repoPath ) , r => r . url , r => ! ! r . provider ) ;
39- if ( args . remote !== undefined ) {
40- remotes = remotes . filter ( r => r . name === args . remote ) ;
41- }
38+ const remotes = Arrays . uniqueBy ( await this . git . getRemotes ( repoPath ) , r => r . url , r => ! ! r . provider ) ;
4239
4340 return commands . executeCommand ( Commands . OpenInRemote , uri , {
4441 resource : {
4542 type : 'branches'
4643 } ,
44+ remote : args . remote ,
4745 remotes
4846 } as OpenInRemoteCommandArgs ) ;
4947 }
Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ import { Logger } from '../logger';
88import { CommandQuickPickItem , OpenRemoteCommandQuickPickItem , RemotesQuickPick } from '../quickPicks' ;
99
1010export interface OpenInRemoteCommandArgs {
11+ remote ?: string ;
1112 remotes ?: GitRemote [ ] ;
1213 resource ?: RemoteResource ;
1314
@@ -26,6 +27,14 @@ export class OpenInRemoteCommand extends ActiveEditorCommand {
2627 args = { ...args } ;
2728 if ( args . remotes === undefined || args . resource === undefined ) return undefined ;
2829
30+ if ( args . remote !== undefined ) {
31+ const remotes = args . remotes . filter ( r => r . name === args . remote ) ;
32+ // Only filter if we get some results
33+ if ( remotes . length > 0 ) {
34+ args . remotes = remotes ;
35+ }
36+ }
37+
2938 try {
3039 if ( args . remotes . length === 1 ) {
3140 this . ensureRemoteBranchName ( args ) ;
Original file line number Diff line number Diff line change @@ -35,15 +35,13 @@ export class OpenRepoInRemoteCommand extends ActiveEditorCommand {
3535 if ( ! repoPath ) return undefined ;
3636
3737 try {
38- let remotes = Arrays . uniqueBy ( await this . git . getRemotes ( repoPath ) , r => r . url , r => ! ! r . provider ) ;
39- if ( args . remote !== undefined ) {
40- remotes = remotes . filter ( r => r . name === args . remote ) ;
41- }
38+ const remotes = Arrays . uniqueBy ( await this . git . getRemotes ( repoPath ) , r => r . url , r => ! ! r . provider ) ;
4239
4340 return commands . executeCommand ( Commands . OpenInRemote , uri , {
4441 resource : {
4542 type : 'repo'
4643 } ,
44+ remote : args . remote ,
4745 remotes
4846 } as OpenInRemoteCommandArgs ) ;
4947 }
You can’t perform that action at this time.
0 commit comments