Merge branch 'release/v8.34'

This commit is contained in:
leo 2024-10-14 09:27:32 +08:00
commit efc14fed36
No known key found for this signature in database
37 changed files with 323 additions and 145 deletions

View file

@ -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:

View file

@ -1 +1 @@
8.33
8.34

View file

@ -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)

View file

@ -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<string, string> ListAll()
{
if (string.IsNullOrEmpty(WorkingDirectory))
Args = "config --global -l";
else
Args = "config -l";
Args = "config -l";
var output = ReadToEnd();
var rs = new Dictionary<string, string>();
@ -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;
}
}

View file

@ -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();
}
}

View file

@ -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;

View file

@ -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();
}
}
}
}

View file

@ -141,6 +141,7 @@
<x:String x:Key="Text.Configure.Git" xml:space="preserve">GIT</x:String>
<x:String x:Key="Text.Configure.Git.AutoFetch" xml:space="preserve">Remotes automatisch fetchen</x:String>
<x:String x:Key="Text.Configure.Git.AutoFetchIntervalSuffix" xml:space="preserve">Minute(n)</x:String>
<x:String x:Key="Text.Configure.Git.DefaultRemote" xml:space="preserve">Standard Remote</x:String>
<x:String x:Key="Text.Configure.IssueTracker" xml:space="preserve">TICKETSYSTEM</x:String>
<x:String x:Key="Text.Configure.IssueTracker.AddSampleGithub" xml:space="preserve">Beispiel für Github-Regel hinzufügen</x:String>
<x:String x:Key="Text.Configure.IssueTracker.AddSampleJira" xml:space="preserve">Beispiel für Jira-Regel hinzufügen</x:String>
@ -206,6 +207,7 @@
<x:String x:Key="Text.Diff.Binary.Old" xml:space="preserve">ALT</x:String>
<x:String x:Key="Text.Diff.Copy" xml:space="preserve">Kopieren</x:String>
<x:String x:Key="Text.Diff.FileModeChanged" xml:space="preserve">Dateimodus geändert</x:String>
<x:String x:Key="Text.Diff.IgnoreWhitespace" xml:space="preserve">Ignoriere Leerzeichenänderungen</x:String>
<x:String x:Key="Text.Diff.LFS" xml:space="preserve">LFS OBJEKT ÄNDERUNG</x:String>
<x:String x:Key="Text.Diff.Next" xml:space="preserve">Nächste Änderung</x:String>
<x:String x:Key="Text.Diff.NoChange" xml:space="preserve">KEINE ÄNDERUNG ODER NUR ZEILEN-ENDE ÄNDERUNGEN</x:String>
@ -225,6 +227,7 @@
<x:String x:Key="Text.Discard" xml:space="preserve">Änderungen verwerfen</x:String>
<x:String x:Key="Text.Discard.All" xml:space="preserve">Alle Änderungen in der Arbeitskopie.</x:String>
<x:String x:Key="Text.Discard.Changes" xml:space="preserve">Änderungen:</x:String>
<x:String x:Key="Text.Discard.IncludeIgnored" xml:space="preserve">Ignorierte Dateien inkludieren</x:String>
<x:String x:Key="Text.Discard.Total" xml:space="preserve">Insgesamt {0} Änderungen werden verworfen</x:String>
<x:String x:Key="Text.Discard.Warning" xml:space="preserve">Du kannst das nicht rückgängig machen!!!</x:String>
<x:String x:Key="Text.EditRepositoryNode.Bookmark" xml:space="preserve">Lesezeichen:</x:String>
@ -330,6 +333,7 @@
<x:String x:Key="Text.Hotkeys.Repo" xml:space="preserve">REPOSITORY</x:String>
<x:String x:Key="Text.Hotkeys.Repo.Commit" xml:space="preserve">Gestagte Änderungen committen</x:String>
<x:String x:Key="Text.Hotkeys.Repo.CommitAndPush" xml:space="preserve">Gestagte Änderungen committen und pushen</x:String>
<x:String x:Key="Text.Hotkeys.Repo.CommitWithAutoStage" xml:space="preserve">Alle Änderungen stagen und committen</x:String>
<x:String x:Key="Text.Hotkeys.Repo.DiscardSelected" xml:space="preserve">Ausgewählte Änderungen verwerfen</x:String>
<x:String x:Key="Text.Hotkeys.Repo.GoHome" xml:space="preserve">Dashboard Modus (Standard)</x:String>
<x:String x:Key="Text.Hotkeys.Repo.Refresh" xml:space="preserve">Erzwinge Neuladen des Repositorys</x:String>
@ -355,8 +359,6 @@
<x:String x:Key="Text.InteractiveRebase" xml:space="preserve">Interaktiver Rebase</x:String>
<x:String x:Key="Text.InteractiveRebase.Target" xml:space="preserve">Ziel Branch:</x:String>
<x:String x:Key="Text.InteractiveRebase.On" xml:space="preserve">Auf:</x:String>
<x:String x:Key="Text.InteractiveRebase.MoveUp" xml:space="preserve">Hochschieben</x:String>
<x:String x:Key="Text.InteractiveRebase.MoveDown" xml:space="preserve">Runterschieben</x:String>
<x:String x:Key="Text.Launcher" xml:space="preserve">Source Git</x:String>
<x:String x:Key="Text.Launcher.Error" xml:space="preserve">FEHLER</x:String>
<x:String x:Key="Text.Launcher.Info" xml:space="preserve">INFO</x:String>
@ -499,7 +501,7 @@
<x:String x:Key="Text.Repository.Configure" xml:space="preserve">Repository Einstellungen</x:String>
<x:String x:Key="Text.Repository.Continue" xml:space="preserve">WEITER</x:String>
<x:String x:Key="Text.Repository.Explore" xml:space="preserve">Öffne im Datei-Browser</x:String>
<x:String x:Key="Text.Repository.Filter" xml:space="preserve">Suche Branches &amp; Tags &amp; Submodule</x:String>
<x:String x:Key="Text.Repository.Filter" xml:space="preserve">Suche Branches/Tags/Submodule</x:String>
<x:String x:Key="Text.Repository.FilterCommitPrefix" xml:space="preserve">GEFILTERT:</x:String>
<x:String x:Key="Text.Repository.LocalBranches" xml:space="preserve">LOKALE BRANCHES</x:String>
<x:String x:Key="Text.Repository.NavigateToCurrentHead" xml:space="preserve">Zum HEAD wechseln</x:String>
@ -516,6 +518,7 @@
<x:String x:Key="Text.Repository.Search.ByMessage" xml:space="preserve">Commit-Nachricht</x:String>
<x:String x:Key="Text.Repository.Search.BySHA" xml:space="preserve">SHA</x:String>
<x:String x:Key="Text.Repository.Search.ByUser" xml:space="preserve">Autor &amp; Committer</x:String>
<x:String x:Key="Text.Repository.Search.InCurrentBranch" xml:space="preserve">Aktueller Branch</x:String>
<x:String x:Key="Text.Repository.ShowTagsAsTree" xml:space="preserve">Zeige Tags als Baum</x:String>
<x:String x:Key="Text.Repository.Statistics" xml:space="preserve">Statistiken</x:String>
<x:String x:Key="Text.Repository.Submodules" xml:space="preserve">SUBMODULE</x:String>
@ -623,6 +626,8 @@
<x:String x:Key="Text.WorkingCopy.Commit" xml:space="preserve">COMMIT</x:String>
<x:String x:Key="Text.WorkingCopy.CommitAndPush" xml:space="preserve">COMMIT &amp; PUSH</x:String>
<x:String x:Key="Text.WorkingCopy.CommitMessageHelper" xml:space="preserve">Template/Historie</x:String>
<x:String x:Key="Text.WorkingCopy.CommitTip" xml:space="preserve">Klick-Ereignis auslösen</x:String>
<x:String x:Key="Text.WorkingCopy.CommitWithAutoStage" xml:space="preserve">Alle Änderungen stagen und committen</x:String>
<x:String x:Key="Text.WorkingCopy.Conflicts" xml:space="preserve">KONFLIKTE ERKANNT</x:String>
<x:String x:Key="Text.WorkingCopy.Conflicts.Resolved" xml:space="preserve">DATEI KONFLIKTE GELÖST</x:String>
<x:String x:Key="Text.WorkingCopy.IncludeUntracked" xml:space="preserve">NICHT-VERFOLGTE DATEIEN INKLUDIEREN</x:String>

