diff --git a/README.md b/README.md index 1c8105c5..cb803676 100644 --- a/README.md +++ b/README.md @@ -31,6 +31,7 @@ Opensource Git GUI client. * Revision Diffs * Branch Diff * Image Diff - Side-By-Side/Swipe/Blend +* Search commits * GitFlow * Git LFS * Issue Link @@ -80,6 +81,7 @@ For **macOS** users: * Make sure your mac trusts all software from anywhere. For more information, search `spctl --master-disable`. * Make sure [git-credential-manager](https://github.com/git-ecosystem/git-credential-manager/releases) is installed on your mac. * You may need to run `sudo xattr -cr /Applications/SourceGit.app` to make sure the software works. +* You may need to start this app from commandline by using `open -a SourceGit` to introduce the `PATH` environment variable from your shell. For **Linux** users: diff --git a/VERSION b/VERSION index 7230dc00..b1766f34 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -8.33 \ No newline at end of file +8.34 \ No newline at end of file diff --git a/src/Commands/Command.cs b/src/Commands/Command.cs index 55fc6d17..7435dbfa 100644 --- a/src/Commands/Command.cs +++ b/src/Commands/Command.cs @@ -188,10 +188,8 @@ namespace SourceGit.Commands start.Environment.Add("SOURCEGIT_LAUNCH_AS_ASKPASS", "TRUE"); // If an SSH private key was provided, sets the environment. - if (!string.IsNullOrEmpty(SSHKey)) - start.Environment.Add("GIT_SSH_COMMAND", $"ssh -o StrictHostKeyChecking=accept-new -i '{SSHKey}'"); - else - start.Environment.Add("GIT_SSH_COMMAND", $"ssh -o StrictHostKeyChecking=accept-new"); + if (!start.Environment.ContainsKey("GIT_SSH_COMMAND") && !string.IsNullOrEmpty(SSHKey)) + start.Environment.Add("GIT_SSH_COMMAND", $"ssh -i '{SSHKey}'"); // Force using en_US.UTF-8 locale to avoid GCM crash if (OperatingSystem.IsLinux()) @@ -199,7 +197,12 @@ namespace SourceGit.Commands // Fix sometimes `LSEnvironment` not working on macOS if (OperatingSystem.IsMacOS()) - start.Environment.Add("PATH", "/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"); + { + if (start.Environment.TryGetValue("PATH", out var path)) + start.Environment.Add("PATH", $"/opt/homebrew/bin:/opt/homebrew/sbin:{path}"); + else + start.Environment.Add("PATH", "/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"); + } // Force using this app as git editor. switch (Editor) diff --git a/src/Commands/Config.cs b/src/Commands/Config.cs index 53416c86..2fb83325 100644 --- a/src/Commands/Config.cs +++ b/src/Commands/Config.cs @@ -7,17 +7,23 @@ namespace SourceGit.Commands { public Config(string repository) { - WorkingDirectory = repository; - Context = repository; + if (string.IsNullOrEmpty(repository)) + { + WorkingDirectory = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile); + } + else + { + WorkingDirectory = repository; + Context = repository; + _isLocal = true; + } + RaiseError = false; } public Dictionary ListAll() { - if (string.IsNullOrEmpty(WorkingDirectory)) - Args = "config --global -l"; - else - Args = "config -l"; + Args = "config -l"; var output = ReadToEnd(); var rs = new Dictionary(); @@ -47,22 +53,16 @@ namespace SourceGit.Commands public bool Set(string key, string value, bool allowEmpty = false) { + var scope = _isLocal ? "--local" : "--global"; + if (!allowEmpty && string.IsNullOrWhiteSpace(value)) - { - if (string.IsNullOrEmpty(WorkingDirectory)) - Args = $"config --global --unset {key}"; - else - Args = $"config --unset {key}"; - } + Args = $"config {scope} --unset {key}"; else - { - if (string.IsNullOrWhiteSpace(WorkingDirectory)) - Args = $"config --global {key} \"{value}\""; - else - Args = $"config {key} \"{value}\""; - } + Args = $"config {scope} {key} \"{value}\""; return Exec(); } + + private bool _isLocal = false; } } diff --git a/src/Commands/Remote.cs b/src/Commands/Remote.cs index 46aa37e3..f2e8d09e 100644 --- a/src/Commands/Remote.cs +++ b/src/Commands/Remote.cs @@ -32,9 +32,17 @@ return Exec(); } - public bool SetURL(string name, string url) + public string GetURL(string name, bool isPush) { - Args = $"remote set-url {name} {url}"; + Args = "remote get-url" + (isPush ? " --push " : " ") + name; + + var rs = ReadToEnd(); + return rs.IsSuccess ? rs.StdOut.Trim() : string.Empty; + } + + public bool SetURL(string name, string url, bool isPush) + { + Args = "remote set-url" + (isPush ? " --push " : " ") + $"{name} {url}"; return Exec(); } } diff --git a/src/Commands/Tag.cs b/src/Commands/Tag.cs index 5fe57f94..fa11e366 100644 --- a/src/Commands/Tag.cs +++ b/src/Commands/Tag.cs @@ -16,7 +16,7 @@ namespace SourceGit.Commands public static bool Add(string repo, string name, string basedOn, string message, bool sign) { - var param = sign ? "-s -a" : "-a"; + var param = sign ? "--sign -a" : "--no-sign -a"; var cmd = new Command(); cmd.WorkingDirectory = repo; cmd.Context = repo; diff --git a/src/Models/TextMateHelper.cs b/src/Models/TextMateHelper.cs index 2e38e4dd..0eb5e489 100644 --- a/src/Models/TextMateHelper.cs +++ b/src/Models/TextMateHelper.cs @@ -81,6 +81,8 @@ namespace SourceGit.Models public class RegistryOptionsWrapper(ThemeName defaultTheme) : IRegistryOptions { + public string LastScope { get; set; } = string.Empty; + public IRawTheme GetTheme(string scopeName) => _backend.GetTheme(scopeName); public IRawTheme GetDefaultTheme() => _backend.GetDefaultTheme(); public IRawTheme LoadTheme(ThemeName name) => _backend.LoadTheme(name); @@ -111,10 +113,15 @@ namespace SourceGit.Models public static void SetGrammarByFileName(TextMate.Installation installation, string filePath) { - if (installation is { RegistryOptions: RegistryOptionsWrapper reg }) + if (installation is { RegistryOptions: RegistryOptionsWrapper reg } && !string.IsNullOrEmpty(filePath)) { - installation.SetGrammar(reg.GetScope(filePath)); - GC.Collect(); + var scope = reg.GetScope(filePath); + if (reg.LastScope != scope) + { + reg.LastScope = scope; + installation.SetGrammar(reg.GetScope(filePath)); + GC.Collect(); + } } } } diff --git a/src/Resources/Locales/de_DE.axaml b/src/Resources/Locales/de_DE.axaml index 95c3f07f..84e93505 100644 --- a/src/Resources/Locales/de_DE.axaml +++ b/src/Resources/Locales/de_DE.axaml @@ -141,6 +141,7 @@ GIT Remotes automatisch fetchen Minute(n) + Standard Remote TICKETSYSTEM Beispiel für Github-Regel hinzufügen Beispiel für Jira-Regel hinzufügen @@ -206,6 +207,7 @@ ALT Kopieren Dateimodus geändert + Ignoriere Leerzeichenänderungen LFS OBJEKT ÄNDERUNG Nächste Änderung KEINE ÄNDERUNG ODER NUR ZEILEN-ENDE ÄNDERUNGEN @@ -225,6 +227,7 @@ Änderungen verwerfen Alle Änderungen in der Arbeitskopie. Änderungen: + Ignorierte Dateien inkludieren Insgesamt {0} Änderungen werden verworfen Du kannst das nicht rückgängig machen!!! Lesezeichen: @@ -330,6 +333,7 @@ REPOSITORY Gestagte Änderungen committen Gestagte Änderungen committen und pushen + Alle Änderungen stagen und committen Ausgewählte Änderungen verwerfen Dashboard Modus (Standard) Erzwinge Neuladen des Repositorys @@ -355,8 +359,6 @@ Interaktiver Rebase Ziel Branch: Auf: - Hochschieben - Runterschieben Source Git FEHLER INFO @@ -499,7 +501,7 @@ Repository Einstellungen WEITER Öffne im Datei-Browser - Suche Branches & Tags & Submodule + Suche Branches/Tags/Submodule GEFILTERT: LOKALE BRANCHES Zum HEAD wechseln @@ -516,6 +518,7 @@ Commit-Nachricht SHA Autor & Committer + Aktueller Branch Zeige Tags als Baum Statistiken SUBMODULE @@ -623,6 +626,8 @@ COMMIT COMMIT & PUSH Template/Historie + Klick-Ereignis auslösen + Alle Änderungen stagen und committen KONFLIKTE ERKANNT DATEI KONFLIKTE GELÖST NICHT-VERFOLGTE DATEIEN INKLUDIEREN diff --git a/src/Resources/Locales/en_US.axaml b/src/Resources/Locales/en_US.axaml index b4f52b55..22a1cde2 100644 --- a/src/Resources/Locales/en_US.axaml +++ b/src/Resources/Locales/en_US.axaml @@ -2,6 +2,7 @@ About About SourceGit • Build with + • Chart is rendered by © 2024 sourcegit-scm • TextEditor from • Monospace fonts come from @@ -313,6 +314,7 @@ Switch Horizontal/Vertical Layout Switch Curve/Polyline Graph Mode AUTHOR + AUTHOR TIME GRAPH & SUBJECT SHA COMMIT TIME @@ -356,8 +358,6 @@ Interactive Rebase Target Branch: On: - Move Up - Move Down Source Git ERROR NOTICE @@ -414,6 +414,7 @@ Check for updates on startup Language History Commits + Show author time intead of commit time in graph Subject Guide Length GIT Enable Auto CRLF @@ -500,7 +501,7 @@ Configure this repository CONTINUE Open In File Browser - Search Branches & Tags & Submodules + Search Branches/Tags/Submodules FILTERED BY: LOCAL BRANCHES Navigate To HEAD @@ -562,6 +563,8 @@ Include untracked files Message: Optional. Name of this stash + Only staged changes + Both staged and unstaged changes of selected file(s) will be stashed!!! Stash Local Changes Apply Drop diff --git a/src/Resources/Locales/fr_FR.axaml b/src/Resources/Locales/fr_FR.axaml index c90a19cb..82c7db7e 100644 --- a/src/Resources/Locales/fr_FR.axaml +++ b/src/Resources/Locales/fr_FR.axaml @@ -2,7 +2,6 @@ - À propos • Compilé avec © 2024 sourcegit-scm @@ -346,8 +345,6 @@ Interactive Rebase Target Branch: On: - Move Up - Move Down Source Git ERROR NOTICE @@ -479,7 +476,7 @@ Configure this repository CONTINUE Ouvrir dans l'explorateur Windows - Search Branches & Tags & Submodules + Search Branches/Tags/Submodules FILTERED BY: LOCAL BRANCHES Navigate To HEAD diff --git a/src/Resources/Locales/pt_BR.axaml b/src/Resources/Locales/pt_BR.axaml index b0505014..191d19a1 100644 --- a/src/Resources/Locales/pt_BR.axaml +++ b/src/Resources/Locales/pt_BR.axaml @@ -340,8 +340,6 @@ Rebase Interativo Ramo Alvo: Em: - Mover Para Cima - Mover Para Baixo Source Git ERRO AVISO @@ -471,7 +469,7 @@ Configurar este repositório CONTINUAR Abrir no Navegador de Arquivos - Pesquisar Branches & Tags & Submódulos + Pesquisar Branches/Tags/Submódulos FILTRADO POR: BRANCHES LOCAIS Navegar para HEAD diff --git a/src/Resources/Locales/ru_RU.axaml b/src/Resources/Locales/ru_RU.axaml index ceda8a9f..273b0415 100644 --- a/src/Resources/Locales/ru_RU.axaml +++ b/src/Resources/Locales/ru_RU.axaml @@ -5,6 +5,7 @@ О программе О SourceGit • Сборка с + • Диаграмма отображается с помощью © 2024 sourcegit-scm • Текстовый редактор от • Моноширинные шрифты взяты из @@ -316,6 +317,7 @@ Переключение горизонтального/вертикального расположения Переключение режима построения кривой/полилинии АВТОР + ВРЕМЯ АВТОРА ГРАФ И СУБЪЕКТ SHA ВРЕМЯ ФИКСАЦИИ @@ -359,8 +361,6 @@ Интерактивное перемещение Целевая ветка: На: - Вверх - Вниз Source Git ОШИБКА УВЕДОМЛЕНИЕ @@ -417,6 +417,7 @@ Проверить обновления при старте Язык История фиксаций + Показать время автора вместо времени фиксации на графике Длина темы фиксации GIT Включить автозавершение CRLF @@ -560,6 +561,8 @@ В: Частный ключ SSH: Путь хранения частного ключа SSH + Только подготовленные изменения + Подготовленные так и подготовленные изменения выбранных файлов будут сохранены!!! ЗАПУСК Отложить Включить неотслеживаемые файлы diff --git a/src/Resources/Locales/zh_CN.axaml b/src/Resources/Locales/zh_CN.axaml index 57712fa5..b95a85e8 100644 --- a/src/Resources/Locales/zh_CN.axaml +++ b/src/Resources/Locales/zh_CN.axaml @@ -5,6 +5,7 @@ 关于软件 关于本软件 • 项目依赖于 + • 图表绘制组件来自 © 2024 sourcegit-scm • 文本编辑器使用 • 等宽字体来自于 @@ -316,6 +317,7 @@ 切换横向/纵向显示 切换曲线/折线显示 作者 + 修改时间 路线图与主题 提交指纹 提交时间 @@ -359,8 +361,6 @@ 交互式变基 目标分支 : 起始提交 : - 向上移动 - 向下移动 Source Git 出错了 系统提示 @@ -413,6 +413,7 @@ 启动时检测软件更新 显示语言 最大历史提交数 + 在提交路线图中显示修改时间而非提交时间 SUBJECT字数检测 GIT配置 自动换行转换 @@ -498,7 +499,7 @@ 配置本仓库 下一步 在文件浏览器中打开 - 快速查找分支、标签、子模块 + 快速查找分支/标签/子模块 过滤规则 : 本地分支 定位HEAD @@ -560,6 +561,8 @@ 包含未跟踪的文件 信息 : 选填,用于命名此贮藏 + 仅贮藏暂存区的变更 + 选中文件的所有变更均会被贮藏! 贮藏本地变更 应用(apply) 删除(drop) diff --git a/src/Resources/Locales/zh_TW.axaml b/src/Resources/Locales/zh_TW.axaml index 7abfb36a..2e0fcd3f 100644 --- a/src/Resources/Locales/zh_TW.axaml +++ b/src/Resources/Locales/zh_TW.axaml @@ -5,6 +5,7 @@ 關於 關於 SourceGit • 專案依賴於 + • 圖表繪製元件來自 © 2024 sourcegit-scm • 文字編輯器使用 • 等寬字型來自於 @@ -316,6 +317,7 @@ 切換橫向/縱向顯示 切換曲線/折線顯示 作者 + 修改時間 路線圖與訊息標題 提交編號 提交時間 @@ -359,8 +361,6 @@ 互動式重定基底 目標分支: 起始提交: - 向上移動 - 向下移動 Source Git 發生錯誤 系統提示 @@ -417,6 +417,7 @@ 啟動時檢查軟體更新 顯示語言 最大歷史提交數 + 在提交路線圖中顯示修改時間而非提交時間 提交標題字數偵測 Git 設定 自動換行轉換 @@ -503,7 +504,7 @@ 設定本存放庫 下一步 在檔案瀏覽器中開啟 - 快速搜尋分支、標籤、子模組 + 快速搜尋分支/標籤/子模組 篩選規則: 本機分支 回到 HEAD @@ -565,6 +566,8 @@ 包含未追蹤的檔案 擱置變更訊息: 選填,用於命名此擱置變更 + 僅擱置已暫存的變更 + 選中檔案的所有變更均會被擱置! 擱置本機變更 套用 (apply) 刪除 (drop) diff --git a/src/ViewModels/CreateTag.cs b/src/ViewModels/CreateTag.cs index 7318e00e..af9dcf99 100644 --- a/src/ViewModels/CreateTag.cs +++ b/src/ViewModels/CreateTag.cs @@ -1,4 +1,5 @@ -using System.ComponentModel.DataAnnotations; +using System; +using System.ComponentModel.DataAnnotations; using System.Threading.Tasks; namespace SourceGit.ViewModels @@ -50,6 +51,7 @@ namespace SourceGit.ViewModels _basedOn = branch.Head; BasedOn = branch; + SignTag = new Commands.Config(repo.FullPath).Get("tag.gpgsign").Equals("true", StringComparison.OrdinalIgnoreCase); View = new Views.CreateTag() { DataContext = this }; } @@ -59,6 +61,7 @@ namespace SourceGit.ViewModels _basedOn = commit.SHA; BasedOn = commit; + SignTag = new Commands.Config(repo.FullPath).Get("tag.gpgsign").Equals("true", StringComparison.OrdinalIgnoreCase); View = new Views.CreateTag() { DataContext = this }; } diff --git a/src/ViewModels/EditRemote.cs b/src/ViewModels/EditRemote.cs index 0a514324..912c7991 100644 --- a/src/ViewModels/EditRemote.cs +++ b/src/ViewModels/EditRemote.cs @@ -118,11 +118,15 @@ namespace SourceGit.ViewModels if (_remote.URL != _url) { - var succ = new Commands.Remote(_repo.FullPath).SetURL(_name, _url); + var succ = new Commands.Remote(_repo.FullPath).SetURL(_name, _url, false); if (succ) _remote.URL = _url; } + var pushURL = new Commands.Remote(_repo.FullPath).GetURL(_name, true); + if (pushURL != _url) + new Commands.Remote(_repo.FullPath).SetURL(_name, _url, true); + SetProgressDescription("Post processing ..."); new Commands.Config(_repo.FullPath).Set($"remote.{_name}.sshkey", _useSSH ? SSHKey : null); diff --git a/src/ViewModels/Histories.cs b/src/ViewModels/Histories.cs index b5a72763..10f4b60a 100644 --- a/src/ViewModels/Histories.cs +++ b/src/ViewModels/Histories.cs @@ -153,7 +153,11 @@ namespace SourceGit.ViewModels else if (commits.Count == 1) { var commit = commits[0] as Models.Commit; - _repo.SearchResultSelectedCommit = commit; + + if (_repo.SearchResultSelectedCommit == null || _repo.SearchResultSelectedCommit.SHA != commit.SHA) + { + _repo.SearchResultSelectedCommit = _repo.SearchedCommits.Find(x => x.SHA == commit.SHA); + } AutoSelectedCommit = commit; NavigationId = _navigationId + 1; diff --git a/src/ViewModels/InteractiveRebase.cs b/src/ViewModels/InteractiveRebase.cs index 0c8838e0..355671c7 100644 --- a/src/ViewModels/InteractiveRebase.cs +++ b/src/ViewModels/InteractiveRebase.cs @@ -140,6 +140,7 @@ namespace SourceGit.ViewModels var prev = Items[idx - 1]; Items.RemoveAt(idx - 1); Items.Insert(idx, prev); + SelectedItem = item; } } @@ -151,6 +152,7 @@ namespace SourceGit.ViewModels var next = Items[idx + 1]; Items.RemoveAt(idx + 1); Items.Insert(idx, next); + SelectedItem = item; } } diff --git a/src/ViewModels/Launcher.cs b/src/ViewModels/Launcher.cs index 5abf50e8..dd618e41 100644 --- a/src/ViewModels/Launcher.cs +++ b/src/ViewModels/Launcher.cs @@ -465,6 +465,15 @@ namespace SourceGit.ViewModels private void SwitchWorkspace(Workspace to) { + foreach (var one in Pages) + { + if (one.IsInProgress()) + { + App.RaiseException(null, "You have unfinished task(s) in opened pages. Please wait!!!"); + return; + } + } + _ignoreIndexChange = true; var pref = Preference.Instance; diff --git a/src/ViewModels/Preference.cs b/src/ViewModels/Preference.cs index 68966f5d..7a635498 100644 --- a/src/ViewModels/Preference.cs +++ b/src/ViewModels/Preference.cs @@ -15,16 +15,17 @@ namespace SourceGit.ViewModels { get { - if (_instance == null) - { - _isLoading = true; - _instance = Load(); - _isLoading = false; - } + if (_instance != null) + return _instance; + + _isLoading = true; + _instance = Load(); + _isLoading = false; _instance.PrepareGit(); _instance.PrepareShellOrTerminal(); _instance.PrepareWorkspaces(); + return _instance; } } @@ -131,6 +132,12 @@ namespace SourceGit.ViewModels set => SetProperty(ref _check4UpdatesOnStartup, value); } + public bool ShowAuthorTimeInGraph + { + get => _showAuthorTimeInGraph; + set => SetProperty(ref _showAuthorTimeInGraph, value); + } + public string IgnoreUpdateTag { get => _ignoreUpdateTag; @@ -576,6 +583,7 @@ namespace SourceGit.ViewModels private int _maxHistoryCommits = 20000; private int _subjectGuideLength = 50; private bool _useFixedTabWidth = true; + private bool _showAuthorTimeInGraph = false; private bool _check4UpdatesOnStartup = true; private double _lastCheckUpdateTime = 0; diff --git a/src/ViewModels/Repository.cs b/src/ViewModels/Repository.cs index 8038f333..1a9b9955 100644 --- a/src/ViewModels/Repository.cs +++ b/src/ViewModels/Repository.cs @@ -213,7 +213,12 @@ namespace SourceGit.ViewModels public bool OnlySearchCommitsInCurrentBranch { get => _onlySearchCommitsInCurrentBranch; - set => SetProperty(ref _onlySearchCommitsInCurrentBranch, value); + set + { + if (SetProperty(ref _onlySearchCommitsInCurrentBranch, value) && + !string.IsNullOrEmpty(_searchCommitFilter)) + StartSearchCommits(); + } } public int SearchCommitFilterType @@ -222,7 +227,12 @@ namespace SourceGit.ViewModels set { if (SetProperty(ref _searchCommitFilterType, value)) + { UpdateCurrentRevisionFilesForSearchSuggestion(); + + if (!string.IsNullOrEmpty(_searchCommitFilter)) + StartSearchCommits(); + } } } diff --git a/src/ViewModels/Reset.cs b/src/ViewModels/Reset.cs index ba3a3794..9500f40a 100644 --- a/src/ViewModels/Reset.cs +++ b/src/ViewModels/Reset.cs @@ -27,7 +27,7 @@ namespace SourceGit.ViewModels _repo = repo; Current = current; To = to; - SelectedMode = Models.ResetMode.Supported[0]; + SelectedMode = Models.ResetMode.Supported[1]; View = new Views.Reset() { DataContext = this }; } diff --git a/src/ViewModels/StashChanges.cs b/src/ViewModels/StashChanges.cs index abc45492..ed3d2bfd 100644 --- a/src/ViewModels/StashChanges.cs +++ b/src/ViewModels/StashChanges.cs @@ -11,7 +11,7 @@ namespace SourceGit.ViewModels set; } - public bool CanIgnoreUntracked + public bool HasSelectedFiles { get; } @@ -22,21 +22,28 @@ namespace SourceGit.ViewModels set; } - public StashChanges(Repository repo, List changes, bool onlyStaged, bool canIgnoreUntracked) + public bool OnlyStaged + { + get; + set; + } + + public StashChanges(Repository repo, List changes, bool hasSelectedFiles) { _repo = repo; _changes = changes; - _onlyStaged = onlyStaged; - CanIgnoreUntracked = canIgnoreUntracked; + HasSelectedFiles = hasSelectedFiles; IncludeUntracked = true; + OnlyStaged = false; + View = new Views.StashChanges() { DataContext = this }; } public override Task Sure() { var jobs = _changes; - if (CanIgnoreUntracked && !IncludeUntracked) + if (!HasSelectedFiles && !IncludeUntracked) { jobs = new List(); foreach (var job in _changes) @@ -56,7 +63,7 @@ namespace SourceGit.ViewModels return Task.Run(() => { - var succ = new Commands.Stash(_repo.FullPath).Push(jobs, Message, _onlyStaged); + var succ = new Commands.Stash(_repo.FullPath).Push(jobs, Message, !HasSelectedFiles && OnlyStaged); CallUIThread(() => { _repo.MarkWorkingCopyDirtyManually(); @@ -68,6 +75,5 @@ namespace SourceGit.ViewModels private readonly Repository _repo = null; private readonly List _changes = null; - private readonly bool _onlyStaged = false; } } diff --git a/src/ViewModels/WorkingCopy.cs b/src/ViewModels/WorkingCopy.cs index 4bfb10bc..e4acf8ca 100644 --- a/src/ViewModels/WorkingCopy.cs +++ b/src/ViewModels/WorkingCopy.cs @@ -318,9 +318,9 @@ namespace SourceGit.ViewModels return; if (autoStart) - PopupHost.ShowAndStartPopup(new StashChanges(_repo, _cached, false, true)); + PopupHost.ShowAndStartPopup(new StashChanges(_repo, _cached, false)); else - PopupHost.ShowPopup(new StashChanges(_repo, _cached, false, true)); + PopupHost.ShowPopup(new StashChanges(_repo, _cached, false)); } public void StageSelected(Models.Change next) @@ -523,9 +523,8 @@ namespace SourceGit.ViewModels stash.Click += (_, e) => { if (PopupHost.CanCreatePopup()) - { - PopupHost.ShowPopup(new StashChanges(_repo, _selectedUnstaged, false, false)); - } + PopupHost.ShowPopup(new StashChanges(_repo, _selectedUnstaged, true)); + e.Handled = true; }; @@ -843,7 +842,7 @@ namespace SourceGit.ViewModels stash.Click += (_, e) => { if (PopupHost.CanCreatePopup()) - PopupHost.ShowPopup(new StashChanges(_repo, _selectedUnstaged, false, false)); + PopupHost.ShowPopup(new StashChanges(_repo, _selectedUnstaged, true)); e.Handled = true; }; @@ -928,7 +927,7 @@ namespace SourceGit.ViewModels stash.Click += (_, e) => { if (PopupHost.CanCreatePopup()) - PopupHost.ShowPopup(new StashChanges(_repo, _selectedStaged, true, false)); + PopupHost.ShowPopup(new StashChanges(_repo, _selectedStaged, true)); e.Handled = true; }; @@ -1097,7 +1096,7 @@ namespace SourceGit.ViewModels stash.Click += (_, e) => { if (PopupHost.CanCreatePopup()) - PopupHost.ShowPopup(new StashChanges(_repo, _selectedStaged, true, false)); + PopupHost.ShowPopup(new StashChanges(_repo, _selectedStaged, true)); e.Handled = true; }; diff --git a/src/Views/About.axaml b/src/Views/About.axaml index 6f65fc8e..159a34a9 100644 --- a/src/Views/About.axaml +++ b/src/Views/About.axaml @@ -49,7 +49,7 @@ HorizontalAlignment="Center" VerticalAlignment="Center"/> - + @@ -74,6 +74,11 @@ + + + + + diff --git a/src/Views/About.axaml.cs b/src/Views/About.axaml.cs index 97b85ac8..4f7f953f 100644 --- a/src/Views/About.axaml.cs +++ b/src/Views/About.axaml.cs @@ -44,6 +44,12 @@ namespace SourceGit.Views e.Handled = true; } + private void OnVisitLiveCharts2(object _, PointerPressedEventArgs e) + { + Native.OS.OpenBrowser("https://livecharts.dev/"); + e.Handled = true; + } + private void OnVisitSourceCode(object _, PointerPressedEventArgs e) { Native.OS.OpenBrowser("https://github.com/sourcegit-scm/sourcegit"); diff --git a/src/Views/CheckoutCommit.axaml b/src/Views/CheckoutCommit.axaml index 521d2b08..37021565 100644 --- a/src/Views/CheckoutCommit.axaml +++ b/src/Views/CheckoutCommit.axaml @@ -43,7 +43,8 @@ Fill="DarkOrange"/> + TextWrapping="Wrap" + Foreground="DarkOrange"/> diff --git a/src/Views/Discard.axaml b/src/Views/Discard.axaml index d37662b0..23162060 100644 --- a/src/Views/Discard.axaml +++ b/src/Views/Discard.axaml @@ -18,7 +18,7 @@ Fill="DarkOrange"/> + Foreground="DarkOrange"/> diff --git a/src/Views/Histories.axaml b/src/Views/Histories.axaml index 3996554d..65ec029d 100644 --- a/src/Views/Histories.axaml +++ b/src/Views/Histories.axaml @@ -51,7 +51,14 @@ - + + @@ -180,13 +187,13 @@ Opacity="{Binding Opacity}"/> - + diff --git a/src/Views/Histories.axaml.cs b/src/Views/Histories.axaml.cs index 2c8014ca..66aac50b 100644 --- a/src/Views/Histories.axaml.cs +++ b/src/Views/Histories.axaml.cs @@ -303,13 +303,13 @@ namespace SourceGit.Views set => SetValue(ShowAsDateTimeProperty, value); } - public static readonly StyledProperty TimestampProperty = - AvaloniaProperty.Register(nameof(Timestamp)); + public static readonly StyledProperty UseAuthorTimeProperty = + AvaloniaProperty.Register(nameof(UseAuthorTime), true); - public ulong Timestamp + public bool UseAuthorTime { - get => GetValue(TimestampProperty); - set => SetValue(TimestampProperty, value); + get => GetValue(UseAuthorTimeProperty); + set => SetValue(UseAuthorTimeProperty, value); } protected override Type StyleKeyOverride => typeof(TextBlock); @@ -318,7 +318,7 @@ namespace SourceGit.Views { base.OnPropertyChanged(change); - if (change.Property == TimestampProperty) + if (change.Property == UseAuthorTimeProperty) { SetCurrentValue(TextProperty, GetDisplayText()); } @@ -347,6 +347,12 @@ namespace SourceGit.Views StopTimer(); } + protected override void OnDataContextChanged(EventArgs e) + { + base.OnDataContextChanged(e); + SetCurrentValue(TextProperty, GetDisplayText()); + } + private void StartTimer() { if (_refreshTimer != null) @@ -376,30 +382,35 @@ namespace SourceGit.Views private string GetDisplayText() { + var commit = DataContext as Models.Commit; + if (commit == null) + return string.Empty; + + var timestamp = UseAuthorTime ? commit.AuthorTime : commit.CommitterTime; if (ShowAsDateTime) - return DateTime.UnixEpoch.AddSeconds(Timestamp).ToLocalTime().ToString("yyyy/MM/dd HH:mm:ss"); + return DateTime.UnixEpoch.AddSeconds(timestamp).ToLocalTime().ToString("yyyy/MM/dd HH:mm:ss"); var today = DateTime.Today; - var committerTime = DateTime.UnixEpoch.AddSeconds(Timestamp).ToLocalTime(); + var localTime = DateTime.UnixEpoch.AddSeconds(timestamp).ToLocalTime(); - if (committerTime >= today) + if (localTime >= today) { var now = DateTime.Now; - var timespan = now - committerTime; + var timespan = now - localTime; if (timespan.TotalHours > 1) return App.Text("Period.HoursAgo", (int)timespan.TotalHours); return timespan.TotalMinutes < 1 ? App.Text("Period.JustNow") : App.Text("Period.MinutesAgo", (int)timespan.TotalMinutes); } - var diffYear = today.Year - committerTime.Year; + var diffYear = today.Year - localTime.Year; if (diffYear == 0) { - var diffMonth = today.Month - committerTime.Month; + var diffMonth = today.Month - localTime.Month; if (diffMonth > 0) return diffMonth == 1 ? App.Text("Period.LastMonth") : App.Text("Period.MonthsAgo", diffMonth); - var diffDay = today.Day - committerTime.Day; + var diffDay = today.Day - localTime.Day; return diffDay == 1 ? App.Text("Period.Yesterday") : App.Text("Period.DaysAgo", diffDay); } diff --git a/src/Views/InteractiveRebase.axaml b/src/Views/InteractiveRebase.axaml index a8f9d360..e1161a2b 100644 --- a/src/Views/InteractiveRebase.axaml +++ b/src/Views/InteractiveRebase.axaml @@ -59,14 +59,14 @@ - + - - + VerticalContentAlignment="Center"> - - diff --git a/src/Views/StashChanges.axaml b/src/Views/StashChanges.axaml index 95299ff1..5396da4d 100644 --- a/src/Views/StashChanges.axaml +++ b/src/Views/StashChanges.axaml @@ -11,7 +11,7 @@ - + + + + IsVisible="{Binding !HasSelectedFiles}"/> + + diff --git a/src/Views/TextDiffView.axaml b/src/Views/TextDiffView.axaml index b14bb07d..4ba8628e 100644 --- a/src/Views/TextDiffView.axaml +++ b/src/Views/TextDiffView.axaml @@ -74,7 +74,7 @@ - +