@@ -104,7 +104,7 @@ export function addCommands(
104
104
settings : ISettingRegistry . ISettings ,
105
105
trans : TranslationBundle
106
106
) : void {
107
- const { commands, shell } = app ;
107
+ const { commands, shell, serviceManager } = app ;
108
108
109
109
/**
110
110
* Commit using a keystroke combination when in CommitBox.
@@ -486,10 +486,20 @@ export function addCommands(
486
486
onClick : async ( ) => {
487
487
try {
488
488
const resolvedFile : string = await widget . getResolvedFile ( ) ;
489
- // TODO update the file without the conflicts, then close the tab
490
- console . log ( resolvedFile ) ;
489
+ await serviceManager . contents . save ( model . filename , {
490
+ type : 'file' ,
491
+ format : 'text' ,
492
+ content : resolvedFile
493
+ } ) ;
494
+ await gitModel . add ( model . filename ) ;
495
+ await gitModel . refresh ( ) ;
491
496
} catch ( reason ) {
492
- console . error ( reason ) ;
497
+ logger . log ( {
498
+ message : reason . message ?? reason ,
499
+ level : Level . ERROR
500
+ } ) ;
501
+ } finally {
502
+ diffWidget . dispose ( ) ;
493
503
}
494
504
} ,
495
505
tooltip : trans . __ ( 'Mark file as resolved' ) ,
@@ -516,7 +526,7 @@ export function addCommands(
516
526
content . addWidget ( widget ) ;
517
527
} catch ( reason ) {
518
528
console . error ( reason ) ;
519
- const msg = `Load Diff Model Error (${ reason . message || reason } )` ;
529
+ const msg = `Load Diff Model Error (${ reason . message ?? reason } )` ;
520
530
modelIsLoading . reject ( msg ) ;
521
531
}
522
532
}
@@ -597,8 +607,8 @@ export function addCommands(
597
607
const diffContext : Git . Diff . IContext =
598
608
status === 'unmerged'
599
609
? {
600
- currentRef : 'MERGE_HEAD ' ,
601
- previousRef : 'HEAD ' ,
610
+ currentRef : 'HEAD ' ,
611
+ previousRef : 'MERGE_HEAD ' ,
602
612
baseRef : 'ORIG_HEAD'
603
613
}
604
614
: context ?? {
@@ -611,7 +621,7 @@ export function addCommands(
611
621
: { git : diffContext . currentRef } ;
612
622
613
623
// Base props used for Diff Model
614
- const props = {
624
+ const props : Omit < Git . Diff . IModel < string > , 'changed' | 'isConflict' > = {
615
625
challenger : {
616
626
content : async ( ) => {
617
627
return requestAPI < Git . IDiffContent > (
@@ -646,9 +656,15 @@ export function addCommands(
646
656
diffContext . previousRef ,
647
657
source : diffContext . previousRef ,
648
658
updateAt : Date . now ( )
649
- } ,
659
+ }
660
+ } ;
661
+
662
+ if ( diffContext . baseRef ) {
663
+ props . reference . label = trans . __ ( 'CURRENT' ) ;
664
+ props . challenger . label = trans . __ ( 'INCOMING' ) ;
665
+
650
666
// Only add base when diff-ing merge conflicts
651
- base : diffContext . baseRef && {
667
+ props . base = {
652
668
content : async ( ) => {
653
669
return requestAPI < Git . IDiffContent > (
654
670
URLExt . join ( repositoryPath , 'content' ) ,
@@ -659,13 +675,11 @@ export function addCommands(
659
675
}
660
676
) . then ( data => data . content ) ;
661
677
} ,
662
- label :
663
- ( Git . Diff . SpecialRef [ diffContext . baseRef as any ] as any ) ||
664
- diffContext . baseRef ,
678
+ label : trans . __ ( 'RESULT' ) ,
665
679
source : diffContext . baseRef ,
666
680
updateAt : Date . now ( )
667
- }
668
- } ;
681
+ } ;
682
+ }
669
683
670
684
// Create the diff widget
671
685
const model = new DiffModel < string > ( props ) ;
0 commit comments