View file

@ -2,6 +2,7 @@
<x:String x:Key="Text.About" xml:space="preserve">About</x:String>
<x:String x:Key="Text.About.Menu" xml:space="preserve">About SourceGit</x:String>
<x:String x:Key="Text.About.BuildWith" xml:space="preserve">• Build with </x:String>
<x:String x:Key="Text.About.Chart" xml:space="preserve">• Chart is rendered by </x:String>
<x:String x:Key="Text.About.Copyright" xml:space="preserve">© 2024 sourcegit-scm</x:String>
<x:String x:Key="Text.About.Editor" xml:space="preserve">• TextEditor from </x:String>
<x:String x:Key="Text.About.Fonts" xml:space="preserve">• Monospace fonts come from </x:String>
@ -313,6 +314,7 @@
<x:String x:Key="Text.Histories.DisplayMode" xml:space="preserve">Switch Horizontal/Vertical Layout</x:String>
<x:String x:Key="Text.Histories.GraphMode" xml:space="preserve">Switch Curve/Polyline Graph Mode</x:String>
<x:String x:Key="Text.Histories.Header.Author" xml:space="preserve">AUTHOR</x:String>
<x:String x:Key="Text.Histories.Header.AuthorTime" xml:space="preserve">AUTHOR TIME</x:String>
<x:String x:Key="Text.Histories.Header.GraphAndSubject" xml:space="preserve">GRAPH &amp; SUBJECT</x:String>
<x:String x:Key="Text.Histories.Header.SHA" xml:space="preserve">SHA</x:String>
<x:String x:Key="Text.Histories.Header.Time" xml:space="preserve">COMMIT TIME</x:String>
@ -356,8 +358,6 @@
<x:String x:Key="Text.InteractiveRebase" xml:space="preserve">Interactive Rebase</x:String>
<x:String x:Key="Text.InteractiveRebase.Target" xml:space="preserve">Target Branch:</x:String>
<x:String x:Key="Text.InteractiveRebase.On" xml:space="preserve">On:</x:String>
<x:String x:Key="Text.InteractiveRebase.MoveUp" xml:space="preserve">Move Up</x:String>
<x:String x:Key="Text.InteractiveRebase.MoveDown" xml:space="preserve">Move Down</x:String>
<x:String x:Key="Text.Launcher" xml:space="preserve">Source Git</x:String>
<x:String x:Key="Text.Launcher.Error" xml:space="preserve">ERROR</x:String>
<x:String x:Key="Text.Launcher.Info" xml:space="preserve">NOTICE</x:String>
@ -414,6 +414,7 @@
<x:String x:Key="Text.Preference.General.Check4UpdatesOnStartup" xml:space="preserve">Check for updates on startup</x:String>
<x:String x:Key="Text.Preference.General.Locale" xml:space="preserve">Language</x:String>
<x:String x:Key="Text.Preference.General.MaxHistoryCommits" xml:space="preserve">History Commits</x:String>
<x:String x:Key="Text.Preference.General.ShowAuthorTime" xml:space="preserve">Show author time intead of commit time in graph</x:String>
<x:String x:Key="Text.Preference.General.SubjectGuideLength" xml:space="preserve">Subject Guide Length</x:String>
<x:String x:Key="Text.Preference.Git" xml:space="preserve">GIT</x:String>
<x:String x:Key="Text.Preference.Git.CRLF" xml:space="preserve">Enable Auto CRLF</x:String>
@ -500,7 +501,7 @@
<x:String x:Key="Text.Repository.Configure" xml:space="preserve">Configure this repository</x:String>
<x:String x:Key="Text.Repository.Continue" xml:space="preserve">CONTINUE</x:String>
<x:String x:Key="Text.Repository.Explore" xml:space="preserve">Open In File Browser</x:String>
<x:String x:Key="Text.Repository.Filter" xml:space="preserve">Search Branches &amp; Tags &amp; Submodules</x:String>
<x:String x:Key="Text.Repository.Filter" xml:space="preserve">Search Branches/Tags/Submodules</x:String>
<x:String x:Key="Text.Repository.FilterCommitPrefix" xml:space="preserve">FILTERED BY:</x:String>
<x:String x:Key="Text.Repository.LocalBranches" xml:space="preserve">LOCAL BRANCHES</x:String>
<x:String x:Key="Text.Repository.NavigateToCurrentHead" xml:space="preserve">Navigate To HEAD</x:String>
@ -562,6 +563,8 @@
<x:String x:Key="Text.Stash.IncludeUntracked" xml:space="preserve">Include untracked files</x:String>
<x:String x:Key="Text.Stash.Message" xml:space="preserve">Message:</x:String>
<x:String x:Key="Text.Stash.Message.Placeholder" xml:space="preserve">Optional. Name of this stash</x:String>
<x:String x:Key="Text.Stash.OnlyStagedChanges" xml:space="preserve">Only staged changes</x:String>
<x:String x:Key="Text.Stash.TipForSelectedFiles" xml:space="preserve">Both staged and unstaged changes of selected file(s) will be stashed!!!</x:String>
<x:String x:Key="Text.Stash.Title" xml:space="preserve">Stash Local Changes</x:String>
<x:String x:Key="Text.StashCM.Apply" xml:space="preserve">Apply</x:String>
<x:String x:Key="Text.StashCM.Drop" xml:space="preserve">Drop</x:String>

