@@ -54,7 +54,7 @@ import {
5454 variableSubstitution ,
5555} from './utils' ;
5656
57- async function createConflictResolutionModel ( pullRequest : PullRequestModel ) : Promise < ConflictResolutionModel > {
57+ async function createConflictResolutionModel ( pullRequest : PullRequestModel ) : Promise < ConflictResolutionModel | undefined > {
5858 const head = pullRequest . head ;
5959 if ( ! head ) {
6060 throw new Error ( 'No head found for pull request' ) ;
@@ -67,6 +67,11 @@ async function createConflictResolutionModel(pullRequest: PullRequestModel): Pro
6767 const potentialMergeConflicts : Conflict [ ] = [ ] ;
6868 if ( pullRequest . item . mergeable === PullRequestMergeability . Conflict ) {
6969 const mergeBaseIntoPrCompareData = await pullRequest . compareBaseBranchForMerge ( prHeadOwner , prHeadRef , prBaseOwner , baseCommitSha ) ;
70+ if ( ( pullRequest . item . mergeable === PullRequestMergeability . Conflict ) && ( mergeBaseIntoPrCompareData . length >= 300 ) ) {
71+ // API limitation: it only returns the first 300 files
72+ return undefined ;
73+ }
74+
7075 const previousFilenames : Map < string , SlimFileChange | InMemFileChange > = new Map ( ) ;
7176 // We must also check all the previous file names of the files in the PR. Assemble a map with this info
7277 for ( const fileChange of pullRequest . fileChanges . values ( ) ) {
@@ -2149,8 +2154,13 @@ export class FolderRepositoryManager implements vscode.Disposable {
21492154 return true ;
21502155 }
21512156
2152- if ( ! pullRequest . isActive || ( vscode . env . appHost === 'vscode.dev' || vscode . env . appHost === 'github.dev' ) ) {
2157+ const isBrowser = ( vscode . env . appHost === 'vscode.dev' || vscode . env . appHost === 'github.dev' ) ;
2158+ if ( ! pullRequest . isActive || isBrowser ) {
21532159 const conflictModel = await createConflictResolutionModel ( pullRequest ) ;
2160+ if ( conflictModel === undefined ) {
2161+ await vscode . window . showErrorMessage ( vscode . l10n . t ( 'Unable to resolved conflicts for this pull request. There are too many file changes.' ) , { modal : true , detail : isBrowser ? undefined : vscode . l10n . t ( 'Please check out the pull request to resolve conflicts.' ) } ) ;
2162+ return false ;
2163+ }
21542164 let continueWithMerge = true ;
21552165 if ( pullRequest . item . mergeable === PullRequestMergeability . Conflict ) {
21562166 const coordinator = new ConflictResolutionCoordinator ( this . telemetry , conflictModel , this . gitHubRepositories . filter ( repo => repo . remote . repositoryName === pullRequest . githubRepository . remote . repositoryName ) ) ;
0 commit comments