@@ -3318,7 +3318,10 @@ export class AppStore extends TypedBaseStore<IAppState> {
33183318 }
33193319
33203320 const { step, operationDetail } = multiCommitOperationState
3321- if ( step . kind !== MultiCommitOperationStepKind . ShowConflicts ) {
3321+ if (
3322+ step . kind !== MultiCommitOperationStepKind . ShowConflicts &&
3323+ step . kind !== MultiCommitOperationStepKind . ShowCopilotConflicts
3324+ ) {
33223325 return
33233326 }
33243327
@@ -3327,7 +3330,10 @@ export class AppStore extends TypedBaseStore<IAppState> {
33273330 this . repositoryStateCache . updateMultiCommitOperationState (
33283331 repository ,
33293332 ( ) => ( {
3330- step : { ...step , manualResolutions } ,
3333+ step : {
3334+ ...step ,
3335+ conflictState : { ...step . conflictState , manualResolutions } ,
3336+ } ,
33313337 } )
33323338 )
33333339
@@ -3403,20 +3409,32 @@ export class AppStore extends TypedBaseStore<IAppState> {
34033409
34043410 this . statsStore . increment ( 'mergeConflictFromExplicitMergeCount' )
34053411
3412+ const mcoConflictState = {
3413+ kind : 'multiCommitOperation' as const ,
3414+ manualResolutions,
3415+ ourBranch,
3416+ theirBranch,
3417+ }
3418+
3419+ const useCopilot = multiCommitOperationState . useCopilotConflictResolution
3420+
34063421 this . _setMultiCommitOperationStep ( repository , {
3407- kind : MultiCommitOperationStepKind . ShowConflicts ,
3408- conflictState : {
3409- kind : 'multiCommitOperation' ,
3410- manualResolutions,
3411- ourBranch,
3412- theirBranch,
3413- } ,
3422+ kind : useCopilot
3423+ ? MultiCommitOperationStepKind . ShowCopilotConflictsLoading
3424+ : MultiCommitOperationStepKind . ShowConflicts ,
3425+ conflictState : mcoConflictState ,
34143426 } )
34153427
34163428 this . _showPopup ( {
34173429 type : PopupType . MultiCommitOperation ,
34183430 repository,
34193431 } )
3432+
3433+ if ( useCopilot ) {
3434+ // Auto-route to Copilot: the user previously opted into Copilot
3435+ // resolution during this operation, so skip the manual dialog.
3436+ await this . _startCopilotConflictResolution ( repository )
3437+ }
34203438 }
34213439
34223440 private async getMergeConflictsTheirBranch (
@@ -6889,14 +6907,24 @@ export class AppStore extends TypedBaseStore<IAppState> {
68896907 return
68906908 }
68916909
6892- const { copilotResolutions } = multiCommitOperationState
6910+ const { copilotResolutions, step } = multiCommitOperationState
68936911 if ( copilotResolutions === null || copilotResolutions . length === 0 ) {
68946912 return
68956913 }
68966914
6915+ // Respect any manual overrides the user chose in the result dialog
6916+ const manualResolutions =
6917+ step . kind === MultiCommitOperationStepKind . ShowCopilotConflicts
6918+ ? step . conflictState . manualResolutions
6919+ : new Map < string , ManualConflictResolution > ( )
6920+
68976921 const pathsToStage : string [ ] = [ ]
68986922
68996923 for ( const resolution of copilotResolutions ) {
6924+ if ( manualResolutions . has ( resolution . path ) ) {
6925+ continue
6926+ }
6927+
69006928 const absolutePath = await resolveWithin ( repository . path , resolution . path )
69016929 if ( absolutePath === null ) {
69026930 log . warn (
@@ -8648,8 +8676,10 @@ export class AppStore extends TypedBaseStore<IAppState> {
86488676 if (
86498677 changesState . conflictState === null ||
86508678 multiCommitOperationState === null ||
8651- multiCommitOperationState . step . kind !==
8652- MultiCommitOperationStepKind . ShowConflicts
8679+ ( multiCommitOperationState . step . kind !==
8680+ MultiCommitOperationStepKind . ShowConflicts &&
8681+ multiCommitOperationState . step . kind !==
8682+ MultiCommitOperationStepKind . ShowCopilotConflicts )
86538683 ) {
86548684 return
86558685 }
0 commit comments