@@ -15,12 +15,12 @@ import { IAccount, ILabel, IMilestone, IProject, isITeam, ITeam, MergeMethod, Re
1515import { BaseBranchMetadata , PullRequestGitHelper } from './pullRequestGitHelper' ;
1616import { PullRequestModel } from './pullRequestModel' ;
1717import { getDefaultMergeMethod } from './pullRequestOverview' ;
18- import { getAssigneesQuickPickItems , getLabelOptions , getMilestoneFromQuickPick , getProjectFromQuickPick , reviewersQuickPick } from './quickPicks' ;
18+ import { branchPicks , getAssigneesQuickPickItems , getLabelOptions , getMilestoneFromQuickPick , getProjectFromQuickPick , reviewersQuickPick } from './quickPicks' ;
1919import { getIssueNumberLabelFromParsed , ISSUE_EXPRESSION , ISSUE_OR_URL_EXPRESSION , parseIssueExpressionOutput , variableSubstitution } from './utils' ;
2020import { DisplayLabel , PreReviewState } from './views' ;
2121import { RemoteInfo } from '../../common/types' ;
2222import { ChooseBaseRemoteAndBranchResult , ChooseCompareRemoteAndBranchResult , ChooseRemoteAndBranchArgs , CreateParamsNew , CreatePullRequestNew , TitleAndDescriptionArgs } from '../../common/views' ;
23- import type { Branch , Ref } from '../api/api' ;
23+ import type { Branch } from '../api/api' ;
2424import { GitHubServerType } from '../common/authentication' ;
2525import { emojify , ensureEmojis } from '../common/emoji' ;
2626import { commands , contexts } from '../common/executeCommands' ;
@@ -812,40 +812,6 @@ export class CreatePullRequestViewProvider extends BaseCreatePullRequestViewProv
812812 } ) ;
813813 }
814814
815- private async branchPicks ( githubRepository : GitHubRepository , changeRepoMessage : string , isBase : boolean ) : Promise < ( vscode . QuickPickItem & { remote ?: RemoteInfo , branch ?: string } ) [ ] > {
816- let branches : ( string | Ref ) [ ] ;
817- if ( isBase ) {
818- // For the base, we only want to show branches from GitHub.
819- branches = await githubRepository . listBranches ( githubRepository . remote . owner , githubRepository . remote . repositoryName ) ;
820- } else {
821- // For the compare, we only want to show local branches.
822- branches = ( await this . _folderRepositoryManager . repository . getBranches ( { remote : false } ) ) . filter ( branch => branch . name ) ;
823- }
824- // TODO: @alexr 00 - Add sorting so that the most likely to be used branch (ex main or release if base) is at the top of the list.
825- const branchPicks : ( vscode . QuickPickItem & { remote ?: RemoteInfo , branch ?: string } ) [ ] = branches . map ( branch => {
826- const branchName = typeof branch === 'string' ? branch : branch . name ! ;
827- const pick : ( vscode . QuickPickItem & { remote : RemoteInfo , branch : string } ) = {
828- iconPath : new vscode . ThemeIcon ( 'git-branch' ) ,
829- label : branchName ,
830- remote : {
831- owner : githubRepository . remote . owner ,
832- repositoryName : githubRepository . remote . repositoryName
833- } ,
834- branch : branchName
835- } ;
836- return pick ;
837- } ) ;
838- branchPicks . unshift ( {
839- kind : vscode . QuickPickItemKind . Separator ,
840- label : `${ githubRepository . remote . owner } /${ githubRepository . remote . repositoryName } `
841- } ) ;
842- branchPicks . unshift ( {
843- iconPath : new vscode . ThemeIcon ( 'repo' ) ,
844- label : changeRepoMessage
845- } ) ;
846- return branchPicks ;
847- }
848-
849815 private async processRemoteAndBranchResult ( githubRepository : GitHubRepository , result : { remote : RemoteInfo , branch : string } , isBase : boolean ) {
850816 const [ defaultBranch , viewerPermission ] = await Promise . all ( [ githubRepository . getDefaultBranch ( ) , githubRepository . getViewerPermission ( ) ] ) ;
851817
@@ -922,7 +888,7 @@ export class CreatePullRequestViewProvider extends BaseCreatePullRequestViewProv
922888 quickPick . placeholder = githubRepository ? branchPlaceholder : remotePlaceholder ;
923889 quickPick . show ( ) ;
924890 quickPick . busy = true ;
925- quickPick . items = githubRepository ? await this . branchPicks ( githubRepository , chooseDifferentRemote , isBase ) : await this . remotePicks ( isBase ) ;
891+ quickPick . items = githubRepository ? await branchPicks ( githubRepository , this . _folderRepositoryManager , chooseDifferentRemote , isBase ) : await this . remotePicks ( isBase ) ;
926892 const activeItem = message . args . currentBranch ? quickPick . items . find ( item => item . branch === message . args . currentBranch ) : undefined ;
927893 quickPick . activeItems = activeItem ? [ activeItem ] : [ ] ;
928894 quickPick . busy = false ;
@@ -941,7 +907,7 @@ export class CreatePullRequestViewProvider extends BaseCreatePullRequestViewProv
941907 const selectedRemote = selectedPick as vscode . QuickPickItem & { remote : RemoteInfo } ;
942908 quickPick . busy = true ;
943909 githubRepository = this . _folderRepositoryManager . findRepo ( repo => repo . remote . owner === selectedRemote . remote . owner && repo . remote . repositoryName === selectedRemote . remote . repositoryName ) ! ;
944- quickPick . items = await this . branchPicks ( githubRepository , chooseDifferentRemote , isBase ) ;
910+ quickPick . items = await branchPicks ( githubRepository , this . _folderRepositoryManager , chooseDifferentRemote , isBase ) ;
945911 quickPick . placeholder = branchPlaceholder ;
946912 quickPick . busy = false ;
947913 } else if ( selectedPick . branch && selectedPick . remote ) {
0 commit comments