View file

@ -2,7 +2,6 @@
<ResourceDictionary.MergedDictionaries>
<ResourceInclude Source="avares://SourceGit/Resources/Locales/en_US.axaml"/>
</ResourceDictionary.MergedDictionaries>
<x:String x:Key="Text.About" xml:space="preserve">À propos</x:String>
<x:String x:Key="Text.About.BuildWith" xml:space="preserve">• Compilé avec </x:String>
<x:String x:Key="Text.About.Copyright" xml:space="preserve">© 2024 sourcegit-scm</x:String>
@ -346,8 +345,6 @@
<x:String x:Key="Text.InteractiveRebase" xml:space="preserve">Interactive Rebase</x:String>
<x:String x:Key="Text.InteractiveRebase.Target" xml:space="preserve">Target Branch:</x:String>
<x:String x:Key="Text.InteractiveRebase.On" xml:space="preserve">On:</x:String>
<x:String x:Key="Text.InteractiveRebase.MoveUp" xml:space="preserve">Move Up</x:String>
<x:String x:Key="Text.InteractiveRebase.MoveDown" xml:space="preserve">Move Down</x:String>
<x:String x:Key="Text.Launcher" xml:space="preserve">Source Git</x:String>
<x:String x:Key="Text.Launcher.Error" xml:space="preserve">ERROR</x:String>
<x:String x:Key="Text.Launcher.Info" xml:space="preserve">NOTICE</x:String>
@ -479,7 +476,7 @@
<x:String x:Key="Text.Repository.Configure" xml:space="preserve">Configure this repository</x:String>
<x:String x:Key="Text.Repository.Continue" xml:space="preserve">CONTINUE</x:String>
<x:String x:Key="Text.Repository.Explore" xml:space="preserve">Ouvrir dans l'explorateur Windows</x:String>
<x:String x:Key="Text.Repository.Filter" xml:space="preserve">Search Branches &amp; Tags &amp; Submodules</x:String>
<x:String x:Key="Text.Repository.Filter" xml:space="preserve">Search Branches/Tags/Submodules</x:String>
<x:String x:Key="Text.Repository.FilterCommitPrefix" xml:space="preserve">FILTERED BY:</x:String>
<x:String x:Key="Text.Repository.LocalBranches" xml:space="preserve">LOCAL BRANCHES</x:String>
<x:String x:Key="Text.Repository.NavigateToCurrentHead" xml:space="preserve">Navigate To HEAD</x:String>

View file

@ -340,8 +340,6 @@
<x:String x:Key="Text.InteractiveRebase" xml:space="preserve">Rebase Interativo</x:String>
<x:String x:Key="Text.InteractiveRebase.Target" xml:space="preserve">Ramo Alvo:</x:String>
<x:String x:Key="Text.InteractiveRebase.On" xml:space="preserve">Em:</x:String>
<x:String x:Key="Text.InteractiveRebase.MoveUp" xml:space="preserve">Mover Para Cima</x:String>
<x:String x:Key="Text.InteractiveRebase.MoveDown" xml:space="preserve">Mover Para Baixo</x:String>
<x:String x:Key="Text.Launcher" xml:space="preserve">Source Git</x:String>
<x:String x:Key="Text.Launcher.Error" xml:space="preserve">ERRO</x:String>
<x:String x:Key="Text.Launcher.Info" xml:space="preserve">AVISO</x:String>
@ -471,7 +469,7 @@
<x:String x:Key="Text.Repository.Configure" xml:space="preserve">Configurar este repositório</x:String>
<x:String x:Key="Text.Repository.Continue" xml:space="preserve">CONTINUAR</x:String>
<x:String x:Key="Text.Repository.Explore" xml:space="preserve">Abrir no Navegador de Arquivos</x:String>
<x:String x:Key="Text.Repository.Filter" xml:space="preserve">Pesquisar Branches &amp; Tags &amp; Submódulos</x:String>
<x:String x:Key="Text.Repository.Filter" xml:space="preserve">Pesquisar Branches/Tags/Submódulos</x:String>
<x:String x:Key="Text.Repository.FilterCommitPrefix" xml:space="preserve">FILTRADO POR:</x:String>
<x:String x:Key="Text.Repository.LocalBranches" xml:space="preserve">BRANCHES LOCAIS</x:String>
<x:String x:Key="Text.Repository.NavigateToCurrentHead" xml:space="preserve">Navegar para HEAD</x:String>

View file

