ux: show conflict short format in changes view

Signed-off-by: leo <longshuang@msn.cn>
This commit is contained in:
leo 2025-05-30 10:42:02 +08:00
parent e40ca4bbe0
commit 75015d550c
No known key found for this signature in database
5 changed files with 64 additions and 62 deletions

View file

@ -17,6 +17,16 @@ namespace SourceGit.ViewModels
get => Change == null;
}
public bool ShowConflictMarker
{
get => Change is { IsConflicted: true };
}
public string ConflictMarker
{
get => Change?.ConflictMarker ?? string.Empty;
}
public bool IsExpanded
{
get => _isExpanded;

View file

@ -27,14 +27,12 @@ namespace SourceGit.ViewModels
{
public string Marker
{
get;
private set;
get => _change.ConflictMarker;
}
public string Description
{
get;
private set;
get => _change.ConflictDesc;
}
public object Theirs
@ -67,50 +65,10 @@ namespace SourceGit.ViewModels
_change = change;
var isSubmodule = repo.Submodules.Find(x => x.Path.Equals(change.Path, StringComparison.Ordinal)) != null;
switch (change.ConflictReason)
if (!isSubmodule && (_change.ConflictReason == Models.ConflictReason.BothAdded || _change.ConflictReason == Models.ConflictReason.BothModified))
{
case Models.ConflictReason.BothDeleted:
Marker = "DD";
Description = "Both deleted";
break;
case Models.ConflictReason.AddedByUs:
Marker = "AU";
Description = "Added by us";
break;
case Models.ConflictReason.DeletedByThem:
Marker = "UD";
Description = "Deleted by them";
break;
case Models.ConflictReason.AddedByThem:
Marker = "UA";
Description = "Added by them";
break;
case Models.ConflictReason.DeletedByUs:
Marker = "DU";
Description = "Deleted by us";
break;
case Models.ConflictReason.BothAdded:
Marker = "AA";
Description = "Both added";
if (!isSubmodule)
{
CanUseExternalMergeTool = true;
IsResolved = new Commands.IsConflictResolved(repo.FullPath, change).Result();
}
break;
case Models.ConflictReason.BothModified:
Marker = "UU";
Description = "Both modified";
if (!isSubmodule)
{
CanUseExternalMergeTool = true;
IsResolved = new Commands.IsConflictResolved(repo.FullPath, change).Result();
}
break;
default:
Marker = string.Empty;
Description = string.Empty;
break;
CanUseExternalMergeTool = true;
IsResolved = new Commands.IsConflictResolved(repo.FullPath, change).Result();
}
var context = wc.InProgressContext;