Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 23 additions & 13 deletions src/Models/Conflict.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using System;
using System.Collections.Generic;

namespace SourceGit.Models
Expand Down Expand Up @@ -33,24 +34,26 @@ public enum ConflictLineType
Marker,
Ours,
Theirs,
Edited,
}

public enum ConflictLineState
{
Normal,
ConflictBlockStart,
ConflictBlock,
ConflictBlockEnd,
ResolvedBlockStart,
ResolvedBlock,
ResolvedBlockEnd,
}
public record struct ConflictLineDecoration(
ConflictLineType Type,
bool InRegion,
bool IsResolved,
bool IsFirst,
bool IsLast
);

public record ConflictPick(ConflictPanelType Side, int Index);

public class ConflictLine
{
public ConflictLineType Type { get; set; } = ConflictLineType.None;
public string Content { get; set; } = string.Empty;
public string LineNumber { get; set; } = string.Empty;
public int RegionIndex { get; set; } = -1;
public int IndexInSide { get; set; } = -1;

public ConflictLine()
{
Expand Down Expand Up @@ -78,8 +81,9 @@ bool IsResolved

public class ConflictRegion
{
public int StartLineInOriginal { get; set; }
public int EndLineInOriginal { get; set; }
public int OursFirst { get; set; }
public int TheirsFirst { get; set; }
public bool IsAtEnd { get; set; }

public string StartMarker { get; set; } = "<<<<<<<";
public string SeparatorMarker { get; set; } = "=======";
Expand All @@ -88,7 +92,13 @@ public class ConflictRegion
public List<string> OursContent { get; set; } = new();
public List<string> TheirsContent { get; set; } = new();

// An empty side still takes one (placeholder) row in its panel, so that it can be picked.
public int OursRowCount => Math.Max(OursContent.Count, 1);
public int TheirsRowCount => Math.Max(TheirsContent.Count, 1);

public List<ConflictPick> Picks { get; set; } = new();
public bool HasChoice { get; set; } = false;
public bool IsCustom { get; set; } = false;
public bool IsResolved { get; set; } = false;
public ConflictResolution ResolutionType { get; set; } = ConflictResolution.None;
}
}
4 changes: 4 additions & 0 deletions src/Resources/Locales/en_US.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -607,10 +607,14 @@
<x:String x:Key="Text.MergeConflictEditor.AcceptBoth.TheirsFirst" xml:space="preserve">First Theirs, then Mine</x:String>
<x:String x:Key="Text.MergeConflictEditor.UseBoth" xml:space="preserve">USE BOTH</x:String>
<x:String x:Key="Text.MergeConflictEditor.AllResolved" xml:space="preserve">All conflicts resolved</x:String>
<x:String x:Key="Text.MergeConflictEditor.CollapseUnchanged" xml:space="preserve">Collapse Unchanged Lines</x:String>
<x:String x:Key="Text.MergeConflictEditor.ConflictPosition" xml:space="preserve">Conflict {0} of {1}</x:String>
<x:String x:Key="Text.MergeConflictEditor.ConflictsRemaining" xml:space="preserve">{0} conflict(s) remaining</x:String>
<x:String x:Key="Text.MergeConflictEditor.FoldedLines" xml:space="preserve">{0} unchanged lines</x:String>
<x:String x:Key="Text.MergeConflictEditor.Mine" xml:space="preserve">MINE</x:String>
<x:String x:Key="Text.MergeConflictEditor.NextConflict" xml:space="preserve">Next Conflict</x:String>
<x:String x:Key="Text.MergeConflictEditor.PrevConflict" xml:space="preserve">Previous Conflict</x:String>
<x:String x:Key="Text.MergeConflictEditor.Reset" xml:space="preserve">RESET</x:String>
<x:String x:Key="Text.MergeConflictEditor.Result" xml:space="preserve">RESULT</x:String>
<x:String x:Key="Text.MergeConflictEditor.SaveAndStage" xml:space="preserve">SAVE &amp; STAGE</x:String>
<x:String x:Key="Text.MergeConflictEditor.Theirs" xml:space="preserve">THEIRS</x:String>
Expand Down
Loading