@ -5,6 +5,7 @@
<x:String x:Key="Text.About" xml:space="preserve">О программе</x:String>
<x:String x:Key="Text.About.Menu" xml:space="preserve">О SourceGit</x:String>
<x:String x:Key="Text.About.BuildWith" xml:space="preserve">• Сборка с </x:String>
<x:String x:Key="Text.About.Chart" xml:space="preserve">• Диаграмма отображается с помощью</x:String>
<x:String x:Key="Text.About.Copyright" xml:space="preserve">© 2024 sourcegit-scm</x:String>
<x:String x:Key="Text.About.Editor" xml:space="preserve">• Текстовый редактор от </x:String>
<x:String x:Key="Text.About.Fonts" xml:space="preserve">• Моноширинные шрифты взяты из </x:String>
@ -316,6 +317,7 @@
<x:String x:Key="Text.Histories.DisplayMode" xml:space="preserve">Переключение горизонтального/вертикального расположения</x:String>
<x:String x:Key="Text.Histories.GraphMode" xml:space="preserve">Переключение режима построения кривой/полилинии</x:String>
<x:String x:Key="Text.Histories.Header.Author" xml:space="preserve">АВТОР</x:String>
<x:String x:Key="Text.Histories.Header.AuthorTime" xml:space="preserve">ВРЕМЯ АВТОРА</x:String>
<x:String x:Key="Text.Histories.Header.GraphAndSubject" xml:space="preserve">ГРАФ И СУБЪЕКТ</x:String>
<x:String x:Key="Text.Histories.Header.SHA" xml:space="preserve">SHA</x:String>
<x:String x:Key="Text.Histories.Header.Time" xml:space="preserve">ВРЕМЯ ФИКСАЦИИ</x:String>
@ -359,8 +361,6 @@
<x:String x:Key="Text.InteractiveRebase" xml:space="preserve">Интерактивное перемещение</x:String>
<x:String x:Key="Text.InteractiveRebase.Target" xml:space="preserve">Целевая ветка:</x:String>
<x:String x:Key="Text.InteractiveRebase.On" xml:space="preserve">На:</x:String>
<x:String x:Key="Text.InteractiveRebase.MoveUp" xml:space="preserve">Вверх</x:String>
<x:String x:Key="Text.InteractiveRebase.MoveDown" xml:space="preserve">Вниз</x:String>
<x:String x:Key="Text.Launcher" xml:space="preserve">Source Git</x:String>
<x:String x:Key="Text.Launcher.Error" xml:space="preserve">ОШИБКА</x:String>
<x:String x:Key="Text.Launcher.Info" xml:space="preserve">УВЕДОМЛЕНИЕ</x:String>
@ -417,6 +417,7 @@
<x:String x:Key="Text.Preference.General.Check4UpdatesOnStartup" xml:space="preserve">Проверить обновления при старте</x:String>
<x:String x:Key="Text.Preference.General.Locale" xml:space="preserve">Язык</x:String>
<x:String x:Key="Text.Preference.General.MaxHistoryCommits" xml:space="preserve">История фиксаций</x:String>
<x:String x:Key="Text.Preference.General.ShowAuthorTime" xml:space="preserve">Показать время автора вместо времени фиксации на графике</x:String>
<x:String x:Key="Text.Preference.General.SubjectGuideLength" xml:space="preserve">Длина темы фиксации</x:String>
<x:String x:Key="Text.Preference.Git" xml:space="preserve">GIT</x:String>
<x:String x:Key="Text.Preference.Git.CRLF" xml:space="preserve">Включить автозавершение CRLF</x:String>
@ -560,6 +561,8 @@
<x:String x:Key="Text.Squash.Into" xml:space="preserve">В:</x:String>
<x:String x:Key="Text.SSHKey" xml:space="preserve">Частный ключ SSH:</x:String>
<x:String x:Key="Text.SSHKey.Placeholder" xml:space="preserve">Путь хранения частного ключа SSH</x:String>
<x:String x:Key="Text.Stash.OnlyStagedChanges" xml:space="preserve">Только подготовленные изменения</x:String>
<x:String x:Key="Text.Stash.TipForSelectedFiles" xml:space="preserve">Подготовленные так и подготовленные изменения выбранных файлов будут сохранены!!!</x:String>
<x:String x:Key="Text.Start" xml:space="preserve">ЗАПУСК</x:String>
<x:String x:Key="Text.Stash" xml:space="preserve">Отложить</x:String>
<x:String x:Key="Text.Stash.IncludeUntracked" xml:space="preserve">Включить неотслеживаемые файлы</x:String>

View file

