@@ -79,7 +79,8 @@ export const CONTEXT_COMMANDS: ContextCommands = {
79
79
ContextCommandIDs . gitCommitAmendStaged ,
80
80
ContextCommandIDs . gitFileHistory
81
81
] ,
82
- unmodified : [ ContextCommandIDs . gitFileHistory ]
82
+ unmodified : [ ContextCommandIDs . gitFileHistory ] ,
83
+ unmerged : [ ContextCommandIDs . gitFileOpen ]
83
84
} ;
84
85
85
86
const SIMPLE_CONTEXT_COMMANDS : ContextCommands = {
@@ -107,7 +108,8 @@ const SIMPLE_CONTEXT_COMMANDS: ContextCommands = {
107
108
ContextCommandIDs . gitIgnoreExtension ,
108
109
ContextCommandIDs . gitFileDelete
109
110
] ,
110
- unmodified : [ ContextCommandIDs . gitFileHistory ]
111
+ unmodified : [ ContextCommandIDs . gitFileHistory ] ,
112
+ unmerged : [ ContextCommandIDs . gitFileOpen ]
111
113
} ;
112
114
113
115
export class FileList extends React . Component < IFileListProps , IFileListState > {
@@ -275,6 +277,7 @@ export class FileList extends React.Component<IFileListProps, IFileListState> {
275
277
const stagedFiles : Git . IStatusFile [ ] = [ ] ;
276
278
const unstagedFiles : Git . IStatusFile [ ] = [ ] ;
277
279
const untrackedFiles : Git . IStatusFile [ ] = [ ] ;
280
+ const unmergedFiles : Git . IStatusFile [ ] = [ ] ;
278
281
279
282
this . props . files . forEach ( file => {
280
283
switch ( file . status ) {
@@ -297,7 +300,9 @@ export class FileList extends React.Component<IFileListProps, IFileListState> {
297
300
status : 'unstaged'
298
301
} ) ;
299
302
break ;
300
-
303
+ case 'unmerged' :
304
+ unmergedFiles . push ( file ) ;
305
+ break ;
301
306
default :
302
307
break ;
303
308
}
@@ -311,6 +316,7 @@ export class FileList extends React.Component<IFileListProps, IFileListState> {
311
316
< AutoSizer disableWidth = { true } >
312
317
{ ( { height } ) => (
313
318
< >
319
+ { this . _renderUnmerged ( unmergedFiles , height ) }
314
320
{ this . _renderStaged ( stagedFiles , height ) }
315
321
{ this . _renderChanged ( unstagedFiles , height ) }
316
322
{ this . _renderUntracked ( untrackedFiles , height ) }
@@ -340,6 +346,59 @@ export class FileList extends React.Component<IFileListProps, IFileListState> {
340
346
) ;
341
347
}
342
348
349
+ /**
350
+ * Render an unmerged file
351
+ *
352
+ * Note: This is actually a React.FunctionComponent but defined as
353
+ * a private method as it needs access to FileList properties.
354
+ *
355
+ * @param rowProps Row properties
356
+ */
357
+ private _renderUnmergedRow = (
358
+ rowProps : ListChildComponentProps
359
+ ) : JSX . Element => {
360
+ const { data, index, style } = rowProps ;
361
+ const file = data [ index ] as Git . IStatusFile ;
362
+ const diffButton = this . _createDiffButton ( file ) ;
363
+ return (
364
+ < FileItem
365
+ trans = { this . props . trans }
366
+ actions = { diffButton }
367
+ file = { file }
368
+ contextMenu = { this . openContextMenu }
369
+ model = { this . props . model }
370
+ selected = { this . _isSelectedFile ( file ) }
371
+ selectFile = { this . updateSelectedFile }
372
+ onDoubleClick = { ( ) => this . _openDiffView ( file ) }
373
+ style = { style } // TODO probably want to give a different 'danger' style
374
+ />
375
+ ) ;
376
+ } ;
377
+
378
+ private _renderUnmerged ( files : Git . IStatusFile [ ] , height : number ) {
379
+ // Hide section if no merge conflicts are present
380
+ return files . length > 0 ? (
381
+ < GitStage
382
+ actions = {
383
+ < ActionButton
384
+ className = { hiddenButtonStyle }
385
+ disabled = { files . length === 0 }
386
+ icon = { removeIcon }
387
+ title = { this . props . trans . __ ( 'Stage all changes' ) }
388
+ onClick = { ( ) => {
389
+ // TODO open modal with confirmation to stage with merge conflicts
390
+ } }
391
+ />
392
+ }
393
+ collapsible
394
+ files = { files }
395
+ heading = { this . props . trans . __ ( 'Unmerged' ) }
396
+ height = { height }
397
+ rowRenderer = { this . _renderUnmergedRow }
398
+ />
399
+ ) : null ;
400
+ }
401
+
343
402
/**
344
403
* Render a staged file
345
404
*
0 commit comments