@@ -54,7 +54,7 @@ import {
54
54
variableSubstitution ,
55
55
} from './utils' ;
56
56
57
- async function createConflictResolutionModel ( pullRequest : PullRequestModel ) : Promise < ConflictResolutionModel > {
57
+ async function createConflictResolutionModel ( pullRequest : PullRequestModel ) : Promise < ConflictResolutionModel | undefined > {
58
58
const head = pullRequest . head ;
59
59
if ( ! head ) {
60
60
throw new Error ( 'No head found for pull request' ) ;
@@ -67,6 +67,11 @@ async function createConflictResolutionModel(pullRequest: PullRequestModel): Pro
67
67
const potentialMergeConflicts : Conflict [ ] = [ ] ;
68
68
if ( pullRequest . item . mergeable === PullRequestMergeability . Conflict ) {
69
69
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
+
70
75
const previousFilenames : Map < string , SlimFileChange | InMemFileChange > = new Map ( ) ;
71
76
// We must also check all the previous file names of the files in the PR. Assemble a map with this info
72
77
for ( const fileChange of pullRequest . fileChanges . values ( ) ) {
@@ -2149,8 +2154,13 @@ export class FolderRepositoryManager implements vscode.Disposable {
2149
2154
return true ;
2150
2155
}
2151
2156
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 ) {
2153
2159
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
+ }
2154
2164
let continueWithMerge = true ;
2155
2165
if ( pullRequest . item . mergeable === PullRequestMergeability . Conflict ) {
2156
2166
const coordinator = new ConflictResolutionCoordinator ( this . telemetry , conflictModel , this . gitHubRepositories . filter ( repo => repo . remote . repositoryName === pullRequest . githubRepository . remote . repositoryName ) ) ;
0 commit comments