@ -5,6 +5,7 @@
<x:String x:Key="Text.About" xml:space="preserve">关于软件</x:String>
<x:String x:Key="Text.About.Menu" xml:space="preserve">关于本软件</x:String>
<x:String x:Key="Text.About.BuildWith" xml:space="preserve">• 项目依赖于 </x:String>
<x:String x:Key="Text.About.Chart" xml:space="preserve">• 图表绘制组件来自 </x:String>
<x:String x:Key="Text.About.Copyright" xml:space="preserve">© 2024 sourcegit-scm</x:String>
<x:String x:Key="Text.About.Editor" xml:space="preserve">• 文本编辑器使用 </x:String>
<x:String x:Key="Text.About.Fonts" xml:space="preserve">• 等宽字体来自于 </x:String>
@ -316,6 +317,7 @@
<x:String x:Key="Text.Histories.DisplayMode" xml:space="preserve">切换横向/纵向显示</x:String>
<x:String x:Key="Text.Histories.GraphMode" xml:space="preserve">切换曲线/折线显示</x:String>
<x:String x:Key="Text.Histories.Header.Author" xml:space="preserve">作者</x:String>
<x:String x:Key="Text.Histories.Header.AuthorTime" xml:space="preserve">修改时间</x:String>
<x:String x:Key="Text.Histories.Header.GraphAndSubject" xml:space="preserve">路线图与主题</x:String>
<x:String x:Key="Text.Histories.Header.SHA" xml:space="preserve">提交指纹</x:String>
<x:String x:Key="Text.Histories.Header.Time" xml:space="preserve">提交时间</x:String>
@ -359,8 +361,6 @@
<x:String x:Key="Text.InteractiveRebase" xml:space="preserve">交互式变基</x:String>
<x:String x:Key="Text.InteractiveRebase.Target" xml:space="preserve">目标分支 </x:String>
<x:String x:Key="Text.InteractiveRebase.On" xml:space="preserve">起始提交 </x:String>
<x:String x:Key="Text.InteractiveRebase.MoveUp" xml:space="preserve">向上移动</x:String>
<x:String x:Key="Text.InteractiveRebase.MoveDown" xml:space="preserve">向下移动</x:String>
<x:String x:Key="Text.Launcher" xml:space="preserve">Source Git</x:String>
<x:String x:Key="Text.Launcher.Error" xml:space="preserve">出错了</x:String>
<x:String x:Key="Text.Launcher.Info" xml:space="preserve">系统提示</x:String>
@ -413,6 +413,7 @@
<x:String x:Key="Text.Preference.General.Check4UpdatesOnStartup" xml:space="preserve">启动时检测软件更新</x:String>
<x:String x:Key="Text.Preference.General.Locale" xml:space="preserve">显示语言</x:String>
<x:String x:Key="Text.Preference.General.MaxHistoryCommits" xml:space="preserve">最大历史提交数</x:String>
<x:String x:Key="Text.Preference.General.ShowAuthorTime" xml:space="preserve">在提交路线图中显示修改时间而非提交时间</x:String>
<x:String x:Key="Text.Preference.General.SubjectGuideLength" xml:space="preserve">SUBJECT字数检测</x:String>
<x:String x:Key="Text.Preference.Git" xml:space="preserve">GIT配置</x:String>
<x:String x:Key="Text.Preference.Git.CRLF" xml:space="preserve">自动换行转换</x:String>
@ -498,7 +499,7 @@
<x:String x:Key="Text.Repository.Configure" xml:space="preserve">配置本仓库</x:String>
<x:String x:Key="Text.Repository.Continue" xml:space="preserve">下一步</x:String>
<x:String x:Key="Text.Repository.Explore" xml:space="preserve">在文件浏览器中打开</x:String>
<x:String x:Key="Text.Repository.Filter" xml:space="preserve">快速查找分支、标签、子模块</x:String>
<x:String x:Key="Text.Repository.Filter" xml:space="preserve">快速查找分支/标签/子模块</x:String>
<x:String x:Key="Text.Repository.FilterCommitPrefix" xml:space="preserve">过滤规则 </x:String>
<x:String x:Key="Text.Repository.LocalBranches" xml:space="preserve">本地分支</x:String>
<x:String x:Key="Text.Repository.NavigateToCurrentHead" xml:space="preserve">定位HEAD</x:String>
@ -560,6 +561,8 @@
<x:String x:Key="Text.Stash.IncludeUntracked" xml:space="preserve">包含未跟踪的文件</x:String>
<x:String x:Key="Text.Stash.Message" xml:space="preserve">信息 </x:String>
<x:String x:Key="Text.Stash.Message.Placeholder" xml:space="preserve">选填,用于命名此贮藏</x:String>
<x:String x:Key="Text.Stash.OnlyStagedChanges" xml:space="preserve">仅贮藏暂存区的变更</x:String>
<x:String x:Key="Text.Stash.TipForSelectedFiles" xml:space="preserve">选中文件的所有变更均会被贮藏!</x:String>
<x:String x:Key="Text.Stash.Title" xml:space="preserve">贮藏本地变更</x:String>
<x:String x:Key="Text.StashCM.Apply" xml:space="preserve">应用(apply)</x:String>
<x:String x:Key="Text.StashCM.Drop" xml:space="preserve">删除(drop)</x:String>

View file

@ -5,6 +5,7 @@
<x:String x:Key="Text.About" xml:space="preserve">關於</x:String>
<x:String x:Key="Text.About.Menu" xml:space="preserve">關於 SourceGit</x:String>
<x:String x:Key="Text.About.BuildWith" xml:space="preserve">• 專案依賴於 </x:String>
<x:String x:Key="Text.About.Chart" xml:space="preserve">• 圖表繪製元件來自 </x:String>
<x:String x:Key="Text.About.Copyright" xml:space="preserve">© 2024 sourcegit-scm</x:String>
<x:String x:Key="Text.About.Editor" xml:space="preserve">• 文字編輯器使用 </x:String>
<x:String x:Key="Text.About.Fonts" xml:space="preserve">• 等寬字型來自於 </x:String>
@ -316,6 +317,7 @@
<x:String x:Key="Text.Histories.DisplayMode" xml:space="preserve">切換橫向/縱向顯示</x:String>
<x:String x:Key="Text.Histories.GraphMode" xml:space="preserve">切換曲線/折線顯示</x:String>
<x:String x:Key="Text.Histories.Header.Author" xml:space="preserve">作者</x:String>
<x:String x:Key="Text.Histories.Header.AuthorTime" xml:space="preserve">修改時間</x:String>
<x:String x:Key="Text.Histories.Header.GraphAndSubject" xml:space="preserve">路線圖與訊息標題</x:String>
<x:String x:Key="Text.Histories.Header.SHA" xml:space="preserve">提交編號</x:String>
<x:String x:Key="Text.Histories.Header.Time" xml:space="preserve">提交時間</x:String>
@ -359,8 +361,6 @@
<x:String x:Key="Text.InteractiveRebase" xml:space="preserve">互動式重定基底</x:String>
<x:String x:Key="Text.InteractiveRebase.Target" xml:space="preserve">目標分支:</x:String>
<x:String x:Key="Text.InteractiveRebase.On" xml:space="preserve">起始提交:</x:String>
<x:String x:Key="Text.InteractiveRebase.MoveUp" xml:space="preserve">向上移動</x:String>
<x:String x:Key="Text.InteractiveRebase.MoveDown" xml:space="preserve">向下移動</x:String>
<x:String x:Key="Text.Launcher" xml:space="preserve">Source Git</x:String>
<x:String x:Key="Text.Launcher.Error" xml:space="preserve">發生錯誤</x:String>
<x:String x:Key="Text.Launcher.Info" xml:space="preserve">系統提示</x:String>
@ -417,6 +417,7 @@
<x:String x:Key="Text.Preference.General.Check4UpdatesOnStartup" xml:space="preserve">啟動時檢查軟體更新</x:String>
<x:String x:Key="Text.Preference.General.Locale" xml:space="preserve">顯示語言</x:String>
<x:String x:Key="Text.Preference.General.MaxHistoryCommits" xml:space="preserve">最大歷史提交數</x:String>
<x:String x:Key="Text.Preference.General.ShowAuthorTime" xml:space="preserve">在提交路線圖中顯示修改時間而非提交時間</x:String>
<x:String x:Key="Text.Preference.General.SubjectGuideLength" xml:space="preserve">提交標題字數偵測</x:String>
<x:String x:Key="Text.Preference.Git" xml:space="preserve">Git 設定</x:String>
<x:String x:Key="Text.Preference.Git.CRLF" xml:space="preserve">自動換行轉換</x:String>
@ -503,7 +504,7 @@
<x:String x:Key="Text.Repository.Configure" xml:space="preserve">設定本存放庫</x:String>
<x:String x:Key="Text.Repository.Continue" xml:space="preserve">下一步</x:String>
<x:String x:Key="Text.Repository.Explore" xml:space="preserve">在檔案瀏覽器中開啟</x:String>
<x:String x:Key="Text.Repository.Filter" xml:space="preserve">快速搜尋分支、標籤、子模組</x:String>
<x:String x:Key="Text.Repository.Filter" xml:space="preserve">快速搜尋分支/標籤/子模組</x:String>
<x:String x:Key="Text.Repository.FilterCommitPrefix" xml:space="preserve">篩選規則:</x:String>
<x:String x:Key="Text.Repository.LocalBranches" xml:space="preserve">本機分支</x:String>
<x:String x:Key="Text.Repository.NavigateToCurrentHead" xml:space="preserve">回到 HEAD</x:String>
@ -565,6 +566,8 @@
<x:String x:Key="Text.Stash.IncludeUntracked" xml:space="preserve">包含未追蹤的檔案</x:String>
<x:String x:Key="Text.Stash.Message" xml:space="preserve">擱置變更訊息:</x:String>
<x:String x:Key="Text.Stash.Message.Placeholder" xml:space="preserve">選填,用於命名此擱置變更</x:String>
<x:String x:Key="Text.Stash.OnlyStagedChanges" xml:space="preserve">僅擱置已暫存的變更</x:String>
<x:String x:Key="Text.Stash.TipForSelectedFiles" xml:space="preserve">選中檔案的所有變更均會被擱置!</x:String>
<x:String x:Key="Text.Stash.Title" xml:space="preserve">擱置本機變更</x:String>
<x:String x:Key="Text.StashCM.Apply" xml:space="preserve">套用 (apply)</x:String>
<x:String x:Key="Text.StashCM.Drop" xml:space="preserve">刪除 (drop)</x:String>

