mirror of
https://fastgit.cc/github.com/sourcegit-scm/sourcegit
synced 2026-04-30 22:01:10 +08:00
code_style: general cleanup (#1525)
This commit is contained in:
@@ -82,8 +82,7 @@ namespace SourceGit.ViewModels
|
||||
|
||||
public static ValidationResult ValidateWorktreePath(string path, ValidationContext ctx)
|
||||
{
|
||||
var creator = ctx.ObjectInstance as AddWorktree;
|
||||
if (creator == null)
|
||||
if (ctx.ObjectInstance is not AddWorktree creator)
|
||||
return new ValidationResult("Missing runtime context to create branch!");
|
||||
|
||||
if (string.IsNullOrEmpty(path))
|
||||
|
||||
@@ -70,9 +70,7 @@ namespace SourceGit.ViewModels
|
||||
foreach (var line in lines)
|
||||
{
|
||||
lineIdx++;
|
||||
if (line.Type == Models.TextDiffLineType.Added ||
|
||||
line.Type == Models.TextDiffLineType.Deleted ||
|
||||
line.Type == Models.TextDiffLineType.None)
|
||||
if (line.Type is Models.TextDiffLineType.Added or Models.TextDiffLineType.Deleted or Models.TextDiffLineType.None)
|
||||
{
|
||||
if (isNewBlock)
|
||||
{
|
||||
|
||||
@@ -63,9 +63,7 @@ namespace SourceGit.ViewModels
|
||||
set
|
||||
{
|
||||
if (SetProperty(ref _searchFilter, value))
|
||||
{
|
||||
RefreshVisible();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -127,13 +125,13 @@ namespace SourceGit.ViewModels
|
||||
var diffWithMerger = new MenuItem();
|
||||
diffWithMerger.Header = App.Text("DiffWithMerger");
|
||||
diffWithMerger.Icon = App.CreateMenuIcon("Icons.OpenWith");
|
||||
diffWithMerger.Click += (_, ev) =>
|
||||
diffWithMerger.Click += async (_, ev) =>
|
||||
{
|
||||
var toolType = Preferences.Instance.ExternalMergeToolType;
|
||||
var toolPath = Preferences.Instance.ExternalMergeToolPath;
|
||||
var opt = new Models.DiffOption(_based.Head, _to.Head, change);
|
||||
|
||||
_ = Commands.MergeTool.OpenForDiffAsync(_repo, toolType, toolPath, opt);
|
||||
await Commands.MergeTool.OpenForDiffAsync(_repo, toolType, toolPath, opt);
|
||||
ev.Handled = true;
|
||||
};
|
||||
menu.Items.Add(diffWithMerger);
|
||||
|
||||
@@ -41,10 +41,6 @@ namespace SourceGit.ViewModels
|
||||
var log = _repo.CreateLog($"Checkout '{Branch}'");
|
||||
Use(log);
|
||||
|
||||
var updateSubmodules = IsRecurseSubmoduleVisible && RecurseSubmodules;
|
||||
var succ = false;
|
||||
var needPopStash = false;
|
||||
|
||||
if (_repo.CurrentBranch is { IsDetachedHead: true })
|
||||
{
|
||||
var refs = await new Commands.QueryRefsContainsCommit(_repo.FullPath, _repo.CurrentBranch.Head).GetResultAsync();
|
||||
@@ -60,6 +56,9 @@ namespace SourceGit.ViewModels
|
||||
}
|
||||
}
|
||||
|
||||
var succ = false;
|
||||
var needPopStash = false;
|
||||
|
||||
if (DiscardLocalChanges)
|
||||
{
|
||||
succ = await new Commands.Checkout(_repo.FullPath)
|
||||
@@ -91,7 +90,7 @@ namespace SourceGit.ViewModels
|
||||
|
||||
if (succ)
|
||||
{
|
||||
if (updateSubmodules)
|
||||
if (IsRecurseSubmoduleVisible && RecurseSubmodules)
|
||||
{
|
||||
var submodules = await new Commands.QueryUpdatableSubmodules(_repo.FullPath).GetResultAsync();
|
||||
if (submodules.Count > 0)
|
||||
|
||||
@@ -46,10 +46,6 @@ namespace SourceGit.ViewModels
|
||||
var log = _repo.CreateLog($"Checkout and Fast-Forward '{LocalBranch.Name}' ...");
|
||||
Use(log);
|
||||
|
||||
var updateSubmodules = IsRecurseSubmoduleVisible && RecurseSubmodules;
|
||||
var succ = false;
|
||||
var needPopStash = false;
|
||||
|
||||
if (_repo.CurrentBranch is { IsDetachedHead: true })
|
||||
{
|
||||
var refs = await new Commands.QueryRefsContainsCommit(_repo.FullPath, _repo.CurrentBranch.Head).GetResultAsync();
|
||||
@@ -65,13 +61,10 @@ namespace SourceGit.ViewModels
|
||||
}
|
||||
}
|
||||
|
||||
if (DiscardLocalChanges)
|
||||
{
|
||||
succ = await new Commands.Checkout(_repo.FullPath)
|
||||
.Use(log)
|
||||
.BranchAsync(LocalBranch.Name, RemoteBranch.Head, true, true);
|
||||
}
|
||||
else
|
||||
var succ = false;
|
||||
var needPopStash = false;
|
||||
|
||||
if (!DiscardLocalChanges)
|
||||
{
|
||||
var changes = await new Commands.CountLocalChangesWithoutUntracked(_repo.FullPath).GetResultAsync();
|
||||
if (changes > 0)
|
||||
@@ -88,15 +81,15 @@ namespace SourceGit.ViewModels
|
||||
|
||||
needPopStash = true;
|
||||
}
|
||||
|
||||
succ = await new Commands.Checkout(_repo.FullPath)
|
||||
.Use(log)
|
||||
.BranchAsync(LocalBranch.Name, RemoteBranch.Head, false, true);
|
||||
}
|
||||
|
||||
succ = await new Commands.Checkout(_repo.FullPath)
|
||||
.Use(log)
|
||||
.BranchAsync(LocalBranch.Name, RemoteBranch.Head, DiscardLocalChanges, true);
|
||||
|
||||
if (succ)
|
||||
{
|
||||
if (updateSubmodules)
|
||||
if (IsRecurseSubmoduleVisible && RecurseSubmodules)
|
||||
{
|
||||
var submodules = await new Commands.QueryUpdatableSubmodules(_repo.FullPath).GetResultAsync();
|
||||
|
||||
|
||||
@@ -325,13 +325,13 @@ namespace SourceGit.ViewModels
|
||||
var diffWithMerger = new MenuItem();
|
||||
diffWithMerger.Header = App.Text("DiffWithMerger");
|
||||
diffWithMerger.Icon = App.CreateMenuIcon("Icons.OpenWith");
|
||||
diffWithMerger.Click += (_, ev) =>
|
||||
diffWithMerger.Click += async (_, ev) =>
|
||||
{
|
||||
var toolType = Preferences.Instance.ExternalMergeToolType;
|
||||
var toolPath = Preferences.Instance.ExternalMergeToolPath;
|
||||
var opt = new Models.DiffOption(_commit, change);
|
||||
|
||||
_ = Commands.MergeTool.OpenForDiffAsync(_repo.FullPath, toolType, toolPath, opt);
|
||||
await Commands.MergeTool.OpenForDiffAsync(_repo.FullPath, toolType, toolPath, opt);
|
||||
ev.Handled = true;
|
||||
};
|
||||
|
||||
|
||||
@@ -17,13 +17,9 @@ namespace SourceGit.ViewModels
|
||||
|
||||
public ConflictSourceBranch(Repository repo, Models.Branch branch)
|
||||
{
|
||||
var revision = new Commands.QuerySingleCommit(repo.FullPath, branch.Head).GetResultAsync().Result;
|
||||
if (revision == null)
|
||||
revision = new Models.Commit() { SHA = branch.Head };
|
||||
|
||||
Name = branch.Name;
|
||||
Head = branch.Head;
|
||||
Revision = revision;
|
||||
Revision = new Commands.QuerySingleCommit(repo.FullPath, branch.Head).GetResultAsync().Result ?? new Models.Commit() { SHA = branch.Head };
|
||||
}
|
||||
}
|
||||
|
||||
@@ -75,36 +71,33 @@ namespace SourceGit.ViewModels
|
||||
IsResolved = new Commands.IsConflictResolved(repo.FullPath, change).GetResultAsync().Result;
|
||||
}
|
||||
|
||||
var context = wc.InProgressContext;
|
||||
if (context is CherryPickInProgress cherryPick)
|
||||
switch (wc.InProgressContext)
|
||||
{
|
||||
Theirs = cherryPick.Head;
|
||||
Mine = new ConflictSourceBranch(repo, repo.CurrentBranch);
|
||||
}
|
||||
else if (context is RebaseInProgress rebase)
|
||||
{
|
||||
var b = repo.Branches.Find(x => x.IsLocal && x.Name == rebase.HeadName);
|
||||
if (b != null)
|
||||
Theirs = new ConflictSourceBranch(b.Name, b.Head, rebase.StoppedAt);
|
||||
else
|
||||
Theirs = new ConflictSourceBranch(rebase.HeadName, rebase.StoppedAt?.SHA ?? "----------", rebase.StoppedAt);
|
||||
case CherryPickInProgress cherryPick:
|
||||
Theirs = cherryPick.Head;
|
||||
Mine = new ConflictSourceBranch(repo, repo.CurrentBranch);
|
||||
break;
|
||||
case RebaseInProgress rebase:
|
||||
var b = repo.Branches.Find(x => x.IsLocal && x.Name == rebase.HeadName);
|
||||
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 = new ConflictSourceBranch(repo, repo.CurrentBranch);
|
||||
}
|
||||
else if (context is MergeInProgress merge)
|
||||
{
|
||||
Theirs = merge.Source;
|
||||
Mine = new ConflictSourceBranch(repo, repo.CurrentBranch);
|
||||
}
|
||||
else
|
||||
{
|
||||
Theirs = "Stash or Patch";
|
||||
Mine = new ConflictSourceBranch(repo, repo.CurrentBranch);
|
||||
Mine = rebase.Onto;
|
||||
break;
|
||||
case RevertInProgress revert:
|
||||
Theirs = revert.Head;
|
||||
Mine = new ConflictSourceBranch(repo, repo.CurrentBranch);
|
||||
break;
|
||||
case MergeInProgress merge:
|
||||
Theirs = merge.Source;
|
||||
Mine = new ConflictSourceBranch(repo, repo.CurrentBranch);
|
||||
break;
|
||||
default:
|
||||
Theirs = "Stash or Patch";
|
||||
Mine = new ConflictSourceBranch(repo, repo.CurrentBranch);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace SourceGit.ViewModels
|
||||
{
|
||||
public partial class CreateBranch : Popup
|
||||
public class CreateBranch : Popup
|
||||
{
|
||||
[Required(ErrorMessage = "Branch name is required!")]
|
||||
[RegularExpression(@"^[\w \-/\.#\+]+$", ErrorMessage = "Bad branch name format!")]
|
||||
|
||||
@@ -456,25 +456,24 @@ namespace SourceGit.ViewModels
|
||||
{
|
||||
foreach (var d in commit.Decorators)
|
||||
{
|
||||
if (d.Type == Models.DecoratorType.CurrentBranchHead)
|
||||
switch (d.Type)
|
||||
{
|
||||
FillCurrentBranchMenu(menu, current);
|
||||
}
|
||||
else if (d.Type == Models.DecoratorType.LocalBranchHead)
|
||||
{
|
||||
var b = _repo.Branches.Find(x => x.IsLocal && d.Name == x.Name);
|
||||
FillOtherLocalBranchMenu(menu, b, current, commit.IsMerged);
|
||||
}
|
||||
else if (d.Type == Models.DecoratorType.RemoteBranchHead)
|
||||
{
|
||||
var b = _repo.Branches.Find(x => !x.IsLocal && d.Name == x.FriendlyName);
|
||||
FillRemoteBranchMenu(menu, b, current, commit.IsMerged);
|
||||
}
|
||||
else if (d.Type == Models.DecoratorType.Tag)
|
||||
{
|
||||
var t = _repo.Tags.Find(x => x.Name == d.Name);
|
||||
if (t != null)
|
||||
tags.Add(t);
|
||||
case Models.DecoratorType.CurrentBranchHead:
|
||||
FillCurrentBranchMenu(menu, current);
|
||||
break;
|
||||
case Models.DecoratorType.LocalBranchHead:
|
||||
var lb = _repo.Branches.Find(x => x.IsLocal && d.Name == x.Name);
|
||||
FillOtherLocalBranchMenu(menu, lb, current, commit.IsMerged);
|
||||
break;
|
||||
case Models.DecoratorType.RemoteBranchHead:
|
||||
var rb = _repo.Branches.Find(x => !x.IsLocal && d.Name == x.FriendlyName);
|
||||
FillRemoteBranchMenu(menu, rb, current, commit.IsMerged);
|
||||
break;
|
||||
case Models.DecoratorType.Tag:
|
||||
var t = _repo.Tags.Find(x => x.Name == d.Name);
|
||||
if (t != null)
|
||||
tags.Add(t);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -600,10 +599,7 @@ namespace SourceGit.ViewModels
|
||||
var parents = new List<Models.Commit>();
|
||||
foreach (var sha in commit.Parents)
|
||||
{
|
||||
var parent = _commits.Find(x => x.SHA == sha);
|
||||
if (parent == null)
|
||||
parent = await new Commands.QuerySingleCommit(_repo.FullPath, sha).GetResultAsync();
|
||||
|
||||
var parent = _commits.Find(x => x.SHA == sha) ?? await new Commands.QuerySingleCommit(_repo.FullPath, sha).GetResultAsync();
|
||||
if (parent != null)
|
||||
parents.Add(parent);
|
||||
}
|
||||
|
||||
@@ -37,13 +37,13 @@ namespace SourceGit.ViewModels
|
||||
|
||||
public static async Task<ImageSource> FromFileAsync(string fullpath, Models.ImageDecoder decoder)
|
||||
{
|
||||
await using (var stream = File.OpenRead(fullpath))
|
||||
return await Task.Run(() => LoadFromStream(stream, decoder)).ConfigureAwait(false);
|
||||
await using var stream = File.OpenRead(fullpath);
|
||||
return await Task.Run(() => LoadFromStream(stream, decoder)).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
public static async Task<ImageSource> FromRevisionAsync(string repo, string revision, string file, Models.ImageDecoder decoder)
|
||||
{
|
||||
var stream = await Commands.QueryFileContent.RunAsync(repo, revision, file).ConfigureAwait(false);
|
||||
await using var stream = await Commands.QueryFileContent.RunAsync(repo, revision, file).ConfigureAwait(false);
|
||||
return await Task.Run(() => LoadFromStream(stream, decoder)).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace SourceGit.ViewModels
|
||||
{
|
||||
public partial class RenameBranch : Popup
|
||||
public class RenameBranch : Popup
|
||||
{
|
||||
public Models.Branch Target
|
||||
{
|
||||
@@ -35,9 +35,7 @@ namespace SourceGit.ViewModels
|
||||
foreach (var b in rename._repo.Branches)
|
||||
{
|
||||
if (b.IsLocal && b != rename.Target && b.Name.Equals(fixedName, StringComparison.Ordinal))
|
||||
{
|
||||
return new ValidationResult("A branch with same name already exists!!!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -823,15 +823,13 @@ namespace SourceGit.ViewModels
|
||||
if (!CanCreatePopup())
|
||||
return;
|
||||
|
||||
ExecuteCustomAction popup;
|
||||
if (scope is Models.Branch b)
|
||||
popup = new ExecuteCustomAction(this, action, b);
|
||||
else if (scope is Models.Commit c)
|
||||
popup = new ExecuteCustomAction(this, action, c);
|
||||
else if (scope is Models.Tag t)
|
||||
popup = new ExecuteCustomAction(this, action, t);
|
||||
else
|
||||
popup = new ExecuteCustomAction(this, action);
|
||||
var popup = scope switch
|
||||
{
|
||||
Models.Branch b => new ExecuteCustomAction(this, action, b),
|
||||
Models.Commit c => new ExecuteCustomAction(this, action, c),
|
||||
Models.Tag t => new ExecuteCustomAction(this, action, t),
|
||||
_ => new ExecuteCustomAction(this, action)
|
||||
};
|
||||
|
||||
if (action.Controls.Count == 0)
|
||||
ShowAndStartPopup(popup);
|
||||
|
||||
@@ -331,20 +331,8 @@ namespace SourceGit.ViewModels
|
||||
|
||||
private async Task SetIfChangedAsync(string key, string value, string defValue)
|
||||
{
|
||||
bool changed = false;
|
||||
if (_cached.TryGetValue(key, out var old))
|
||||
{
|
||||
changed = old != value;
|
||||
}
|
||||
else if (!string.IsNullOrEmpty(value) && value != defValue)
|
||||
{
|
||||
changed = true;
|
||||
}
|
||||
|
||||
if (changed)
|
||||
{
|
||||
if (value != _cached.GetValueOrDefault(key, defValue))
|
||||
await new Commands.Config(_repo.FullPath).SetAsync(key, value);
|
||||
}
|
||||
}
|
||||
|
||||
private readonly Repository _repo = null;
|
||||
|
||||
@@ -58,9 +58,7 @@ namespace SourceGit.ViewModels
|
||||
set
|
||||
{
|
||||
if (SetProperty(ref _searchFilter, value))
|
||||
{
|
||||
RefreshVisible();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -389,9 +389,7 @@ namespace SourceGit.ViewModels
|
||||
if (!change.IsConflicted)
|
||||
continue;
|
||||
|
||||
if (change.ConflictReason == Models.ConflictReason.BothDeleted ||
|
||||
change.ConflictReason == Models.ConflictReason.DeletedByThem ||
|
||||
change.ConflictReason == Models.ConflictReason.AddedByUs)
|
||||
if (change.ConflictReason is Models.ConflictReason.BothDeleted or Models.ConflictReason.DeletedByThem or Models.ConflictReason.AddedByUs)
|
||||
{
|
||||
var fullpath = Path.Combine(_repo.FullPath, change.Path);
|
||||
if (File.Exists(fullpath))
|
||||
@@ -438,9 +436,7 @@ namespace SourceGit.ViewModels
|
||||
if (!change.IsConflicted)
|
||||
continue;
|
||||
|
||||
if (change.ConflictReason == Models.ConflictReason.BothDeleted ||
|
||||
change.ConflictReason == Models.ConflictReason.DeletedByUs ||
|
||||
change.ConflictReason == Models.ConflictReason.AddedByThem)
|
||||
if (change.ConflictReason is Models.ConflictReason.BothDeleted or Models.ConflictReason.DeletedByUs or Models.ConflictReason.AddedByThem)
|
||||
{
|
||||
var fullpath = Path.Combine(_repo.FullPath, change.Path);
|
||||
if (File.Exists(fullpath))
|
||||
@@ -622,7 +618,6 @@ namespace SourceGit.ViewModels
|
||||
{
|
||||
var useTheirs = new MenuItem();
|
||||
useTheirs.Icon = App.CreateMenuIcon("Icons.Incoming");
|
||||
useTheirs.Header = App.Text("FileCM.UseTheirs");
|
||||
useTheirs.Click += (_, e) =>
|
||||
{
|
||||
UseTheirs(_selectedUnstaged);
|
||||
@@ -631,7 +626,6 @@ namespace SourceGit.ViewModels
|
||||
|
||||
var useMine = new MenuItem();
|
||||
useMine.Icon = App.CreateMenuIcon("Icons.Local");
|
||||
useMine.Header = App.Text("FileCM.UseMine");
|
||||
useMine.Click += (_, e) =>
|
||||
{
|
||||
UseMine(_selectedUnstaged);
|
||||
@@ -647,25 +641,28 @@ namespace SourceGit.ViewModels
|
||||
e.Handled = true;
|
||||
};
|
||||
|
||||
if (_inProgressContext is CherryPickInProgress cherryPick)
|
||||
switch (_inProgressContext)
|
||||
{
|
||||
useTheirs.Header = App.Text("FileCM.ResolveUsing", cherryPick.HeadName);
|
||||
useMine.Header = App.Text("FileCM.ResolveUsing", _repo.CurrentBranch.Name);
|
||||
}
|
||||
else if (_inProgressContext is RebaseInProgress rebase)
|
||||
{
|
||||
useTheirs.Header = App.Text("FileCM.ResolveUsing", rebase.HeadName);
|
||||
useMine.Header = App.Text("FileCM.ResolveUsing", rebase.BaseName);
|
||||
}
|
||||
else if (_inProgressContext is RevertInProgress revert)
|
||||
{
|
||||
useTheirs.Header = App.Text("FileCM.ResolveUsing", $"{revert.Head.SHA.AsSpan(0, 10)} (revert)");
|
||||
useMine.Header = App.Text("FileCM.ResolveUsing", _repo.CurrentBranch.Name);
|
||||
}
|
||||
else if (_inProgressContext is MergeInProgress merge)
|
||||
{
|
||||
useTheirs.Header = App.Text("FileCM.ResolveUsing", merge.SourceName);
|
||||
useMine.Header = App.Text("FileCM.ResolveUsing", _repo.CurrentBranch.Name);
|
||||
case CherryPickInProgress cherryPick:
|
||||
useTheirs.Header = App.Text("FileCM.ResolveUsing", cherryPick.HeadName);
|
||||
useMine.Header = App.Text("FileCM.ResolveUsing", _repo.CurrentBranch.Name);
|
||||
break;
|
||||
case RebaseInProgress rebase:
|
||||
useTheirs.Header = App.Text("FileCM.ResolveUsing", rebase.HeadName);
|
||||
useMine.Header = App.Text("FileCM.ResolveUsing", rebase.BaseName);
|
||||
break;
|
||||
case RevertInProgress revert:
|
||||
useTheirs.Header = App.Text("FileCM.ResolveUsing", $"{revert.Head.SHA.AsSpan(0, 10)} (revert)");
|
||||
useMine.Header = App.Text("FileCM.ResolveUsing", _repo.CurrentBranch.Name);
|
||||
break;
|
||||
case MergeInProgress merge:
|
||||
useTheirs.Header = App.Text("FileCM.ResolveUsing", merge.SourceName);
|
||||
useMine.Header = App.Text("FileCM.ResolveUsing", _repo.CurrentBranch.Name);
|
||||
break;
|
||||
default:
|
||||
useTheirs.Header = App.Text("FileCM.UseTheirs");
|
||||
useMine.Header = App.Text("FileCM.UseMine");
|
||||
break;
|
||||
}
|
||||
|
||||
menu.Items.Add(useTheirs);
|
||||
@@ -1020,7 +1017,6 @@ namespace SourceGit.ViewModels
|
||||
|
||||
var useTheirs = new MenuItem();
|
||||
useTheirs.Icon = App.CreateMenuIcon("Icons.Incoming");
|
||||
useTheirs.Header = App.Text("FileCM.UseTheirs");
|
||||
useTheirs.Click += (_, e) =>
|
||||
{
|
||||
UseTheirs(_selectedUnstaged);
|
||||
@@ -1029,32 +1025,34 @@ namespace SourceGit.ViewModels
|
||||
|
||||
var useMine = new MenuItem();
|
||||
useMine.Icon = App.CreateMenuIcon("Icons.Local");
|
||||
useMine.Header = App.Text("FileCM.UseMine");
|
||||
useMine.Click += (_, e) =>
|
||||
{
|
||||
UseMine(_selectedUnstaged);
|
||||
e.Handled = true;
|
||||
};
|
||||
|
||||
if (_inProgressContext is CherryPickInProgress cherryPick)
|
||||
switch (_inProgressContext)
|
||||
{
|
||||
useTheirs.Header = App.Text("FileCM.ResolveUsing", cherryPick.HeadName);
|
||||
useMine.Header = App.Text("FileCM.ResolveUsing", _repo.CurrentBranch.Name);
|
||||
}
|
||||
else if (_inProgressContext is RebaseInProgress rebase)
|
||||
{
|
||||
useTheirs.Header = App.Text("FileCM.ResolveUsing", rebase.HeadName);
|
||||
useMine.Header = App.Text("FileCM.ResolveUsing", rebase.BaseName);
|
||||
}
|
||||
else if (_inProgressContext is RevertInProgress revert)
|
||||
{
|
||||
useTheirs.Header = App.Text("FileCM.ResolveUsing", $"{revert.Head.SHA.AsSpan(0, 10)} (revert)");
|
||||
useMine.Header = App.Text("FileCM.ResolveUsing", _repo.CurrentBranch.Name);
|
||||
}
|
||||
else if (_inProgressContext is MergeInProgress merge)
|
||||
{
|
||||
useTheirs.Header = App.Text("FileCM.ResolveUsing", merge.SourceName);
|
||||
useMine.Header = App.Text("FileCM.ResolveUsing", _repo.CurrentBranch.Name);
|
||||
case CherryPickInProgress cherryPick:
|
||||
useTheirs.Header = App.Text("FileCM.ResolveUsing", cherryPick.HeadName);
|
||||
useMine.Header = App.Text("FileCM.ResolveUsing", _repo.CurrentBranch.Name);
|
||||
break;
|
||||
case RebaseInProgress rebase:
|
||||
useTheirs.Header = App.Text("FileCM.ResolveUsing", rebase.HeadName);
|
||||
useMine.Header = App.Text("FileCM.ResolveUsing", rebase.BaseName);
|
||||
break;
|
||||
case RevertInProgress revert:
|
||||
useTheirs.Header = App.Text("FileCM.ResolveUsing", $"{revert.Head.SHA.AsSpan(0, 10)} (revert)");
|
||||
useMine.Header = App.Text("FileCM.ResolveUsing", _repo.CurrentBranch.Name);
|
||||
break;
|
||||
case MergeInProgress merge:
|
||||
useTheirs.Header = App.Text("FileCM.ResolveUsing", merge.SourceName);
|
||||
useMine.Header = App.Text("FileCM.ResolveUsing", _repo.CurrentBranch.Name);
|
||||
break;
|
||||
default:
|
||||
useTheirs.Header = App.Text("FileCM.UseTheirs");
|
||||
useMine.Header = App.Text("FileCM.UseMine");
|
||||
break;
|
||||
}
|
||||
|
||||
menu.Items.Add(useTheirs);
|
||||
|
||||
Reference in New Issue
Block a user