diff --git a/src/Commands/Checkout.cs b/src/Commands/Checkout.cs index dd1426fb..d65e9e73 100644 --- a/src/Commands/Checkout.cs +++ b/src/Commands/Checkout.cs @@ -28,17 +28,31 @@ namespace SourceGit.Commands return Exec(); } - public bool File(string file, bool useTheirs) + public bool UseTheirs(List files) { - if (useTheirs) + StringBuilder builder = new StringBuilder(); + builder.Append("checkout --theirs --"); + foreach (var f in files) { - Args = $"checkout --theirs -- \"{file}\""; - } - else - { - Args = $"checkout --ours -- \"{file}\""; + builder.Append(" \""); + builder.Append(f); + builder.Append("\""); } + Args = builder.ToString(); + return Exec(); + } + public bool UseMine(List files) + { + StringBuilder builder = new StringBuilder(); + builder.Append("checkout --ours --"); + foreach (var f in files) + { + builder.Append(" \""); + builder.Append(f); + builder.Append("\""); + } + Args = builder.ToString(); return Exec(); } diff --git a/src/Resources/Icons.axaml b/src/Resources/Icons.axaml index b2b5876f..5f036c97 100644 --- a/src/Resources/Icons.axaml +++ b/src/Resources/Icons.axaml @@ -11,7 +11,7 @@ M192 192m-64 0a64 64 0 1 0 128 0 64 64 0 1 0-128 0ZM192 512m-64 0a64 64 0 1 0 128 0 64 64 0 1 0-128 0ZM192 832m-64 0a64 64 0 1 0 128 0 64 64 0 1 0-128 0ZM864 160H352c-17.7 0-32 14.3-32 32s14.3 32 32 32h512c17.7 0 32-14.3 32-32s-14.3-32-32-32zM864 480H352c-17.7 0-32 14.3-32 32s14.3 32 32 32h512c17.7 0 32-14.3 32-32s-14.3-32-32-32zM864 800H352c-17.7 0-32 14.3-32 32s14.3 32 32 32h512c17.7 0 32-14.3 32-32s-14.3-32-32-32z M512 945c-238 0-433-195-433-433S274 79 512 79c238 0 433 195 433 433S750 945 512 945M512 0C228 0 0 228 0 512s228 512 512 512 512-228 512-512-228-512-512-512zM752 477H364l128-128a38 38 0 000-55 38 38 0 00-55 0l-185 183a55 55 0 00-16 39c0 16 6 30 16 39l185 185a39 39 0 0028 12 34 34 0 0028-14 38 38 0 000-55l-128-128h386c22 0 41-18 41-39a39 39 0 00-39-39 M576 832C576 867 547 896 512 896 477 896 448 867 448 832 448 797 477 768 512 768 547 768 576 797 576 832ZM512 256C477 256 448 285 448 320L448 640C448 675 477 704 512 704 547 704 576 675 576 640L576 320C576 285 547 256 512 256ZM1024 896C1024 967 967 1024 896 1024L128 1024C57 1024 0 967 0 896 0 875 5 855 14 837L14 837 398 69 398 69C420 28 462 0 512 0 562 0 604 28 626 69L1008 835C1018 853 1024 874 1024 896ZM960 896C960 885 957 875 952 865L952 864 951 863 569 98C557 77 536 64 512 64 488 64 466 77 455 99L452 105 92 825 93 825 71 867C66 876 64 886 64 896 64 931 93 960 128 960L896 960C931 960 960 931 960 896Z - M352 64h320L960 352v320L672 960h-320L64 672v-320L352 64zm161 363L344 256 260 341 429 512l-169 171L344 768 513 597 682 768l85-85L598 512l169-171L682 256 513 427z + M608 0q48 0 88 23t63 63 23 87v70h55q35 0 67 14t57 38 38 57 14 67V831q0 34-14 66t-38 57-57 38-67 13H426q-34 0-66-13t-57-38-38-57-14-66v-70h-56q-34 0-66-14t-57-38-38-57-13-67V174q0-47 23-87T109 23 196 0h412m175 244H426q-46 0-86 22T278 328t-26 85v348H608q47 0 86-22t63-62 25-85l1-348m-269 318q18 0 31 13t13 31-13 31-31 13-31-13-13-31 13-31 31-13m0-212q13 0 22 9t11 22v125q0 14-9 23t-22 10-23-7-11-22l-1-126q0-13 10-23t23-10z m186 532 287 0 0 287c0 11 9 20 20 20s20-9 20-20l0-287 287 0c11 0 20-9 20-20s-9-20-20-20l-287 0 0-287c0-11-9-20-20-20s-20 9-20 20l0 287-287 0c-11 0-20 9-20 20s9 20 20 20z M716.3 383.1c0 38.4-6.5 76-19.4 111.8l-10.7 29.7 229.6 229.5c44.5 44.6 44.5 117.1 0 161.6a113.6 113.6 0 01-80.8 33.5a113.6 113.6 0 01-80.8-33.5L529 694l-32 13a331.6 331.6 0 01-111.9 19.4A333.5 333.5 0 0150 383.1c0-39 6.8-77.2 20-113.6L285 482l194-195-214-210A331 331 0 01383.1 50A333.5 333.5 0 01716.3 383.1zM231.6 31.6l-22.9 9.9a22.2 22.2 0 00-5.9 4.2a19.5 19.5 0 000 27.5l215 215.2L288.4 417.8 77.8 207.1a26 26 0 00-17.2-7.1a22.8 22.8 0 00-21.5 15a400.5 400.5 0 00-7.5 16.6A381.6 381.6 0 000 384c0 211.7 172.2 384 384 384c44.3 0 87.6-7.5 129-22.3L743.1 975.8A163.5 163.5 0 00859.5 1024c43.9 0 85.3-17.1 116.4-48.2a164.8 164.8 0 000-233L745.5 513C760.5 471.5 768 428 768 384C768 172 596 0 384 0c-53 0-104 10.5-152.5 31.5z M928 500a21 21 0 00-19-20L858 472a11 11 0 01-9-9c-1-6-2-13-3-19a11 11 0 015-12l46-25a21 21 0 0010-26l-8-22a21 21 0 00-24-13l-51 10a11 11 0 01-12-6c-3-6-6-11-10-17a11 11 0 011-13l34-39a21 21 0 001-28l-15-18a20 20 0 00-27-4l-45 27a11 11 0 01-13-1c-5-4-10-9-15-12a11 11 0 01-3-12l19-49a21 21 0 00-9-26l-20-12a21 21 0 00-27 6L650 193a9 9 0 01-11 3c-1-1-12-5-20-7a11 11 0 01-7-10l1-52a21 21 0 00-17-22l-23-4a21 21 0 00-24 14L532 164a11 11 0 01-11 7h-20a11 11 0 01-11-7l-17-49a21 21 0 00-24-15l-23 4a21 21 0 00-17 22l1 52a11 11 0 01-8 11c-5 2-15 6-19 7c-4 1-8 0-12-4l-33-40A21 21 0 00313 146l-20 12A21 21 0 00285 184l19 49a11 11 0 01-3 12c-5 4-10 8-15 12a11 11 0 01-13 1L228 231a21 21 0 00-27 4L186 253a21 21 0 001 28L221 320a11 11 0 011 13c-3 5-7 11-10 17a11 11 0 01-12 6l-51-10a21 21 0 00-24 13l-8 22a21 21 0 0010 26l46 25a11 11 0 015 12l0 3c-1 6-2 11-3 16a11 11 0 01-9 9l-51 8A21 21 0 0096 500v23A21 21 0 00114 544l51 8a11 11 0 019 9c1 6 2 13 3 19a11 11 0 01-5 12l-46 25a21 21 0 00-10 26l8 22a21 21 0 0024 13l51-10a11 11 0 0112 6c3 6 6 11 10 17a11 11 0 01-1 13l-34 39a21 21 0 00-1 28l15 18a20 20 0 0027 4l45-27a11 11 0 0113 1c5 4 10 9 15 12a11 11 0 013 12l-19 49a21 21 0 009 26l20 12a21 21 0 0027-6L374 832c3-3 7-5 10-4c7 3 12 5 20 7a11 11 0 018 10l-1 52a21 21 0 0017 22l23 4a21 21 0 0024-14l17-50a11 11 0 0111-7h20a11 11 0 0111 7l17 49a21 21 0 0020 15a19 19 0 004 0l23-4a21 21 0 0017-22l-1-52a11 11 0 018-10c8-3 13-5 18-7l1 0c6-2 9 0 11 3l34 41A21 21 0 00710 878l20-12a21 21 0 009-26l-18-49a11 11 0 013-12c5-4 10-8 15-12a11 11 0 0113-1l45 27a21 21 0 0027-4l15-18a21 21 0 00-1-28l-34-39a11 11 0 01-1-13c3-5 7-11 10-17a11 11 0 0112-6l51 10a21 21 0 0024-13l8-22a21 21 0 00-10-26l-46-25a11 11 0 01-5-12l0-3c1-6 2-11 3-16a11 11 0 019-9l51-8a21 21 0 0018-21v-23zm-565 188a32 32 0 01-51 5a270 270 0 011-363a32 32 0 0151 6l91 161a32 32 0 010 31zM512 782a270 270 0 01-57-6a32 32 0 01-20-47l92-160a32 32 0 0127-16h184a32 32 0 0130 41c-35 109-137 188-257 188zm15-328L436 294a32 32 0 0121-47a268 268 0 0155-6c120 0 222 79 257 188a32 32 0 01-30 41h-184a32 32 0 01-28-16z @@ -88,4 +88,6 @@ M875 128h-725A107 107 0 0043 235v555A107 107 0 00149 896h725a107 107 0 00107-107v-555A107 107 0 00875 128zm-115 640h-183v-58l25-3c15 0 19-8 14-24l-22-61H419l-28 82 39 2V768h-166v-58l18-3c18-2 22-11 26-24l125-363-40-4V256h168l160 448 39 3zM506 340l-72 218h145l-71-218h-2z M900 287c40 69 60 144 60 225s-20 156-60 225c-40 69-94 123-163 163-69 40-144 60-225 60s-156-20-225-60c-69-40-123-94-163-163C84 668 64 593 64 512s20-156 60-225 94-123 163-163c69-40 144-60 225-60s156 20 225 60 123 94 163 163zM762 512c0-9-3-16-9-22L578 315l-44-44c-6-6-13-9-22-9s-16 3-22 9l-44 44-176 176c-6 6-9 13-9 22s3 16 9 22l44 44c6 6 13 9 22 9s16-3 22-9l92-92v269c0 9 3 16 9 22 6 6 13 9 22 9h62c8 0 16-3 22-9 6-6 9-13 9-22V486l92 92c6 6 13 9 22 9 8 0 16-3 22-9l44-44c6-6 9-13 9-22z M765 555C747 661 661 747 555 765L555 683 469 683 469 765C363 747 277 661 259 555L341 555 341 469 259 469C277 363 363 277 469 259L469 341 555 341 555 259C661 277 747 363 765 469L683 469 683 555 765 555M851 469C832 315 709 192 555 173L555 85 469 85 469 173C315 192 192 315 173 469L85 469 85 555 173 555C192 709 315 832 469 851L469 939 555 939 555 851C709 832 832 709 851 555L939 555 939 469 851 469M512 427C559 427 597 465 597 512 597 559 559 597 512 597 465 597 427 559 427 512 427 465 465 427 512 427L512 427Z + M973 358a51 51 0 0151 51v563a51 51 0 01-51 51H51a51 51 0 01-51-51V410a51 51 0 0151-51h256a51 51 0 110 102H102v461h819V461h-205a51 51 0 110-102h256zM51 102a51 51 0 110-102h256c141 0 256 115 256 256v388l66-66a51 51 0 1172 72l-154 154a51 51 0 01-72 0l-154-154a51 51 0 1172-72L461 644V256c0-85-69-154-154-154H51z + M976 0h-928A48 48 0 000 48v652a48 48 0 0048 48h416V928H200a48 48 0 000 96h624a48 48 0 000-96H560v-180h416a48 48 0 0048-48V48A48 48 0 00976 0zM928 652H96V96h832v556z diff --git a/src/Resources/Locales/en_US.axaml b/src/Resources/Locales/en_US.axaml index 0ad2afe9..870868ac 100644 --- a/src/Resources/Locales/en_US.axaml +++ b/src/Resources/Locales/en_US.axaml @@ -160,6 +160,7 @@ Discard... Discard {0} files... Discard Changes in Selected Line(s) + Open External Merge Tool Save As Patch... Stage... Stage {0} files... @@ -169,6 +170,8 @@ Unstage Unstage {0} files Unstage Changes in Selected Line(s) + Use Theirs (checkout --theirs) + Use Mine (checkout --ours) File History FILTER Git-Flow @@ -431,7 +434,6 @@ INCLUDE UNTRACKED FILES MESSAGE HISTORIES NO RECENT INPUT MESSAGES - OPEN MERGE STAGED UNSTAGE UNSTAGE ALL @@ -439,6 +441,5 @@ STAGE STAGE ALL VIEW ASSUME UNCHANGED - USE MINE - USE THEIRS + Right-click the selected file(s), and make your choice to resolve conflicts. diff --git a/src/Resources/Locales/zh_CN.axaml b/src/Resources/Locales/zh_CN.axaml index fb7fecc3..330961f9 100644 --- a/src/Resources/Locales/zh_CN.axaml +++ b/src/Resources/Locales/zh_CN.axaml @@ -160,6 +160,7 @@ 放弃更改... 放弃 {0} 个文件的更改... 放弃选中的更改 + 使用外部合并工具打开 另存为补丁... 暂存(add)... 暂存(add){0} 个文件... @@ -169,6 +170,8 @@ 从暂存中移除 从暂存中移除 {0} 个文件 从暂存中移除选中的更改 + 使用 THEIRS (checkout --theirs) + 使用 MINE (checkout --ours) 文件历史 过滤 GIT工作流 @@ -431,7 +434,6 @@ 显示未跟踪文件 历史提交信息 没有提交信息记录 - 打开合并工具 已暂存 从暂存区移除选中 从暂存区移除所有 @@ -439,6 +441,5 @@ 暂存选中 暂存所有 查看忽略变更文件 - 使用MINE - 使用THEIRS + 请选中冲突文件,打开右键菜单,选择合适的解决方式 diff --git a/src/ViewModels/Histories.cs b/src/ViewModels/Histories.cs index bf119eac..a4102543 100644 --- a/src/ViewModels/Histories.cs +++ b/src/ViewModels/Histories.cs @@ -129,6 +129,7 @@ namespace SourceGit.ViewModels { var commit = commits[0] as Models.Commit; AutoSelectedCommit = commit; + NavigationId = _navigationId + 1; if (_detailContext is CommitDetail detail) { diff --git a/src/ViewModels/WorkingCopy.cs b/src/ViewModels/WorkingCopy.cs index a52a31df..83cff278 100644 --- a/src/ViewModels/WorkingCopy.cs +++ b/src/ViewModels/WorkingCopy.cs @@ -386,34 +386,42 @@ namespace SourceGit.ViewModels } } - public async void UseTheirs() + public async void UseTheirs(List changes) { - if (_detailContext is ConflictContext ctx) + var files = new List(); + foreach (var change in changes) { - _repo.SetWatcherEnabled(false); - var succ = await Task.Run(() => new Commands.Checkout(_repo.FullPath).File(ctx.Change.Path, true)); - if (succ) - { - await Task.Run(() => new Commands.Add(_repo.FullPath, [ctx.Change]).Exec()); - } - _repo.MarkWorkingCopyDirtyManually(); - _repo.SetWatcherEnabled(true); + if (change.IsConflit) + files.Add(change.Path); } + + _repo.SetWatcherEnabled(false); + var succ = await Task.Run(() => new Commands.Checkout(_repo.FullPath).UseTheirs(files)); + if (succ) + { + await Task.Run(() => new Commands.Add(_repo.FullPath, changes).Exec()); + } + _repo.MarkWorkingCopyDirtyManually(); + _repo.SetWatcherEnabled(true); } - public async void UseMine() + public async void UseMine(List changes) { - if (_detailContext is ConflictContext ctx) + var files = new List(); + foreach (var change in changes) { - _repo.SetWatcherEnabled(false); - var succ = await Task.Run(() => new Commands.Checkout(_repo.FullPath).File(ctx.Change.Path, false)); - if (succ) - { - await Task.Run(() => new Commands.Add(_repo.FullPath, [ctx.Change]).Exec()); - } - _repo.MarkWorkingCopyDirtyManually(); - _repo.SetWatcherEnabled(true); + if (change.IsConflit) + files.Add(change.Path); } + + _repo.SetWatcherEnabled(false); + var succ = await Task.Run(() => new Commands.Checkout(_repo.FullPath).UseMine(files)); + if (succ) + { + await Task.Run(() => new Commands.Add(_repo.FullPath, changes).Exec()); + } + _repo.MarkWorkingCopyDirtyManually(); + _repo.SetWatcherEnabled(true); } public async void UseExternalMergeTool() @@ -499,6 +507,7 @@ namespace SourceGit.ViewModels Native.OS.OpenInFileManager(path, true); e.Handled = true; }; + menu.Items.Add(explore); var openWith = new MenuItem(); openWith.Header = App.Text("OpenWith"); @@ -509,82 +518,130 @@ namespace SourceGit.ViewModels Native.OS.OpenWithDefaultEditor(path); e.Handled = true; }; + menu.Items.Add(openWith); + menu.Items.Add(new MenuItem() { Header = "-" }); - var stage = new MenuItem(); - stage.Header = App.Text("FileCM.Stage"); - stage.Icon = App.CreateMenuIcon("Icons.File.Add"); - stage.Click += (_, e) => + if (change.IsConflit) { - StageChanges(changes); - e.Handled = true; - }; - - var discard = new MenuItem(); - discard.Header = App.Text("FileCM.Discard"); - discard.Icon = App.CreateMenuIcon("Icons.Undo"); - discard.Click += (_, e) => - { - Discard(changes, true); - e.Handled = true; - }; - - var stash = new MenuItem(); - stash.Header = App.Text("FileCM.Stash"); - stash.Icon = App.CreateMenuIcon("Icons.Stashes"); - stash.Click += (_, e) => - { - if (PopupHost.CanCreatePopup()) + var useTheirs = new MenuItem(); + useTheirs.Icon = App.CreateMenuIcon("Icons.Incoming"); + useTheirs.Header = App.Text("FileCM.UseTheirs"); + useTheirs.Click += (_, e) => { - PopupHost.ShowPopup(new StashChanges(_repo, changes, false)); - } - e.Handled = true; - }; - - var patch = new MenuItem(); - patch.Header = App.Text("FileCM.SaveAsPatch"); - patch.Icon = App.CreateMenuIcon("Icons.Diff"); - patch.Click += async (_, e) => - { - var topLevel = App.GetTopLevel(); - if (topLevel == null) - return; - - var options = new FilePickerSaveOptions(); - options.Title = App.Text("FileCM.SaveAsPatch"); - options.DefaultExtension = ".patch"; - options.FileTypeChoices = [new FilePickerFileType("Patch File") { Patterns = ["*.patch"] }]; - - var storageFile = await topLevel.StorageProvider.SaveFilePickerAsync(options); - if (storageFile != null) + UseTheirs(changes); + e.Handled = true; + }; + + var useMine = new MenuItem(); + useMine.Icon = App.CreateMenuIcon("Icons.Local"); + useMine.Header = App.Text("FileCM.UseMine"); + useMine.Click += (_, e) => { - var succ = await Task.Run(() => Commands.SaveChangesAsPatch.Exec(_repo.FullPath, changes, true, storageFile.Path.LocalPath)); - if (succ) - App.SendNotification(_repo.FullPath, App.Text("SaveAsPatchSuccess")); - } + UseMine(changes); + e.Handled = true; + }; - e.Handled = true; - }; + var openMerger = new MenuItem(); + openMerger.Icon = App.CreateMenuIcon("Icons.OpenWith"); + openMerger.Header = App.Text("FileCM.OpenWithExternalMerger"); + openMerger.Click += (_, e) => + { + UseExternalMergeTool(); + e.Handled = true; + }; - var history = new MenuItem(); - history.Header = App.Text("FileHistory"); - history.Icon = App.CreateMenuIcon("Icons.Histories"); - history.Click += (_, e) => + menu.Items.Add(useTheirs); + menu.Items.Add(useMine); + menu.Items.Add(openMerger); + menu.Items.Add(new MenuItem() { Header = "-" }); + } + else { - var window = new Views.FileHistories() { DataContext = new FileHistories(_repo.FullPath, change.Path) }; - window.Show(); - e.Handled = true; - }; + var stage = new MenuItem(); + stage.Header = App.Text("FileCM.Stage"); + stage.Icon = App.CreateMenuIcon("Icons.File.Add"); + stage.Click += (_, e) => + { + StageChanges(changes); + e.Handled = true; + }; - var assumeUnchanged = new MenuItem(); - assumeUnchanged.Header = App.Text("FileCM.AssumeUnchanged"); - assumeUnchanged.Icon = App.CreateMenuIcon("Icons.File.Ignore"); - assumeUnchanged.IsEnabled = change.WorkTree != Models.ChangeState.Untracked; - assumeUnchanged.Click += (_, e) => - { - new Commands.AssumeUnchanged(_repo.FullPath).Add(change.Path); - e.Handled = true; - }; + var discard = new MenuItem(); + discard.Header = App.Text("FileCM.Discard"); + discard.Icon = App.CreateMenuIcon("Icons.Undo"); + discard.Click += (_, e) => + { + Discard(changes, true); + e.Handled = true; + }; + var stash = new MenuItem(); + stash.Header = App.Text("FileCM.Stash"); + stash.Icon = App.CreateMenuIcon("Icons.Stashes"); + stash.Click += (_, e) => + { + if (PopupHost.CanCreatePopup()) + { + PopupHost.ShowPopup(new StashChanges(_repo, changes, false)); + } + e.Handled = true; + }; + + var patch = new MenuItem(); + patch.Header = App.Text("FileCM.SaveAsPatch"); + patch.Icon = App.CreateMenuIcon("Icons.Diff"); + patch.Click += async (_, e) => + { + var topLevel = App.GetTopLevel(); + if (topLevel == null) + return; + + var options = new FilePickerSaveOptions(); + options.Title = App.Text("FileCM.SaveAsPatch"); + options.DefaultExtension = ".patch"; + options.FileTypeChoices = [new FilePickerFileType("Patch File") { Patterns = ["*.patch"] }]; + + var storageFile = await topLevel.StorageProvider.SaveFilePickerAsync(options); + if (storageFile != null) + { + var succ = await Task.Run(() => Commands.SaveChangesAsPatch.Exec(_repo.FullPath, changes, true, storageFile.Path.LocalPath)); + if (succ) + App.SendNotification(_repo.FullPath, App.Text("SaveAsPatchSuccess")); + } + + e.Handled = true; + }; + + var history = new MenuItem(); + history.Header = App.Text("FileHistory"); + history.Icon = App.CreateMenuIcon("Icons.Histories"); + history.Click += (_, e) => + { + var window = new Views.FileHistories() { DataContext = new FileHistories(_repo.FullPath, change.Path) }; + window.Show(); + e.Handled = true; + }; + + var assumeUnchanged = new MenuItem(); + assumeUnchanged.Header = App.Text("FileCM.AssumeUnchanged"); + assumeUnchanged.Icon = App.CreateMenuIcon("Icons.File.Ignore"); + assumeUnchanged.IsEnabled = change.WorkTree != Models.ChangeState.Untracked; + assumeUnchanged.Click += (_, e) => + { + new Commands.AssumeUnchanged(_repo.FullPath).Add(change.Path); + e.Handled = true; + }; + + menu.Items.Add(stage); + menu.Items.Add(discard); + menu.Items.Add(stash); + menu.Items.Add(patch); + menu.Items.Add(new MenuItem() { Header = "-" }); + menu.Items.Add(history); + menu.Items.Add(assumeUnchanged); + menu.Items.Add(new MenuItem() { Header = "-" }); + } + var copy = new MenuItem(); copy.Header = App.Text("CopyPath"); copy.Icon = App.CreateMenuIcon("Icons.Copy"); @@ -592,23 +649,56 @@ namespace SourceGit.ViewModels { App.CopyText(change.Path); e.Handled = true; - }; - - menu.Items.Add(explore); - menu.Items.Add(openWith); - menu.Items.Add(new MenuItem() { Header = "-" }); - menu.Items.Add(stage); - menu.Items.Add(discard); - menu.Items.Add(stash); - menu.Items.Add(patch); - menu.Items.Add(new MenuItem() { Header = "-" }); - menu.Items.Add(history); - menu.Items.Add(assumeUnchanged); - menu.Items.Add(new MenuItem() { Header = "-" }); + }; menu.Items.Add(copy); } else { + var hasConflicts = false; + var hasNoneConflicts = false; + foreach (var change in changes) + { + if (change.IsConflit) + { + hasConflicts = true; + } + else + { + hasNoneConflicts = true; + } + } + + if (hasConflicts) + { + if (hasNoneConflicts) + { + App.RaiseException(_repo.FullPath, "You have selected both non-conflict changes with conflicts!"); + return null; + } + + var useTheirs = new MenuItem(); + useTheirs.Icon = App.CreateMenuIcon("Icons.Incoming"); + useTheirs.Header = App.Text("FileCM.UseTheirs"); + useTheirs.Click += (_, e) => + { + UseTheirs(changes); + e.Handled = true; + }; + + var useMine = new MenuItem(); + useMine.Icon = App.CreateMenuIcon("Icons.Local"); + useMine.Header = App.Text("FileCM.UseMine"); + useMine.Click += (_, e) => + { + UseMine(changes); + e.Handled = true; + }; + + menu.Items.Add(useTheirs); + menu.Items.Add(useMine); + return menu; + } + var stage = new MenuItem(); stage.Header = App.Text("FileCM.StageMulti", changes.Count); stage.Icon = App.CreateMenuIcon("Icons.File.Add"); diff --git a/src/Views/Histories.axaml.cs b/src/Views/Histories.axaml.cs index 16ca541c..4a214784 100644 --- a/src/Views/Histories.axaml.cs +++ b/src/Views/Histories.axaml.cs @@ -296,11 +296,6 @@ namespace SourceGit.Views if (DataContext is ViewModels.Histories histories) { histories.Select(commitDataGrid.SelectedItems); - - if (histories.DetailContext is ViewModels.CommitDetail detail) - { - commitDataGrid.ScrollIntoView(detail.Commit, null); - } } e.Handled = true; } diff --git a/src/Views/WorkingCopy.axaml b/src/Views/WorkingCopy.axaml index 7d7c2ed2..dba6bc08 100644 --- a/src/Views/WorkingCopy.axaml +++ b/src/Views/WorkingCopy.axaml @@ -184,21 +184,21 @@ + IsVisible="{Binding Source={x:Static vm:Preference.Instance}, Path=StagedChangeViewMode, Converter={x:Static c:ChangeViewModeConverters.IsList}}"> @@ -319,12 +319,8 @@ - - -