View file

@ -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 };
}

View file

@ -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);

View file

@ -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;

View file

@ -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;
}
}

View file

@ -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;

View file

@ -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;

View file

@ -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();
}
}
}

View file

@ -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 };
}

View file

@ -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<Models.Change> changes, bool onlyStaged, bool canIgnoreUntracked)
public bool OnlyStaged
{
get;
set;
}
public StashChanges(Repository repo, List<Models.Change> 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<bool> Sure()
{
var jobs = _changes;
if (CanIgnoreUntracked && !IncludeUntracked)
if (!HasSelectedFiles && !IncludeUntracked)
{
jobs = new List<Models.Change>();
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<Models.Change> _changes = null;
private readonly bool _onlyStaged = false;
}
}

View file

@ -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;
};

View file

@ -49,7 +49,7 @@
HorizontalAlignment="Center"
VerticalAlignment="Center"/>
<StackPanel Grid.Column="1" Orientation="Vertical" Margin="0,8,32,8">
<StackPanel Grid.Column="1" Orientation="Vertical" Margin="0,8,32,16">
<StackPanel Height="48" Orientation="Horizontal">
<TextBlock Classes="bold" Text="SourceGit" FontSize="32" />
<Border Margin="12,0,0,0" Height="20" CornerRadius="10" Background="{DynamicResource Brush.Accent}" Effect="drop-shadow(0 0 6 #40000000)">
@ -74,6 +74,11 @@
<TextBlock Text="JetBrains Mono" Cursor="Hand" Foreground="{DynamicResource Brush.Accent}" TextDecorations="Underline" PointerPressed="OnVisitJetBrainsMonoFont"/>
</StackPanel>
<StackPanel Orientation="Horizontal" Height="18" Margin="0,2,0,0">
<TextBlock Text="{DynamicResource Text.About.Chart}" />
<TextBlock Text="LiveCharts2" Cursor="Hand" Foreground="{DynamicResource Brush.Accent}" TextDecorations="Underline" PointerPressed="OnVisitLiveCharts2"/>
</StackPanel>
<StackPanel Orientation="Horizontal" Height="18" Margin="0,2,0,0">
<TextBlock Text="{DynamicResource Text.About.SourceCode}" />
<TextBlock Text="Github" Cursor="Hand" Foreground="{DynamicResource Brush.Accent}" TextDecorations="Underline" PointerPressed="OnVisitSourceCode"/>

View file

@ -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");

View file

@ -43,7 +43,8 @@
Fill="DarkOrange"/>
<TextBlock Grid.Column="1" Margin="8,0,0,0"
Text="{DynamicResource Text.Checkout.Commit.Warning}"
TextWrapping="Wrap"/>
TextWrapping="Wrap"
Foreground="DarkOrange"/>
</Grid>
</Grid>
</StackPanel>

View file

@ -18,7 +18,7 @@
Fill="DarkOrange"/>
<TextBlock Margin="4,0,0,0"
Text="{DynamicResource Text.Discard.Warning}"
Foreground="{DynamicResource Brush.FG2}"/>
Foreground="DarkOrange"/>
</StackPanel>
<ContentControl Margin="0,16,0,8" Content="{Binding Mode}">

View file

@ -51,7 +51,14 @@
<ToggleButton Classes="time_display_mode"
Width="10" Height="10"
IsChecked="{Binding Source={x:Static vm:Preference.Instance}, Path=DisplayTimeAsPeriodInHistories, Mode=TwoWay}"/>
<TextBlock Classes="table_header" Margin="6,0,0,0" Text="{DynamicResource Text.Histories.Header.Time}"/>
<TextBlock Classes="table_header"
Margin="6,0,0,0"
Text="{DynamicResource Text.Histories.Header.Time}"
IsVisible="{Binding Source={x:Static vm:Preference.Instance}, Path=ShowAuthorTimeInGraph, Converter={x:Static BoolConverters.Not}, Mode=OneWay}"/>
<TextBlock Classes="table_header"
Margin="6,0,0,0"
Text="{DynamicResource Text.Histories.Header.AuthorTime}"
IsVisible="{Binding Source={x:Static vm:Preference.Instance}, Path=ShowAuthorTimeInGraph, Mode=OneWay}"/>
</StackPanel>
</Grid>
</Border>
@ -180,13 +187,13 @@
Opacity="{Binding Opacity}"/>
</Border>
<!-- COMMIT TIME -->
<!-- TIME -->
<Border Grid.Column="3" Padding="4,0" ClipToBounds="True" IsHitTestVisible="False">
<v:CommitTimeTextBlock Classes="primary"
HorizontalAlignment="Center"
FontWeight="{Binding FontWeight}"
Opacity="{Binding Opacity}"
Timestamp="{Binding CommitterTime}"
UseAuthorTime="{Binding Source={x:Static vm:Preference.Instance}, Path=ShowAuthorTimeInGraph, Mode=OneWay}"
ShowAsDateTime="{Binding Source={x:Static vm:Preference.Instance}, Path=!DisplayTimeAsPeriodInHistories}"/>
</Border>
</Grid>

