diff --git a/src/Commands/MergeTool.cs b/src/Commands/MergeTool.cs index d3478d59..276c078b 100644 --- a/src/Commands/MergeTool.cs +++ b/src/Commands/MergeTool.cs @@ -13,9 +13,12 @@ namespace SourceGit.Commands cmd.Context = repo; cmd.RaiseError = true; + // NOTE: If no names are specified, 'git mergetool' will run the merge tool program on every file with merge conflicts. + var file_arg = string.IsNullOrEmpty(file) ? "" : $"\"{file}\""; + if (toolType == 0) { - cmd.Args = $"mergetool \"{file}\""; + cmd.Args = $"mergetool {file_arg}"; return cmd.Exec(); } @@ -32,7 +35,7 @@ namespace SourceGit.Commands return false; } - cmd.Args = $"-c mergetool.sourcegit.cmd=\"\\\"{toolPath}\\\" {supported.Cmd}\" -c mergetool.writeToTemp=true -c mergetool.keepBackup=false -c mergetool.trustExitCode=true mergetool --tool=sourcegit \"{file}\""; + cmd.Args = $"-c mergetool.sourcegit.cmd=\"\\\"{toolPath}\\\" {supported.Cmd}\" -c mergetool.writeToTemp=true -c mergetool.keepBackup=false -c mergetool.trustExitCode=true mergetool --tool=sourcegit {file_arg}"; return cmd.Exec(); } diff --git a/src/Models/Change.cs b/src/Models/Change.cs index 36fe20ac..e9d07181 100644 --- a/src/Models/Change.cs +++ b/src/Models/Change.cs @@ -36,7 +36,7 @@ namespace SourceGit.Models public string OriginalPath { get; set; } = ""; public ChangeDataForAmend DataForAmend { get; set; } = null; - public bool IsConflit + public bool IsConflict { get { diff --git a/src/Resources/Locales/en_US.axaml b/src/Resources/Locales/en_US.axaml index b25e4f77..9676d371 100644 --- a/src/Resources/Locales/en_US.axaml +++ b/src/Resources/Locales/en_US.axaml @@ -726,7 +726,11 @@ Stage all changes and commit You have staged {0} file(s) but only {1} file(s) displayed ({2} files are filtered out). Do you want to continue? CONFLICTS DETECTED + OPEN EXTERNAL MERGETOOL + OPEN ALL CONFLICTS IN EXTERNAL MERGETOOL FILE CONFLICTS ARE RESOLVED + USE MINE + USE THEIRS INCLUDE UNTRACKED FILES NO RECENT INPUT MESSAGES NO COMMIT TEMPLATES diff --git a/src/ViewModels/WorkingCopy.cs b/src/ViewModels/WorkingCopy.cs index 83813f39..802c6c5d 100644 --- a/src/ViewModels/WorkingCopy.cs +++ b/src/ViewModels/WorkingCopy.cs @@ -243,7 +243,7 @@ namespace SourceGit.ViewModels // Just force refresh selected changes. Dispatcher.UIThread.Invoke(() => { - HasUnsolvedConflicts = _cached.Find(x => x.IsConflit) != null; + HasUnsolvedConflicts = _cached.Find(x => x.IsConflict) != null; UpdateDetail(); UpdateInProgressState(); @@ -275,7 +275,7 @@ namespace SourceGit.ViewModels if (c.WorkTree != Models.ChangeState.None) { unstaged.Add(c); - hasConflict |= c.IsConflit; + hasConflict |= c.IsConflict; } } @@ -314,6 +314,12 @@ namespace SourceGit.ViewModels }); } + public void OpenExternalMergeToolAllConflicts() + { + // No arg, mergetool runs on all files with merge conflicts! + UseExternalMergeTool(null); + } + public void OpenAssumeUnchanged() { App.OpenDialog(new Views.AssumeUnchangedManager() @@ -373,7 +379,7 @@ namespace SourceGit.ViewModels foreach (var change in changes) { - if (!change.IsConflit) + if (!change.IsConflict) continue; if (change.WorkTree == Models.ChangeState.Deleted) @@ -413,7 +419,7 @@ namespace SourceGit.ViewModels foreach (var change in changes) { - if (!change.IsConflit) + if (!change.IsConflict) continue; if (change.Index == Models.ChangeState.Deleted) @@ -448,7 +454,8 @@ namespace SourceGit.ViewModels { var toolType = Preferences.Instance.ExternalMergeToolType; var toolPath = Preferences.Instance.ExternalMergeToolPath; - await Task.Run(() => Commands.MergeTool.OpenForMerge(_repo.FullPath, toolType, toolPath, change.Path)); + var file = change?.Path; // NOTE: With no arg, mergetool runs on on every file with merge conflicts! + await Task.Run(() => Commands.MergeTool.OpenForMerge(_repo.FullPath, toolType, toolPath, file)); } public void ContinueMerge() @@ -585,7 +592,7 @@ namespace SourceGit.ViewModels menu.Items.Add(openWith); menu.Items.Add(new MenuItem() { Header = "-" }); - if (change.IsConflit) + if (change.IsConflict) { var useTheirs = new MenuItem(); useTheirs.Icon = App.CreateMenuIcon("Icons.Incoming"); @@ -924,20 +931,20 @@ namespace SourceGit.ViewModels else { var hasConflicts = false; - var hasNoneConflicts = false; + var hasNonConflicts = false; foreach (var change in _selectedUnstaged) { - if (change.IsConflit) + if (change.IsConflict) hasConflicts = true; else - hasNoneConflicts = true; + hasNonConflicts = true; } if (hasConflicts) { - if (hasNoneConflicts) + if (hasNonConflicts) { - App.RaiseException(_repo.FullPath, "You have selected both non-conflict changes with conflicts!"); + App.RaiseException(_repo.FullPath, "Selection contains both conflict and non-conflict changes!"); return null; } @@ -1644,7 +1651,7 @@ namespace SourceGit.ViewModels if (change == null) DetailContext = null; - else if (change.IsConflit && isUnstaged) + else if (change.IsConflict && isUnstaged) DetailContext = new Conflict(_repo, this, change); else DetailContext = new DiffContext(_repo.FullPath, new Models.DiffOption(change, isUnstaged), _detailContext as DiffContext); diff --git a/src/Views/ChangeStatusIcon.cs b/src/Views/ChangeStatusIcon.cs index 5d34be09..7dbd0beb 100644 --- a/src/Views/ChangeStatusIcon.cs +++ b/src/Views/ChangeStatusIcon.cs @@ -93,7 +93,7 @@ namespace SourceGit.Views string indicator; if (IsUnstagedChange) { - if (Change.IsConflit) + if (Change.IsConflict) { background = Brushes.OrangeRed; indicator = "!"; @@ -139,7 +139,7 @@ namespace SourceGit.Views } if (isUnstaged) - ToolTip.SetTip(this, c.IsConflit ? "Conflict" : TIPS[(int)c.WorkTree]); + ToolTip.SetTip(this, c.IsConflict ? "Conflict" : TIPS[(int)c.WorkTree]); else ToolTip.SetTip(this, TIPS[(int)c.Index]); diff --git a/src/Views/Conflict.axaml b/src/Views/Conflict.axaml index 2dce264e..7f13f14e 100644 --- a/src/Views/Conflict.axaml +++ b/src/Views/Conflict.axaml @@ -105,9 +105,9 @@ - + - - - -