diff --git a/src/ViewModels/Conflict.cs b/src/ViewModels/Conflict.cs
index 03c09e8a..1ccf4a33 100644
--- a/src/ViewModels/Conflict.cs
+++ b/src/ViewModels/Conflict.cs
@@ -1,5 +1,26 @@
namespace SourceGit.ViewModels
{
+ public class ConflictSourceBranch
+ {
+ public string Name { get; private set; }
+ public string Head { get; private set; }
+ public Models.Commit Revision { get; private set; }
+
+ public ConflictSourceBranch(string name, string head, Models.Commit revision)
+ {
+ Name = name;
+ Head = head;
+ Revision = revision;
+ }
+
+ public ConflictSourceBranch(Repository repo, Models.Branch branch)
+ {
+ Name = branch.Name;
+ Head = branch.Head;
+ Revision = new Commands.QuerySingleCommit(repo.FullPath, branch.Head).Result() ?? new Models.Commit() { SHA = branch.Head };
+ }
+ }
+
public class Conflict
{
public object Theirs
@@ -31,28 +52,32 @@
if (context is CherryPickInProgress cherryPick)
{
Theirs = cherryPick.Head;
- Mine = repo.CurrentBranch;
+ Mine = new ConflictSourceBranch(repo, repo.CurrentBranch);
}
else if (context is RebaseInProgress rebase)
{
var b = repo.Branches.Find(x => x.IsLocal && x.Name == rebase.HeadName);
- Theirs = (object)b ?? rebase.StoppedAt;
+ if (b != null)
+ Theirs = new ConflictSourceBranch(b.Name, b.Head, rebase.StoppedAt);
+ else
+ Theirs = new ConflictSourceBranch(rebase.HeadName, rebase.StoppedAt?.SHA ?? "----------", rebase.StoppedAt);
+
Mine = rebase.Onto;
}
else if (context is RevertInProgress revert)
{
Theirs = revert.Head;
- Mine = repo.CurrentBranch;
+ Mine = new ConflictSourceBranch(repo, repo.CurrentBranch);
}
else if (context is MergeInProgress merge)
{
Theirs = merge.Source;
- Mine = repo.CurrentBranch;
+ Mine = new ConflictSourceBranch(repo, repo.CurrentBranch);
}
else
{
Theirs = "Stash or Patch";
- Mine = repo.CurrentBranch;
+ Mine = new ConflictSourceBranch(repo, repo.CurrentBranch);
}
}
diff --git a/src/Views/Conflict.axaml b/src/Views/Conflict.axaml
new file mode 100644
index 00000000..9a056f9e
--- /dev/null
+++ b/src/Views/Conflict.axaml
@@ -0,0 +1,122 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/Views/Conflict.axaml.cs b/src/Views/Conflict.axaml.cs
new file mode 100644
index 00000000..6121b5c8
--- /dev/null
+++ b/src/Views/Conflict.axaml.cs
@@ -0,0 +1,23 @@
+using Avalonia.Controls;
+using Avalonia.Input;
+using Avalonia.VisualTree;
+
+namespace SourceGit.Views
+{
+ public partial class Conflict : UserControl
+ {
+ public Conflict()
+ {
+ InitializeComponent();
+ }
+
+ private void OnPressedSHA(object sender, PointerPressedEventArgs e)
+ {
+ var repoView = this.FindAncestorOfType();
+ if (repoView is { DataContext: ViewModels.Repository repo } && sender is TextBlock text)
+ repo.NavigateToCommit(text.Text);
+
+ e.Handled = true;
+ }
+ }
+}
diff --git a/src/Views/WorkingCopy.axaml b/src/Views/WorkingCopy.axaml
index 926bce6e..c9b94d59 100644
--- a/src/Views/WorkingCopy.axaml
+++ b/src/Views/WorkingCopy.axaml
@@ -203,84 +203,7 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
diff --git a/src/Views/WorkingCopy.axaml.cs b/src/Views/WorkingCopy.axaml.cs
index 04674f86..dfaad858 100644
--- a/src/Views/WorkingCopy.axaml.cs
+++ b/src/Views/WorkingCopy.axaml.cs
@@ -160,14 +160,5 @@ namespace SourceGit.Views
e.Handled = true;
}
-
- private void OnPressedSHA(object sender, PointerPressedEventArgs e)
- {
- var repoView = this.FindAncestorOfType();
- if (repoView is { DataContext: ViewModels.Repository repo } && sender is TextBlock text)
- repo.NavigateToCommit(text.Text);
-
- e.Handled = true;
- }
}
}