View file

@ -303,13 +303,13 @@ namespace SourceGit.Views
set => SetValue(ShowAsDateTimeProperty, value);
}
public static readonly StyledProperty<ulong> TimestampProperty =
AvaloniaProperty.Register<CommitTimeTextBlock, ulong>(nameof(Timestamp));
public static readonly StyledProperty<bool> UseAuthorTimeProperty =
AvaloniaProperty.Register<CommitTimeTextBlock, bool>(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);
}

View file

@ -59,14 +59,14 @@
<!-- Body -->
<Border Grid.Row="2" Margin="8,0,8,8" BorderThickness="1" BorderBrush="{DynamicResource Brush.Border2}">
<Grid RowDefinitions="*,3,*">
<ListBox Grid.Row="0"
Background="{DynamicResource Brush.Contents}"
ItemsSource="{Binding Items}"
SelectionMode="Single"
SelectedItem="{Binding SelectedItem, Mode=OneWayToSource}"
ScrollViewer.HorizontalScrollBarVisibility="Disabled"
ScrollViewer.VerticalScrollBarVisibility="Auto"
KeyDown="OnItemsListBoxKeyDown">
<v:InteractiveRebaseListBox Grid.Row="0"
Focusable="True"
Background="{DynamicResource Brush.Contents}"
ItemsSource="{Binding Items}"
SelectionMode="Single"
SelectedItem="{Binding SelectedItem, Mode=OneWayToSource}"
ScrollViewer.HorizontalScrollBarVisibility="Disabled"
ScrollViewer.VerticalScrollBarVisibility="Auto">
<ListBox.Styles>
<Style Selector="ListBoxItem">
<Setter Property="Margin" Value="0"/>
@ -213,18 +213,18 @@
<TextBlock Grid.Column="6" Classes="primary" Text="{Binding Commit.CommitterTimeStr}" Margin="8,0"/>
<!-- MoveUp Button -->
<Button Grid.Column="7" Classes="icon_button" Click="OnMoveItemUp" ToolTip.Tip="{DynamicResource Text.InteractiveRebase.MoveUp}">
<Button Grid.Column="7" Classes="icon_button" Click="OnMoveItemUp" ToolTip.Tip="Alt+Up">
<Path Width="14" Height="14" Margin="0,4,0,0" Data="{StaticResource Icons.Up}"/>
</Button>
<!-- MoveDown Button -->
<Button Grid.Column="8" Classes="icon_button" Click="OnMoveItemDown" ToolTip.Tip="{DynamicResource Text.InteractiveRebase.MoveDown}">
<Button Grid.Column="8" Classes="icon_button" Click="OnMoveItemDown" ToolTip.Tip="Alt+Down">
<Path Width="14" Height="14" Margin="0,4,0,0" Data="{StaticResource Icons.Down}"/>
</Button>
</Grid>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</v:InteractiveRebaseListBox>
<v:LoadingIcon Grid.Row="0" Width="48" Height="48" HorizontalAlignment="Center" VerticalAlignment="Center" IsVisible="{Binding IsLoading}"/>

View file

@ -1,9 +1,79 @@
using System;
using Avalonia.Controls;
using Avalonia.Input;
using Avalonia.Interactivity;
namespace SourceGit.Views
{
public class InteractiveRebaseListBox : ListBox
{
protected override Type StyleKeyOverride => typeof(ListBox);
/// <summary>
/// Prevent ListBox handle the arrow keys.
/// </summary>
/// <param name="e"></param>
protected override void OnKeyDown(KeyEventArgs e)
{
var vm = DataContext as ViewModels.InteractiveRebase;
if (vm == null)
return;
var item = vm.SelectedItem;
if (item == null)
{
base.OnKeyDown(e);
return;
}
if (e.Key == Key.P)
{
item.SetAction(Models.InteractiveRebaseAction.Pick);
e.Handled = true;
}
else if (e.Key == Key.E)
{
item.SetAction(Models.InteractiveRebaseAction.Edit);
e.Handled = true;
}
else if (e.Key == Key.R)
{
item.SetAction(Models.InteractiveRebaseAction.Reword);
e.Handled = true;
}
else if (e.Key == Key.S)
{
item.SetAction(Models.InteractiveRebaseAction.Squash);
e.Handled = true;
}
else if (e.Key == Key.F)
{
item.SetAction(Models.InteractiveRebaseAction.Fixup);
e.Handled = true;
}
else if (e.Key == Key.D)
{
item.SetAction(Models.InteractiveRebaseAction.Drop);
e.Handled = true;
}
else if (e.KeyModifiers == KeyModifiers.Alt && e.Key == Key.Up)
{
vm.MoveItemUp(item);
e.Handled = true;
}
else if (e.KeyModifiers == KeyModifiers.Alt && e.Key == Key.Down)
{
vm.MoveItemDown(item);
e.Handled = true;
}
else
{
base.OnKeyDown(e);
}
}
}
public partial class InteractiveRebase : ChromelessWindow
{
public InteractiveRebase()
@ -89,26 +159,6 @@ namespace SourceGit.Views
}
}
private void OnItemsListBoxKeyDown(object sender, KeyEventArgs e)
{
var item = (sender as ListBox)?.SelectedItem as ViewModels.InteractiveRebaseItem;
if (item == null)
return;
if (e.Key == Key.P)
item.SetAction(Models.InteractiveRebaseAction.Pick);
else if (e.Key == Key.E)
item.SetAction(Models.InteractiveRebaseAction.Edit);
else if (e.Key == Key.R)
item.SetAction(Models.InteractiveRebaseAction.Reword);
else if (e.Key == Key.S)
item.SetAction(Models.InteractiveRebaseAction.Squash);
else if (e.Key == Key.F)
item.SetAction(Models.InteractiveRebaseAction.Fixup);
else if (e.Key == Key.D)
item.SetAction(Models.InteractiveRebaseAction.Drop);
}
private async void StartJobs(object _1, RoutedEventArgs _2)
{
var vm = DataContext as ViewModels.InteractiveRebase;

View file

@ -52,7 +52,7 @@
<TabItem.Header>
<TextBlock Classes="tab_header" Text="{DynamicResource Text.Preference.General}"/>
</TabItem.Header>
<Grid Margin="8" RowDefinitions="32,32,32,32,32" ColumnDefinitions="Auto,*">
<Grid Margin="8" RowDefinitions="32,32,32,32,32,32" ColumnDefinitions="Auto,*">
<TextBlock Grid.Row="0" Grid.Column="0"
Text="{DynamicResource Text.Preference.General.Locale}"
HorizontalAlignment="Right"
@ -113,6 +113,11 @@
</Grid>
<CheckBox Grid.Row="4" Grid.Column="1"
Height="32"
Content="{DynamicResource Text.Preference.General.ShowAuthorTime}"
IsChecked="{Binding Source={x:Static vm:Preference.Instance}, Path=ShowAuthorTimeInGraph, Mode=TwoWay}"/>
<CheckBox Grid.Row="5" Grid.Column="1"
Height="32"
Content="{DynamicResource Text.Preference.General.Check4UpdatesOnStartup}"
IsChecked="{Binding Source={x:Static vm:Preference.Instance}, Path=Check4UpdatesOnStartup, Mode=TwoWay}"/>

View file

@ -137,7 +137,22 @@ namespace SourceGit.Views
SetIfChanged(config, "gpg.format", GPGFormat.Value, "openpgp");
if (!GPGFormat.Value.Equals("ssh", StringComparison.Ordinal))
SetIfChanged(config, $"gpg.{GPGFormat.Value}.program", GPGExecutableFile, "");
{
var oldGPG = string.Empty;
if (GPGFormat.Value == "openpgp" && config.TryGetValue("gpg.program", out var openpgp))
oldGPG = openpgp;
else if (config.TryGetValue($"gpg.{GPGFormat.Value}.program", out var gpgProgram))
oldGPG = gpgProgram;
bool changed = false;
if (!string.IsNullOrEmpty(oldGPG))
changed = oldGPG != GPGExecutableFile;
else if (!string.IsNullOrEmpty(GPGExecutableFile))
changed = true;
if (changed)
new Commands.Config(null).Set($"gpg.{GPGFormat.Value}.program", GPGExecutableFile);
}
base.OnClosing(e);
}

View file

@ -129,12 +129,6 @@
Watermark="{DynamicResource Text.Repository.Filter}"
Text="{Binding Filter, Mode=TwoWay}"
VerticalContentAlignment="Center">
<TextBox.Styles>
<Style Selector="TextBox /template/ TextBlock#PART_Watermark">
<Setter Property="FontSize" Value="12"/>
</Style>
</TextBox.Styles>
<TextBox.InnerLeftContent>
<Path Width="14" Height="14"
Margin="6,0,0,0"
@ -466,12 +460,6 @@
<Setter Property="Padding" Value="0"/>
<Setter Property="Height" Value="50"/>
</Style>
<Style Selector="ListBoxItem:selected /template/ ContentPresenter#PART_ContentPresenter">
<Setter Property="Background" Value="Transparent" />
</Style>
<Style Selector="ListBoxItem:pointerover /template/ ContentPresenter#PART_ContentPresenter">
<Setter Property="Background" Value="{DynamicResource Brush.AccentHovered}" />
</Style>
</ListBox.Styles>
<ListBox.ItemsPanel>

View file

@ -11,7 +11,7 @@
<TextBlock FontSize="18"
Classes="bold"
Text="{DynamicResource Text.Stash.Title}"/>
<Grid Margin="8,16,0,0" RowDefinitions="32,Auto" ColumnDefinitions="120,*">
<Grid Margin="8,16,0,0" RowDefinitions="32,Auto,Auto" ColumnDefinitions="120,*">
<TextBlock Grid.Row="0" Grid.Column="0"
HorizontalAlignment="Right"
Margin="8,0"
@ -23,11 +23,24 @@
Watermark="{DynamicResource Text.Stash.Message.Placeholder}"
v:AutoFocusBehaviour.IsEnabled="True"/>
<TextBlock Grid.Row="1" Grid.Column="1"
Margin="0,4,0,0"
Text="{DynamicResource Text.Stash.TipForSelectedFiles}"
TextWrapping="Wrap"
Foreground="{DynamicResource Brush.FG2}"
IsVisible="{Binding HasSelectedFiles}"/>
<CheckBox Grid.Row="1" Grid.Column="1"
Height="32"
Content="{DynamicResource Text.Stash.IncludeUntracked}"
IsChecked="{Binding IncludeUntracked, Mode=TwoWay}"
IsVisible="{Binding CanIgnoreUntracked}"/>
IsVisible="{Binding !HasSelectedFiles}"/>
<CheckBox Grid.Row="2" Grid.Column="1"
Height="32"
Content="{DynamicResource Text.Stash.OnlyStagedChanges}"
IsChecked="{Binding OnlyStaged, Mode=TwoWay}"
IsVisible="{Binding !HasSelectedFiles}"/>
</Grid>
</StackPanel>
</UserControl>

View file

@ -74,7 +74,7 @@
</ContentControl.DataTemplates>
</ContentControl>
<StackPanel x:Name="Popup" IsVisible="False" Orientation="Horizontal" VerticalAlignment="Top" HorizontalAlignment="Right" Effect="drop-shadow(0 0 6 #40000000)">
<StackPanel x:Name="Popup" IsVisible="False" Orientation="Horizontal" VerticalAlignment="Top" HorizontalAlignment="Right" Effect="drop-shadow(0 0 8 #80000000)">
<Button Classes="flat" Content="{DynamicResource Text.Hunk.Stage}" Click="OnStageChunk" IsVisible="{Binding #ThisControl.IsUnstagedChange}"/>
<Button Classes="flat" Content="{DynamicResource Text.Hunk.Unstage}" Click="OnUnstageChunk" IsVisible="{Binding #ThisControl.IsUnstagedChange, Converter={x:Static BoolConverters.Not}}"/>
<Button Classes="flat" Content="{DynamicResource Text.Hunk.Discard}" Margin="8,0,0,0" Click="OnDiscardChunk" IsVisible="{Binding #ThisControl.IsUnstagedChange}"/>