mirror of
https://github.com/sourcegit-scm/sourcegit.git
synced 2024-12-27 21:27:19 -08:00
Compare commits
No commits in common. "6908216de554de2b762136bdc47bbc50fef77691" and "95a63eb98d1c42846ab82ef2a08df7df1fb0fe72" have entirely different histories.
6908216de5
...
95a63eb98d
21 changed files with 156 additions and 250 deletions
|
@ -81,6 +81,7 @@ For **macOS** users:
|
||||||
* Make sure your mac trusts all software from anywhere. For more information, search `spctl --master-disable`.
|
* 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.
|
* 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 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:
|
For **Linux** users:
|
||||||
|
|
||||||
|
|
2
VERSION
2
VERSION
|
@ -1 +1 @@
|
||||||
8.34
|
8.33
|
|
@ -2,19 +2,12 @@
|
||||||
{
|
{
|
||||||
public class CherryPick : Command
|
public class CherryPick : Command
|
||||||
{
|
{
|
||||||
public CherryPick(string repo, string commits, bool noCommit, bool appendSourceToMessage, string extraParams)
|
public CherryPick(string repo, string commits, bool noCommit)
|
||||||
{
|
{
|
||||||
|
var mode = noCommit ? "-n" : "--ff";
|
||||||
WorkingDirectory = repo;
|
WorkingDirectory = repo;
|
||||||
Context = repo;
|
Context = repo;
|
||||||
|
Args = $"cherry-pick {mode} {commits}";
|
||||||
Args = "cherry-pick ";
|
|
||||||
if (noCommit)
|
|
||||||
Args += "-n ";
|
|
||||||
if (appendSourceToMessage)
|
|
||||||
Args += "-x ";
|
|
||||||
if (!string.IsNullOrEmpty(extraParams))
|
|
||||||
Args += $"{extraParams} ";
|
|
||||||
Args += commits;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -195,6 +195,15 @@ namespace SourceGit.Commands
|
||||||
if (OperatingSystem.IsLinux())
|
if (OperatingSystem.IsLinux())
|
||||||
start.Environment.Add("LANG", "en_US.UTF-8");
|
start.Environment.Add("LANG", "en_US.UTF-8");
|
||||||
|
|
||||||
|
// Fix sometimes `LSEnvironment` not working on macOS
|
||||||
|
if (OperatingSystem.IsMacOS())
|
||||||
|
{
|
||||||
|
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.
|
// Force using this app as git editor.
|
||||||
switch (Editor)
|
switch (Editor)
|
||||||
{
|
{
|
||||||
|
|
|
@ -31,19 +31,18 @@ namespace SourceGit.Models
|
||||||
public List<Decorator> Decorators { get; set; } = new List<Decorator>();
|
public List<Decorator> Decorators { get; set; } = new List<Decorator>();
|
||||||
public bool HasDecorators => Decorators.Count > 0;
|
public bool HasDecorators => Decorators.Count > 0;
|
||||||
|
|
||||||
|
public bool IsMerged { get; set; } = false;
|
||||||
|
public Thickness Margin { get; set; } = new Thickness(0);
|
||||||
|
|
||||||
public string AuthorTimeStr => DateTime.UnixEpoch.AddSeconds(AuthorTime).ToLocalTime().ToString("yyyy/MM/dd HH:mm:ss");
|
public string AuthorTimeStr => DateTime.UnixEpoch.AddSeconds(AuthorTime).ToLocalTime().ToString("yyyy/MM/dd HH:mm:ss");
|
||||||
public string CommitterTimeStr => DateTime.UnixEpoch.AddSeconds(CommitterTime).ToLocalTime().ToString("yyyy/MM/dd HH:mm:ss");
|
public string CommitterTimeStr => DateTime.UnixEpoch.AddSeconds(CommitterTime).ToLocalTime().ToString("yyyy/MM/dd HH:mm:ss");
|
||||||
public string AuthorTimeShortStr => DateTime.UnixEpoch.AddSeconds(AuthorTime).ToLocalTime().ToString("yyyy/MM/dd");
|
public string AuthorTimeShortStr => DateTime.UnixEpoch.AddSeconds(AuthorTime).ToLocalTime().ToString("yyyy/MM/dd");
|
||||||
|
|
||||||
public bool IsMerged { get; set; } = false;
|
|
||||||
public bool IsCommitterVisible => !Author.Equals(Committer) || AuthorTime != CommitterTime;
|
public bool IsCommitterVisible => !Author.Equals(Committer) || AuthorTime != CommitterTime;
|
||||||
public bool IsCurrentHead => Decorators.Find(x => x.Type is DecoratorType.CurrentBranchHead or DecoratorType.CurrentCommitHead) != null;
|
public bool IsCurrentHead => Decorators.Find(x => x.Type is DecoratorType.CurrentBranchHead or DecoratorType.CurrentCommitHead) != null;
|
||||||
|
|
||||||
public int Color { get; set; } = 0;
|
|
||||||
public double Opacity => IsMerged ? 1 : OpacityForNotMerged;
|
public double Opacity => IsMerged ? 1 : OpacityForNotMerged;
|
||||||
public FontWeight FontWeight => IsCurrentHead ? FontWeight.Bold : FontWeight.Regular;
|
public FontWeight FontWeight => IsCurrentHead ? FontWeight.Bold : FontWeight.Regular;
|
||||||
public Thickness Margin { get; set; } = new Thickness(0);
|
|
||||||
public IBrush Brush => CommitGraph.Pens[Color].Brush;
|
|
||||||
|
|
||||||
public void ParseDecorators(string data)
|
public void ParseDecorators(string data)
|
||||||
{
|
{
|
||||||
|
|
|
@ -186,7 +186,6 @@ namespace SourceGit.Models
|
||||||
// Margins & merge state (used by Views.Histories).
|
// Margins & merge state (used by Views.Histories).
|
||||||
commit.IsMerged = isMerged;
|
commit.IsMerged = isMerged;
|
||||||
commit.Margin = new Thickness(Math.Max(offsetX, maxOffsetOld) + halfWidth + 2, 0, 0, 0);
|
commit.Margin = new Thickness(Math.Max(offsetX, maxOffsetOld) + halfWidth + 2, 0, 0, 0);
|
||||||
commit.Color = dotColor;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Deal with curves haven't ended yet.
|
// Deal with curves haven't ended yet.
|
||||||
|
|
|
@ -55,7 +55,7 @@ namespace SourceGit.Models
|
||||||
{
|
{
|
||||||
var count = Math.Min(int.Parse(countStr.Substring(1)), changes.Count);
|
var count = Math.Min(int.Parse(countStr.Substring(1)), changes.Count);
|
||||||
for (int j = 0; j < count; j++)
|
for (int j = 0; j < count; j++)
|
||||||
paths.Add(changes[j].Path);
|
paths.Add(changes[i].Path);
|
||||||
|
|
||||||
if (count < changes.Count)
|
if (count < changes.Count)
|
||||||
more = $" and {changes.Count - count} other files";
|
more = $" and {changes.Count - count} other files";
|
||||||
|
|
|
@ -3,7 +3,6 @@ using System.Collections.Generic;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Runtime.Versioning;
|
using System.Runtime.Versioning;
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
using Avalonia;
|
using Avalonia;
|
||||||
|
|
||||||
|
@ -18,31 +17,6 @@ namespace SourceGit.Native
|
||||||
{
|
{
|
||||||
DisableDefaultApplicationMenuItems = true,
|
DisableDefaultApplicationMenuItems = true,
|
||||||
});
|
});
|
||||||
|
|
||||||
{
|
|
||||||
var startInfo = new ProcessStartInfo();
|
|
||||||
startInfo.FileName = "zsh";
|
|
||||||
startInfo.Arguments = "--login -c \"echo $PATH\"";
|
|
||||||
startInfo.UseShellExecute = false;
|
|
||||||
startInfo.CreateNoWindow = true;
|
|
||||||
startInfo.RedirectStandardOutput = true;
|
|
||||||
startInfo.StandardOutputEncoding = Encoding.UTF8;
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var proc = new Process() { StartInfo = startInfo };
|
|
||||||
proc.Start();
|
|
||||||
var pathData = proc.StandardOutput.ReadToEnd();
|
|
||||||
proc.WaitForExit();
|
|
||||||
if (proc.ExitCode == 0)
|
|
||||||
Environment.SetEnvironmentVariable("PATH", pathData);
|
|
||||||
proc.Close();
|
|
||||||
}
|
|
||||||
catch
|
|
||||||
{
|
|
||||||
// Ignore error.
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public string FindGitExecutable()
|
public string FindGitExecutable()
|
||||||
|
|
|
@ -50,7 +50,6 @@
|
||||||
<StreamGeometry x:Key="Icons.GitFlow.Release">M884 159l-18-18a43 43 0 00-38-12l-235 43a166 166 0 00-101 60L400 349a128 128 0 00-148 47l-120 171a21 21 0 005 29l17 12a128 128 0 00178-32l27-38 124 124-38 27a128 128 0 00-32 178l12 17a21 21 0 0029 5l171-120a128 128 0 0047-148l117-92A166 166 0 00853 431l43-235a43 43 0 00-12-38zm-177 249a64 64 0 110-90 64 64 0 010 90zm-373 312a21 21 0 010 30l-139 139a21 21 0 01-30 0l-30-30a21 21 0 010-30l139-139a21 21 0 0130 0z</StreamGeometry>
|
<StreamGeometry x:Key="Icons.GitFlow.Release">M884 159l-18-18a43 43 0 00-38-12l-235 43a166 166 0 00-101 60L400 349a128 128 0 00-148 47l-120 171a21 21 0 005 29l17 12a128 128 0 00178-32l27-38 124 124-38 27a128 128 0 00-32 178l12 17a21 21 0 0029 5l171-120a128 128 0 0047-148l117-92A166 166 0 00853 431l43-235a43 43 0 00-12-38zm-177 249a64 64 0 110-90 64 64 0 010 90zm-373 312a21 21 0 010 30l-139 139a21 21 0 01-30 0l-30-30a21 21 0 010-30l139-139a21 21 0 0130 0z</StreamGeometry>
|
||||||
<StreamGeometry x:Key="Icons.GitIgnore">M590 74 859 342V876c0 38-31 68-68 68H233c-38 0-68-31-68-68V142c0-38 31-68 68-68h357zm-12 28H233a40 40 0 00-40 38L193 142v734a40 40 0 0038 40L233 916h558a40 40 0 0040-38L831 876V354L578 102zM855 371h-215c-46 0-83-36-84-82l0-2V74h28v213c0 30 24 54 54 55l2 0h215v28zM57 489m28 0 853 0q28 0 28 28l0 284q0 28-28 28l-853 0q-28 0-28-28l0-284q0-28 28-28ZM157 717c15 0 29-6 37-13v-51h-41v22h17v18c-2 2-6 3-10 3-21 0-30-13-30-34 0-21 12-34 28-34 9 0 15 4 20 9l14-17C184 610 172 603 156 603c-29 0-54 21-54 57 0 37 24 56 54 56zM245 711v-108h-34v108h34zm69 0v-86H341V603H262v22h28V711h24zM393 711v-108h-34v108h34zm66 6c15 0 29-6 37-13v-51h-41v22h17v18c-2 2-6 3-10 3-21 0-30-13-30-34 0-21 12-34 28-34 9 0 15 4 20 9l14-17C485 610 474 603 458 603c-29 0-54 21-54 57 0 37 24 56 54 56zm88-6v-36c0-13-2-28-3-40h1l10 24 25 52H603v-108h-23v36c0 13 2 28 3 40h-1l-10-24L548 603H523v108h23zM677 717c30 0 51-22 51-57 0-36-21-56-51-56-30 0-51 20-51 56 0 36 21 57 51 57zm3-23c-16 0-26-12-26-32 0-19 10-31 26-31 16 0 26 11 26 31S696 694 680 694zm93 17v-38h13l21 38H836l-25-43c12-5 19-15 19-31 0-26-20-34-44-34H745v108h27zm16-51H774v-34h15c16 0 25 4 25 16s-9 18-25 18zM922 711v-22h-43v-23h35v-22h-35V625h41V603H853v108h68z</StreamGeometry>
|
<StreamGeometry x:Key="Icons.GitIgnore">M590 74 859 342V876c0 38-31 68-68 68H233c-38 0-68-31-68-68V142c0-38 31-68 68-68h357zm-12 28H233a40 40 0 00-40 38L193 142v734a40 40 0 0038 40L233 916h558a40 40 0 0040-38L831 876V354L578 102zM855 371h-215c-46 0-83-36-84-82l0-2V74h28v213c0 30 24 54 54 55l2 0h215v28zM57 489m28 0 853 0q28 0 28 28l0 284q0 28-28 28l-853 0q-28 0-28-28l0-284q0-28 28-28ZM157 717c15 0 29-6 37-13v-51h-41v22h17v18c-2 2-6 3-10 3-21 0-30-13-30-34 0-21 12-34 28-34 9 0 15 4 20 9l14-17C184 610 172 603 156 603c-29 0-54 21-54 57 0 37 24 56 54 56zM245 711v-108h-34v108h34zm69 0v-86H341V603H262v22h28V711h24zM393 711v-108h-34v108h34zm66 6c15 0 29-6 37-13v-51h-41v22h17v18c-2 2-6 3-10 3-21 0-30-13-30-34 0-21 12-34 28-34 9 0 15 4 20 9l14-17C485 610 474 603 458 603c-29 0-54 21-54 57 0 37 24 56 54 56zm88-6v-36c0-13-2-28-3-40h1l10 24 25 52H603v-108h-23v36c0 13 2 28 3 40h-1l-10-24L548 603H523v108h23zM677 717c30 0 51-22 51-57 0-36-21-56-51-56-30 0-51 20-51 56 0 36 21 57 51 57zm3-23c-16 0-26-12-26-32 0-19 10-31 26-31 16 0 26 11 26 31S696 694 680 694zm93 17v-38h13l21 38H836l-25-43c12-5 19-15 19-31 0-26-20-34-44-34H745v108h27zm16-51H774v-34h15c16 0 25 4 25 16s-9 18-25 18zM922 711v-22h-43v-23h35v-22h-35V625h41V603H853v108h68z</StreamGeometry>
|
||||||
<StreamGeometry x:Key="Icons.Grid">M30 271l241 0 0-241-241 0 0 241zM392 271l241 0 0-241-241 0 0 241zM753 30l0 241 241 0 0-241-241 0zM30 632l241 0 0-241-241 0 0 241zM392 632l241 0 0-241-241 0 0 241zM753 632l241 0 0-241-241 0 0 241zM30 994l241 0 0-241-241 0 0 241zM392 994l241 0 0-241-241 0 0 241zM753 994l241 0 0-241-241 0 0 241z</StreamGeometry>
|
<StreamGeometry x:Key="Icons.Grid">M30 271l241 0 0-241-241 0 0 241zM392 271l241 0 0-241-241 0 0 241zM753 30l0 241 241 0 0-241-241 0zM30 632l241 0 0-241-241 0 0 241zM392 632l241 0 0-241-241 0 0 241zM753 632l241 0 0-241-241 0 0 241zM30 994l241 0 0-241-241 0 0 241zM392 994l241 0 0-241-241 0 0 241zM753 994l241 0 0-241-241 0 0 241z</StreamGeometry>
|
||||||
<StreamGeometry x:Key="Icons.Head">M0 512M1024 512M512 0M512 1024M955 323q0 23-16 39l-414 414-78 78q-16 16-39 16t-39-16l-78-78-207-207q-16-16-16-39t16-39l78-78q16-16 39-16t39 16l168 169 375-375q16-16 39-16t39 16l78 78q16 16 16 39z</StreamGeometry>
|
|
||||||
<StreamGeometry x:Key="Icons.HiddenSymbol">M416 64H768v64h-64v704h64v64H448v-64h64V512H416a224 224 0 1 1 0-448zM576 832h64V128H576v704zM416 128H512v320H416a160 160 0 0 1 0-320z</StreamGeometry>
|
<StreamGeometry x:Key="Icons.HiddenSymbol">M416 64H768v64h-64v704h64v64H448v-64h64V512H416a224 224 0 1 1 0-448zM576 832h64V128H576v704zM416 128H512v320H416a160 160 0 0 1 0-320z</StreamGeometry>
|
||||||
<StreamGeometry x:Key="Icons.Histories">M24 512A488 488 0 01512 24A488 488 0 011000 512A488 488 0 01512 1000A488 488 0 0124 512zm447-325v327L243 619l51 111 300-138V187H471z</StreamGeometry>
|
<StreamGeometry x:Key="Icons.Histories">M24 512A488 488 0 01512 24A488 488 0 011000 512A488 488 0 01512 1000A488 488 0 0124 512zm447-325v327L243 619l51 111 300-138V187H471z</StreamGeometry>
|
||||||
<StreamGeometry x:Key="Icons.Home">M832 64h128v278l-128-146V64zm64 448L512 73 128 512H0L448 0h128l448 512h-128zm0 83V1024H640V704c0-35-29-64-64-64h-128a64 64 0 00-64 64v320H128V595l384-424 384 424z</StreamGeometry>
|
<StreamGeometry x:Key="Icons.Home">M832 64h128v278l-128-146V64zm64 448L512 73 128 512H0L448 0h128l448 512h-128zm0 83V1024H640V704c0-35-29-64-64-64h-128a64 64 0 00-64 64v320H128V595l384-424 384 424z</StreamGeometry>
|
||||||
|
|
|
@ -83,11 +83,8 @@
|
||||||
<x:String x:Key="Text.Checkout.LocalChanges.DoNothing" xml:space="preserve">Do Nothing</x:String>
|
<x:String x:Key="Text.Checkout.LocalChanges.DoNothing" xml:space="preserve">Do Nothing</x:String>
|
||||||
<x:String x:Key="Text.Checkout.LocalChanges.StashAndReply" xml:space="preserve">Stash & Reapply</x:String>
|
<x:String x:Key="Text.Checkout.LocalChanges.StashAndReply" xml:space="preserve">Stash & Reapply</x:String>
|
||||||
<x:String x:Key="Text.CherryPick" xml:space="preserve">Cherry Pick</x:String>
|
<x:String x:Key="Text.CherryPick" xml:space="preserve">Cherry Pick</x:String>
|
||||||
<x:String x:Key="Text.CherryPick.AppendSourceToMessage" xml:space="preserve">Append source to commit message</x:String>
|
|
||||||
<x:String x:Key="Text.CherryPick.Commit" xml:space="preserve">Commit(s):</x:String>
|
<x:String x:Key="Text.CherryPick.Commit" xml:space="preserve">Commit(s):</x:String>
|
||||||
<x:String x:Key="Text.CherryPick.CommitChanges" xml:space="preserve">Commit all changes</x:String>
|
<x:String x:Key="Text.CherryPick.CommitChanges" xml:space="preserve">Commit all changes</x:String>
|
||||||
<x:String x:Key="Text.CherryPick.Mainline" xml:space="preserve">Mainline:</x:String>
|
|
||||||
<x:String x:Key="Text.CherryPick.Mainline.Tips" xml:space="preserve">Usually you cannot cherry-pick a merge because you do not know which side of the merge should be considered the mainline. This option allows cherry-pick to replay the change relative to the specified parent.</x:String>
|
|
||||||
<x:String x:Key="Text.ClearStashes" xml:space="preserve">Clear Stashes</x:String>
|
<x:String x:Key="Text.ClearStashes" xml:space="preserve">Clear Stashes</x:String>
|
||||||
<x:String x:Key="Text.ClearStashes.Message" xml:space="preserve">You are trying to clear all stashes. Are you sure to continue?</x:String>
|
<x:String x:Key="Text.ClearStashes.Message" xml:space="preserve">You are trying to clear all stashes. Are you sure to continue?</x:String>
|
||||||
<x:String x:Key="Text.Clone" xml:space="preserve">Clone Remote Repository</x:String>
|
<x:String x:Key="Text.Clone" xml:space="preserve">Clone Remote Repository</x:String>
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
<x:String x:Key="Text.About" xml:space="preserve">О программе</x:String>
|
<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.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.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.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.Editor" xml:space="preserve">• Текстовый редактор от </x:String>
|
||||||
<x:String x:Key="Text.About.Fonts" xml:space="preserve">• Моноширинные шрифты взяты из </x:String>
|
<x:String x:Key="Text.About.Fonts" xml:space="preserve">• Моноширинные шрифты взяты из </x:String>
|
||||||
|
@ -317,7 +316,6 @@
|
||||||
<x:String x:Key="Text.Histories.DisplayMode" xml:space="preserve">Переключение горизонтального/вертикального расположения</x:String>
|
<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.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.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.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.SHA" xml:space="preserve">SHA</x:String>
|
||||||
<x:String x:Key="Text.Histories.Header.Time" xml:space="preserve">ВРЕМЯ ФИКСАЦИИ</x:String>
|
<x:String x:Key="Text.Histories.Header.Time" xml:space="preserve">ВРЕМЯ ФИКСАЦИИ</x:String>
|
||||||
|
@ -417,7 +415,6 @@
|
||||||
<x:String x:Key="Text.Preference.General.Check4UpdatesOnStartup" xml:space="preserve">Проверить обновления при старте</x:String>
|
<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.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.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.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" xml:space="preserve">GIT</x:String>
|
||||||
<x:String x:Key="Text.Preference.Git.CRLF" xml:space="preserve">Включить автозавершение CRLF</x:String>
|
<x:String x:Key="Text.Preference.Git.CRLF" xml:space="preserve">Включить автозавершение CRLF</x:String>
|
||||||
|
|
|
@ -86,11 +86,8 @@
|
||||||
<x:String x:Key="Text.Checkout.LocalChanges.DoNothing" xml:space="preserve">不做处理</x:String>
|
<x:String x:Key="Text.Checkout.LocalChanges.DoNothing" xml:space="preserve">不做处理</x:String>
|
||||||
<x:String x:Key="Text.Checkout.LocalChanges.StashAndReply" xml:space="preserve">贮藏并自动恢复</x:String>
|
<x:String x:Key="Text.Checkout.LocalChanges.StashAndReply" xml:space="preserve">贮藏并自动恢复</x:String>
|
||||||
<x:String x:Key="Text.CherryPick" xml:space="preserve">挑选提交</x:String>
|
<x:String x:Key="Text.CherryPick" xml:space="preserve">挑选提交</x:String>
|
||||||
<x:String x:Key="Text.CherryPick.AppendSourceToMessage" xml:space="preserve">提交信息中追加来源信息</x:String>
|
|
||||||
<x:String x:Key="Text.CherryPick.Commit" xml:space="preserve">提交列表 :</x:String>
|
<x:String x:Key="Text.CherryPick.Commit" xml:space="preserve">提交列表 :</x:String>
|
||||||
<x:String x:Key="Text.CherryPick.CommitChanges" xml:space="preserve">提交变化</x:String>
|
<x:String x:Key="Text.CherryPick.CommitChanges" xml:space="preserve">提交变化</x:String>
|
||||||
<x:String x:Key="Text.CherryPick.Mainline" xml:space="preserve">对比的父提交 :</x:String>
|
|
||||||
<x:String x:Key="Text.CherryPick.Mainline.Tips" xml:space="preserve">通常你不能对一个合并进行挑选,因为你不知道合并的哪一边应该被视为主线。这个选项指定了作为主线的父提交,允许挑选相对于该提交的修改。</x:String>
|
|
||||||
<x:String x:Key="Text.ClearStashes" xml:space="preserve">丢弃贮藏确认</x:String>
|
<x:String x:Key="Text.ClearStashes" xml:space="preserve">丢弃贮藏确认</x:String>
|
||||||
<x:String x:Key="Text.ClearStashes.Message" xml:space="preserve">您正在丢弃所有的贮藏,一经操作,无法回退,是否继续?</x:String>
|
<x:String x:Key="Text.ClearStashes.Message" xml:space="preserve">您正在丢弃所有的贮藏,一经操作,无法回退,是否继续?</x:String>
|
||||||
<x:String x:Key="Text.Clone" xml:space="preserve">克隆远程仓库</x:String>
|
<x:String x:Key="Text.Clone" xml:space="preserve">克隆远程仓库</x:String>
|
||||||
|
|
|
@ -86,11 +86,8 @@
|
||||||
<x:String x:Key="Text.Checkout.LocalChanges.DoNothing" xml:space="preserve">不做處理</x:String>
|
<x:String x:Key="Text.Checkout.LocalChanges.DoNothing" xml:space="preserve">不做處理</x:String>
|
||||||
<x:String x:Key="Text.Checkout.LocalChanges.StashAndReply" xml:space="preserve">擱置變更並自動復原</x:String>
|
<x:String x:Key="Text.Checkout.LocalChanges.StashAndReply" xml:space="preserve">擱置變更並自動復原</x:String>
|
||||||
<x:String x:Key="Text.CherryPick" xml:space="preserve">揀選提交</x:String>
|
<x:String x:Key="Text.CherryPick" xml:space="preserve">揀選提交</x:String>
|
||||||
<x:String x:Key="Text.CherryPick.AppendSourceToMessage" xml:space="preserve">提交資訊中追加來源資訊</x:String>
|
|
||||||
<x:String x:Key="Text.CherryPick.Commit" xml:space="preserve">提交列表:</x:String>
|
<x:String x:Key="Text.CherryPick.Commit" xml:space="preserve">提交列表:</x:String>
|
||||||
<x:String x:Key="Text.CherryPick.CommitChanges" xml:space="preserve">提交變更</x:String>
|
<x:String x:Key="Text.CherryPick.CommitChanges" xml:space="preserve">提交變更</x:String>
|
||||||
<x:String x:Key="Text.CherryPick.Mainline" xml:space="preserve">對比的父提交:</x:String>
|
|
||||||
<x:String x:Key="Text.CherryPick.Mainline.Tips" xml:space="preserve">通常你不能對一個合併進行揀選,因為你不知道合併的哪一邊應該被視為主線。這個選項指定了作為主線的父提交,允許揀選相對於該提交的修改。</x:String>
|
|
||||||
<x:String x:Key="Text.ClearStashes" xml:space="preserve">捨棄擱置變更確認</x:String>
|
<x:String x:Key="Text.ClearStashes" xml:space="preserve">捨棄擱置變更確認</x:String>
|
||||||
<x:String x:Key="Text.ClearStashes.Message" xml:space="preserve">您正在捨棄所有的擱置變更,一經操作便無法復原,是否繼續?</x:String>
|
<x:String x:Key="Text.ClearStashes.Message" xml:space="preserve">您正在捨棄所有的擱置變更,一經操作便無法復原,是否繼續?</x:String>
|
||||||
<x:String x:Key="Text.Clone" xml:space="preserve">複製 (clone) 遠端存放庫</x:String>
|
<x:String x:Key="Text.Clone" xml:space="preserve">複製 (clone) 遠端存放庫</x:String>
|
||||||
|
|
|
@ -10,7 +10,12 @@
|
||||||
<Color x:Key="Color.Contents">#FFFAFAFA</Color>
|
<Color x:Key="Color.Contents">#FFFAFAFA</Color>
|
||||||
<Color x:Key="Color.Badge">#FFB0CEE8</Color>
|
<Color x:Key="Color.Badge">#FFB0CEE8</Color>
|
||||||
<Color x:Key="Color.BadgeFG">#FF1F1F1F</Color>
|
<Color x:Key="Color.BadgeFG">#FF1F1F1F</Color>
|
||||||
|
<Color x:Key="Color.DecoratorIconBG">#A0A0A0</Color>
|
||||||
|
<Color x:Key="Color.DecoratorIcon">White</Color>
|
||||||
|
<Color x:Key="Color.DecoratorBranch">#008585</Color>
|
||||||
|
<Color x:Key="Color.DecoratorHead">#0C0E21</Color>
|
||||||
<Color x:Key="Color.DecoratorTag">#79855f</Color>
|
<Color x:Key="Color.DecoratorTag">#79855f</Color>
|
||||||
|
<Color x:Key="Color.DecoratorFG">White</Color>
|
||||||
<Color x:Key="Color.Conflict">#FF836C2E</Color>
|
<Color x:Key="Color.Conflict">#FF836C2E</Color>
|
||||||
<Color x:Key="Color.ConflictForeground">#FFFFFFFF</Color>
|
<Color x:Key="Color.ConflictForeground">#FFFFFFFF</Color>
|
||||||
<Color x:Key="Color.Border0">#FFCFCFCF</Color>
|
<Color x:Key="Color.Border0">#FFCFCFCF</Color>
|
||||||
|
@ -37,7 +42,12 @@
|
||||||
<Color x:Key="Color.Contents">#FF1C1C1C</Color>
|
<Color x:Key="Color.Contents">#FF1C1C1C</Color>
|
||||||
<Color x:Key="Color.Badge">#FF8F8F8F</Color>
|
<Color x:Key="Color.Badge">#FF8F8F8F</Color>
|
||||||
<Color x:Key="Color.BadgeFG">#FFDDDDDD</Color>
|
<Color x:Key="Color.BadgeFG">#FFDDDDDD</Color>
|
||||||
|
<Color x:Key="Color.DecoratorIconBG">#FF505050</Color>
|
||||||
|
<Color x:Key="Color.DecoratorIcon">#FFF8F8F8</Color>
|
||||||
|
<Color x:Key="Color.DecoratorBranch">#FFFFB835</Color>
|
||||||
|
<Color x:Key="Color.DecoratorHead">#f4f1de</Color>
|
||||||
<Color x:Key="Color.DecoratorTag">#84c88a</Color>
|
<Color x:Key="Color.DecoratorTag">#84c88a</Color>
|
||||||
|
<Color x:Key="Color.DecoratorFG">Black</Color>
|
||||||
<Color x:Key="Color.Conflict">#FFFAFAD2</Color>
|
<Color x:Key="Color.Conflict">#FFFAFAD2</Color>
|
||||||
<Color x:Key="Color.ConflictForeground">#FF252525</Color>
|
<Color x:Key="Color.ConflictForeground">#FF252525</Color>
|
||||||
<Color x:Key="Color.Border0">#FF181818</Color>
|
<Color x:Key="Color.Border0">#FF181818</Color>
|
||||||
|
@ -64,7 +74,12 @@
|
||||||
<SolidColorBrush x:Key="Brush.Contents" Color="{DynamicResource Color.Contents}"/>
|
<SolidColorBrush x:Key="Brush.Contents" Color="{DynamicResource Color.Contents}"/>
|
||||||
<SolidColorBrush x:Key="Brush.Badge" Color="{DynamicResource Color.Badge}"/>
|
<SolidColorBrush x:Key="Brush.Badge" Color="{DynamicResource Color.Badge}"/>
|
||||||
<SolidColorBrush x:Key="Brush.BadgeFG" Color="{DynamicResource Color.BadgeFG}"/>
|
<SolidColorBrush x:Key="Brush.BadgeFG" Color="{DynamicResource Color.BadgeFG}"/>
|
||||||
|
<SolidColorBrush x:Key="Brush.DecoratorIconBG" Color="{DynamicResource Color.DecoratorIconBG}"/>
|
||||||
|
<SolidColorBrush x:Key="Brush.DecoratorIcon" Color="{DynamicResource Color.DecoratorIcon}"/>
|
||||||
|
<SolidColorBrush x:Key="Brush.DecoratorBranch" Color="{DynamicResource Color.DecoratorBranch}"/>
|
||||||
|
<SolidColorBrush x:Key="Brush.DecoratorHead" Color="{DynamicResource Color.DecoratorHead}"/>
|
||||||
<SolidColorBrush x:Key="Brush.DecoratorTag" Color="{DynamicResource Color.DecoratorTag}"/>
|
<SolidColorBrush x:Key="Brush.DecoratorTag" Color="{DynamicResource Color.DecoratorTag}"/>
|
||||||
|
<SolidColorBrush x:Key="Brush.DecoratorFG" Color="{DynamicResource Color.DecoratorFG}"/>
|
||||||
<SolidColorBrush x:Key="Brush.Conflict" Color="{DynamicResource Color.Conflict}"/>
|
<SolidColorBrush x:Key="Brush.Conflict" Color="{DynamicResource Color.Conflict}"/>
|
||||||
<SolidColorBrush x:Key="Brush.ConflictForeground" Color="{DynamicResource Color.ConflictForeground}"/>
|
<SolidColorBrush x:Key="Brush.ConflictForeground" Color="{DynamicResource Color.ConflictForeground}"/>
|
||||||
<SolidColorBrush x:Key="Brush.Border0" Color="{DynamicResource Color.Border0}"/>
|
<SolidColorBrush x:Key="Brush.Border0" Color="{DynamicResource Color.Border0}"/>
|
||||||
|
|
|
@ -12,30 +12,6 @@ namespace SourceGit.ViewModels
|
||||||
private set;
|
private set;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool IsMergeCommit
|
|
||||||
{
|
|
||||||
get;
|
|
||||||
private set;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<Models.Commit> ParentsForMergeCommit
|
|
||||||
{
|
|
||||||
get;
|
|
||||||
private set;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int MainlineForMergeCommit
|
|
||||||
{
|
|
||||||
get;
|
|
||||||
set;
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool AppendSourceToMessage
|
|
||||||
{
|
|
||||||
get;
|
|
||||||
set;
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool AutoCommit
|
public bool AutoCommit
|
||||||
{
|
{
|
||||||
get;
|
get;
|
||||||
|
@ -46,22 +22,6 @@ namespace SourceGit.ViewModels
|
||||||
{
|
{
|
||||||
_repo = repo;
|
_repo = repo;
|
||||||
Targets = targets;
|
Targets = targets;
|
||||||
IsMergeCommit = false;
|
|
||||||
ParentsForMergeCommit = [];
|
|
||||||
MainlineForMergeCommit = 0;
|
|
||||||
AppendSourceToMessage = true;
|
|
||||||
AutoCommit = true;
|
|
||||||
View = new Views.CherryPick() { DataContext = this };
|
|
||||||
}
|
|
||||||
|
|
||||||
public CherryPick(Repository repo, Models.Commit merge, List<Models.Commit> parents)
|
|
||||||
{
|
|
||||||
_repo = repo;
|
|
||||||
Targets = [merge];
|
|
||||||
IsMergeCommit = true;
|
|
||||||
ParentsForMergeCommit = parents;
|
|
||||||
MainlineForMergeCommit = 0;
|
|
||||||
AppendSourceToMessage = true;
|
|
||||||
AutoCommit = true;
|
AutoCommit = true;
|
||||||
View = new Views.CherryPick() { DataContext = this };
|
View = new Views.CherryPick() { DataContext = this };
|
||||||
}
|
}
|
||||||
|
@ -73,30 +33,12 @@ namespace SourceGit.ViewModels
|
||||||
|
|
||||||
return Task.Run(() =>
|
return Task.Run(() =>
|
||||||
{
|
{
|
||||||
var succ = false;
|
// Get commit SHAs reverted
|
||||||
if (IsMergeCommit)
|
var builder = new StringBuilder();
|
||||||
{
|
for (int i = Targets.Count - 1; i >= 0; i--)
|
||||||
succ = new Commands.CherryPick(
|
builder.Append($"{Targets[i].SHA} ");
|
||||||
_repo.FullPath,
|
|
||||||
Targets[0].SHA,
|
|
||||||
!AutoCommit,
|
|
||||||
AppendSourceToMessage,
|
|
||||||
$"-m {MainlineForMergeCommit+1}").Exec();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
var builder = new StringBuilder();
|
|
||||||
for (int i = Targets.Count - 1; i >= 0; i--)
|
|
||||||
builder.Append($"{Targets[i].SHA} ");
|
|
||||||
|
|
||||||
succ = new Commands.CherryPick(
|
var succ = new Commands.CherryPick(_repo.FullPath, builder.ToString(), !AutoCommit).Exec();
|
||||||
_repo.FullPath,
|
|
||||||
builder.ToString(),
|
|
||||||
!AutoCommit,
|
|
||||||
AppendSourceToMessage,
|
|
||||||
string.Empty).Exec();
|
|
||||||
}
|
|
||||||
|
|
||||||
CallUIThread(() => _repo.SetWatcherEnabled(true));
|
CallUIThread(() => _repo.SetWatcherEnabled(true));
|
||||||
return succ;
|
return succ;
|
||||||
});
|
});
|
||||||
|
|
|
@ -424,28 +424,7 @@ namespace SourceGit.ViewModels
|
||||||
cherryPick.Click += (_, e) =>
|
cherryPick.Click += (_, e) =>
|
||||||
{
|
{
|
||||||
if (PopupHost.CanCreatePopup())
|
if (PopupHost.CanCreatePopup())
|
||||||
{
|
PopupHost.ShowPopup(new CherryPick(_repo, [commit]));
|
||||||
if (commit.Parents.Count <= 1)
|
|
||||||
{
|
|
||||||
PopupHost.ShowPopup(new CherryPick(_repo, [commit]));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
var parents = new List<Models.Commit>();
|
|
||||||
foreach (var sha in commit.Parents)
|
|
||||||
{
|
|
||||||
var parent = _commits.Find(x => x.SHA == sha);
|
|
||||||
if (parent == null)
|
|
||||||
parent = new Commands.QuerySingleCommit(_repo.FullPath, sha).Result();
|
|
||||||
|
|
||||||
if (parent != null)
|
|
||||||
parents.Add(parent);
|
|
||||||
}
|
|
||||||
|
|
||||||
PopupHost.ShowPopup(new CherryPick(_repo, commit, parents));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
e.Handled = true;
|
e.Handled = true;
|
||||||
};
|
};
|
||||||
menu.Items.Add(cherryPick);
|
menu.Items.Add(cherryPick);
|
||||||
|
|
|
@ -12,11 +12,17 @@
|
||||||
<TextBlock FontSize="18"
|
<TextBlock FontSize="18"
|
||||||
Classes="bold"
|
Classes="bold"
|
||||||
Text="{DynamicResource Text.CherryPick}"/>
|
Text="{DynamicResource Text.CherryPick}"/>
|
||||||
<Grid Margin="0,16,0,0" RowDefinitions="Auto,Auto,32,32" ColumnDefinitions="100,*">
|
<Grid Margin="0,16,0,0" ColumnDefinitions="100,*">
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="Auto"/>
|
||||||
|
<RowDefinition Height="32"/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
|
||||||
<TextBlock Grid.Row="0" Grid.Column="0"
|
<TextBlock Grid.Row="0" Grid.Column="0"
|
||||||
HorizontalAlignment="Right" VerticalAlignment="Center"
|
HorizontalAlignment="Right" VerticalAlignment="Top"
|
||||||
Margin="0,0,8,0"
|
Margin="0,0,8,0"
|
||||||
Text="{DynamicResource Text.CherryPick.Commit}"/>
|
Text="{DynamicResource Text.CherryPick.Commit}"/>
|
||||||
|
|
||||||
<ListBox Grid.Row="0" Grid.Column="1"
|
<ListBox Grid.Row="0" Grid.Column="1"
|
||||||
MinHeight="32" MaxHeight="100"
|
MinHeight="32" MaxHeight="100"
|
||||||
ItemsSource="{Binding Targets}"
|
ItemsSource="{Binding Targets}"
|
||||||
|
@ -50,47 +56,11 @@
|
||||||
</Grid>
|
</Grid>
|
||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
</ListBox.ItemTemplate>
|
</ListBox.ItemTemplate>
|
||||||
</ListBox>
|
</ListBox>
|
||||||
|
|
||||||
<TextBlock Grid.Row="1" Grid.Column="0"
|
<CheckBox Grid.Row="1" Grid.Column="1"
|
||||||
HorizontalAlignment="Right" VerticalAlignment="Center"
|
|
||||||
Margin="0,0,8,0"
|
|
||||||
Text="{DynamicResource Text.CherryPick.Mainline}"
|
|
||||||
IsVisible="{Binding IsMergeCommit}"/>
|
|
||||||
<Grid Grid.Row="1" Grid.Column="1" Height="32" ColumnDefinitions="*,24" IsVisible="{Binding IsMergeCommit}">
|
|
||||||
<ComboBox Grid.Column="0"
|
|
||||||
Height="28" Padding="4,0"
|
|
||||||
VerticalAlignment="Center" HorizontalAlignment="Stretch"
|
|
||||||
ItemsSource="{Binding ParentsForMergeCommit}"
|
|
||||||
SelectedIndex="{Binding MainlineForMergeCommit, Mode=TwoWay}">
|
|
||||||
<ComboBox.ItemTemplate>
|
|
||||||
<DataTemplate x:DataType="{x:Type m:Commit}">
|
|
||||||
<Grid ColumnDefinitions="Auto,*">
|
|
||||||
<TextBlock Grid.Column="0" FontFamily="{DynamicResource Fonts.Monospace}" VerticalAlignment="Center" Text="{Binding SHA, Converter={x:Static c:StringConverters.ToShortSHA}}" Foreground="DarkOrange" Margin="6,0,4,0"/>
|
|
||||||
<TextBlock Grid.Column="1" VerticalAlignment="Center" Text="{Binding Subject}" TextTrimming="CharacterEllipsis"/>
|
|
||||||
</Grid>
|
|
||||||
</DataTemplate>
|
|
||||||
</ComboBox.ItemTemplate>
|
|
||||||
</ComboBox>
|
|
||||||
|
|
||||||
<Border Grid.Column="1"
|
|
||||||
Background="Transparent"
|
|
||||||
ToolTip.Tip="{DynamicResource Text.CherryPick.Mainline.Tips}">
|
|
||||||
<Path Grid.Column="1"
|
|
||||||
Width="14" Height="14"
|
|
||||||
Data="{StaticResource Icons.Info}"/>
|
|
||||||
</Border>
|
|
||||||
</Grid>
|
|
||||||
|
|
||||||
<CheckBox Grid.Row="2" Grid.Column="1"
|
|
||||||
Content="{DynamicResource Text.CherryPick.CommitChanges}"
|
Content="{DynamicResource Text.CherryPick.CommitChanges}"
|
||||||
IsChecked="{Binding AutoCommit, Mode=TwoWay}"/>
|
IsChecked="{Binding AutoCommit, Mode=TwoWay}"/>
|
||||||
|
|
||||||
<CheckBox Grid.Row="3" Grid.Column="1"
|
|
||||||
Content="{DynamicResource Text.CherryPick.AppendSourceToMessage}"
|
|
||||||
IsChecked="{Binding AppendSourceToMessage, Mode=TwoWay}"
|
|
||||||
IsEnabled="{Binding AutoCommit}"
|
|
||||||
ToolTip.Tip="-x"/>
|
|
||||||
</Grid>
|
</Grid>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</UserControl>
|
</UserControl>
|
||||||
|
|
|
@ -98,11 +98,16 @@
|
||||||
<!-- REFS -->
|
<!-- REFS -->
|
||||||
<TextBlock Grid.Row="2" Grid.Column="0" Classes="info_label" Text="{DynamicResource Text.CommitDetail.Info.Refs}" IsVisible="{Binding HasDecorators}"/>
|
<TextBlock Grid.Row="2" Grid.Column="0" Classes="info_label" Text="{DynamicResource Text.CommitDetail.Info.Refs}" IsVisible="{Binding HasDecorators}"/>
|
||||||
<Border Grid.Row="2" Grid.Column="1" Margin="12,0,0,0" Height="24" IsVisible="{Binding HasDecorators}">
|
<Border Grid.Row="2" Grid.Column="1" Margin="12,0,0,0" Height="24" IsVisible="{Binding HasDecorators}">
|
||||||
<v:CommitRefsPresenter TagBackground="{DynamicResource Brush.DecoratorTag}"
|
<v:CommitRefsPresenter IconBackground="{DynamicResource Brush.DecoratorIconBG}"
|
||||||
Foreground="{DynamicResource Brush.FG1}"
|
IconForeground="{DynamicResource Brush.DecoratorIcon}"
|
||||||
|
BranchNameBackground="{DynamicResource Brush.DecoratorBranch}"
|
||||||
|
HeadBranchNameBackground="{DynamicResource Brush.DecoratorHead}"
|
||||||
|
TagNameBackground="{DynamicResource Brush.DecoratorTag}"
|
||||||
|
LabelForeground="{DynamicResource Brush.DecoratorFG}"
|
||||||
FontFamily="{DynamicResource Fonts.Primary}"
|
FontFamily="{DynamicResource Fonts.Primary}"
|
||||||
FontSize="11"
|
FontSize="11"
|
||||||
VerticalAlignment="Center"/>
|
VerticalAlignment="Center"
|
||||||
|
Refs="{Binding Decorators}"/>
|
||||||
</Border>
|
</Border>
|
||||||
|
|
||||||
<!-- Messages -->
|
<!-- Messages -->
|
||||||
|
|
|
@ -14,9 +14,16 @@ namespace SourceGit.Views
|
||||||
{
|
{
|
||||||
public Geometry Icon { get; set; } = null;
|
public Geometry Icon { get; set; } = null;
|
||||||
public FormattedText Label { get; set; } = null;
|
public FormattedText Label { get; set; } = null;
|
||||||
public IBrush Brush { get; set; } = null;
|
public IBrush LabelBG { get; set; } = null;
|
||||||
public bool IsHead { get; set; } = false;
|
}
|
||||||
public double Width { get; set; } = 0.0;
|
|
||||||
|
public static readonly StyledProperty<List<Models.Decorator>> RefsProperty =
|
||||||
|
AvaloniaProperty.Register<CommitRefsPresenter, List<Models.Decorator>>(nameof(Refs));
|
||||||
|
|
||||||
|
public List<Models.Decorator> Refs
|
||||||
|
{
|
||||||
|
get => GetValue(RefsProperty);
|
||||||
|
set => SetValue(RefsProperty, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static readonly StyledProperty<FontFamily> FontFamilyProperty =
|
public static readonly StyledProperty<FontFamily> FontFamilyProperty =
|
||||||
|
@ -37,32 +44,73 @@ namespace SourceGit.Views
|
||||||
set => SetValue(FontSizeProperty, value);
|
set => SetValue(FontSizeProperty, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static readonly StyledProperty<IBrush> ForegroundProperty =
|
public static readonly StyledProperty<IBrush> IconBackgroundProperty =
|
||||||
AvaloniaProperty.Register<CommitRefsPresenter, IBrush>(nameof(Foreground), Brushes.White);
|
AvaloniaProperty.Register<CommitRefsPresenter, IBrush>(nameof(IconBackground), Brushes.White);
|
||||||
|
|
||||||
public IBrush Foreground
|
public IBrush IconBackground
|
||||||
{
|
{
|
||||||
get => GetValue(ForegroundProperty);
|
get => GetValue(IconBackgroundProperty);
|
||||||
set => SetValue(ForegroundProperty, value);
|
set => SetValue(IconBackgroundProperty, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static readonly StyledProperty<IBrush> TagBackgroundProperty =
|
public static readonly StyledProperty<IBrush> IconForegroundProperty =
|
||||||
AvaloniaProperty.Register<CommitRefsPresenter, IBrush>(nameof(TagBackground), Brushes.White);
|
AvaloniaProperty.Register<CommitRefsPresenter, IBrush>(nameof(IconForeground), Brushes.White);
|
||||||
|
|
||||||
public IBrush TagBackground
|
public IBrush IconForeground
|
||||||
{
|
{
|
||||||
get => GetValue(TagBackgroundProperty);
|
get => GetValue(IconForegroundProperty);
|
||||||
set => SetValue(TagBackgroundProperty, value);
|
set => SetValue(IconForegroundProperty, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static readonly StyledProperty<IBrush> LabelForegroundProperty =
|
||||||
|
AvaloniaProperty.Register<CommitRefsPresenter, IBrush>(nameof(LabelForeground), Brushes.White);
|
||||||
|
|
||||||
|
public IBrush LabelForeground
|
||||||
|
{
|
||||||
|
get => GetValue(LabelForegroundProperty);
|
||||||
|
set => SetValue(LabelForegroundProperty, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static readonly StyledProperty<IBrush> BranchNameBackgroundProperty =
|
||||||
|
AvaloniaProperty.Register<CommitRefsPresenter, IBrush>(nameof(BranchNameBackground), Brushes.White);
|
||||||
|
|
||||||
|
public IBrush BranchNameBackground
|
||||||
|
{
|
||||||
|
get => GetValue(BranchNameBackgroundProperty);
|
||||||
|
set => SetValue(BranchNameBackgroundProperty, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static readonly StyledProperty<IBrush> HeadBranchNameBackgroundProperty =
|
||||||
|
AvaloniaProperty.Register<CommitRefsPresenter, IBrush>(nameof(HeadBranchNameBackground), Brushes.White);
|
||||||
|
|
||||||
|
public IBrush HeadBranchNameBackground
|
||||||
|
{
|
||||||
|
get => GetValue(HeadBranchNameBackgroundProperty);
|
||||||
|
set => SetValue(HeadBranchNameBackgroundProperty, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static readonly StyledProperty<IBrush> TagNameBackgroundProperty =
|
||||||
|
AvaloniaProperty.Register<CommitRefsPresenter, IBrush>(nameof(TagNameBackground), Brushes.White);
|
||||||
|
|
||||||
|
public IBrush TagNameBackground
|
||||||
|
{
|
||||||
|
get => GetValue(TagNameBackgroundProperty);
|
||||||
|
set => SetValue(TagNameBackgroundProperty, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
static CommitRefsPresenter()
|
static CommitRefsPresenter()
|
||||||
{
|
{
|
||||||
AffectsMeasure<CommitRefsPresenter>(
|
AffectsMeasure<CommitRefsPresenter>(
|
||||||
FontFamilyProperty,
|
FontFamilyProperty,
|
||||||
FontSizeProperty);
|
FontSizeProperty,
|
||||||
|
LabelForegroundProperty,
|
||||||
|
RefsProperty);
|
||||||
|
|
||||||
AffectsRender<CommitRefsPresenter>(
|
AffectsRender<CommitRefsPresenter>(
|
||||||
TagBackgroundProperty);
|
IconBackgroundProperty,
|
||||||
|
IconForegroundProperty,
|
||||||
|
BranchNameBackgroundProperty,
|
||||||
|
TagNameBackgroundProperty);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Render(DrawingContext context)
|
public override void Render(DrawingContext context)
|
||||||
|
@ -70,60 +118,39 @@ namespace SourceGit.Views
|
||||||
if (_items.Count == 0)
|
if (_items.Count == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var fg = Foreground;
|
var iconFG = IconForeground;
|
||||||
var x = 1.0;
|
var iconBG = IconBackground;
|
||||||
|
var x = 0.0;
|
||||||
|
|
||||||
foreach (var item in _items)
|
foreach (var item in _items)
|
||||||
{
|
{
|
||||||
var iconRect = new RoundedRect(new Rect(x, 0, 16, 16), new CornerRadius(2, 0, 0, 2));
|
var iconRect = new RoundedRect(new Rect(x, 0, 16, 16), new CornerRadius(2, 0, 0, 2));
|
||||||
var entireRect = new RoundedRect(new Rect(x, 0, item.Width, 16), new CornerRadius(2));
|
var labelRect = new RoundedRect(new Rect(x + 16, 0, item.Label.Width + 8, 16), new CornerRadius(0, 2, 2, 0));
|
||||||
|
|
||||||
using (context.PushTransform(Matrix.CreateTranslation(x + 3, 3)))
|
context.DrawRectangle(iconBG, null, iconRect);
|
||||||
context.DrawGeometry(fg, null, item.Icon);
|
context.DrawRectangle(item.LabelBG, null, labelRect);
|
||||||
|
context.DrawText(item.Label, new Point(x + 20, 8.0 - item.Label.Height * 0.5));
|
||||||
|
|
||||||
if (item.IsHead)
|
using (context.PushTransform(Matrix.CreateTranslation(x + 4, 4)))
|
||||||
{
|
context.DrawGeometry(iconFG, null, item.Icon);
|
||||||
using (context.PushOpacity(.4))
|
|
||||||
context.DrawRectangle(item.Brush, null, entireRect);
|
|
||||||
|
|
||||||
context.DrawText(item.Label, new Point(x + 16, 8.0 - item.Label.Height * 0.5));
|
x += item.Label.Width + 16 + 8 + 4;
|
||||||
context.DrawRectangle(null, new Pen(item.Brush), entireRect);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
var labelRect = new RoundedRect(new Rect(x + 16, 0, item.Label.Width + 8, 16), new CornerRadius(0, 2, 2, 0));
|
|
||||||
using (context.PushOpacity(.2))
|
|
||||||
context.DrawRectangle(item.Brush, null, labelRect);
|
|
||||||
|
|
||||||
context.DrawLine(new Pen(item.Brush), new Point(x + 16, 0), new Point(x + 16, 16));
|
|
||||||
context.DrawText(item.Label, new Point(x + 20, 8.0 - item.Label.Height * 0.5));
|
|
||||||
context.DrawRectangle(null, new Pen(item.Brush), entireRect);
|
|
||||||
}
|
|
||||||
|
|
||||||
x += item.Width + 4;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnDataContextChanged(EventArgs e)
|
|
||||||
{
|
|
||||||
base.OnDataContextChanged(e);
|
|
||||||
InvalidateMeasure();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override Size MeasureOverride(Size availableSize)
|
protected override Size MeasureOverride(Size availableSize)
|
||||||
{
|
{
|
||||||
_items.Clear();
|
_items.Clear();
|
||||||
|
|
||||||
var commit = DataContext as Models.Commit;
|
var refs = Refs;
|
||||||
if (commit == null)
|
|
||||||
return new Size(0, 0);
|
|
||||||
|
|
||||||
var refs = commit.Decorators;
|
|
||||||
if (refs != null && refs.Count > 0)
|
if (refs != null && refs.Count > 0)
|
||||||
{
|
{
|
||||||
var typeface = new Typeface(FontFamily);
|
var typeface = new Typeface(FontFamily);
|
||||||
var typefaceBold = new Typeface(FontFamily, FontStyle.Normal, FontWeight.Bold);
|
var typefaceBold = new Typeface(FontFamily, FontStyle.Normal, FontWeight.Bold);
|
||||||
var fg = Foreground;
|
var labelFG = LabelForeground;
|
||||||
var tagBG = TagBackground;
|
var branchBG = BranchNameBackground;
|
||||||
|
var headBG = HeadBranchNameBackground;
|
||||||
|
var tagBG = TagNameBackground;
|
||||||
var labelSize = FontSize;
|
var labelSize = FontSize;
|
||||||
var requiredWidth = 0.0;
|
var requiredWidth = 0.0;
|
||||||
|
|
||||||
|
@ -137,25 +164,28 @@ namespace SourceGit.Views
|
||||||
CultureInfo.CurrentCulture,
|
CultureInfo.CurrentCulture,
|
||||||
FlowDirection.LeftToRight,
|
FlowDirection.LeftToRight,
|
||||||
isHead ? typefaceBold : typeface,
|
isHead ? typefaceBold : typeface,
|
||||||
isHead ? labelSize + 1 : labelSize,
|
labelSize,
|
||||||
fg);
|
labelFG);
|
||||||
|
|
||||||
var item = new RenderItem() { Label = label, Brush = commit.Brush, IsHead = isHead };
|
var item = new RenderItem() { Label = label };
|
||||||
StreamGeometry geo;
|
StreamGeometry geo;
|
||||||
switch (decorator.Type)
|
switch (decorator.Type)
|
||||||
{
|
{
|
||||||
case Models.DecoratorType.CurrentBranchHead:
|
case Models.DecoratorType.CurrentBranchHead:
|
||||||
case Models.DecoratorType.CurrentCommitHead:
|
case Models.DecoratorType.CurrentCommitHead:
|
||||||
geo = this.FindResource("Icons.Head") as StreamGeometry;
|
item.LabelBG = headBG;
|
||||||
|
geo = this.FindResource("Icons.Check") as StreamGeometry;
|
||||||
break;
|
break;
|
||||||
case Models.DecoratorType.RemoteBranchHead:
|
case Models.DecoratorType.RemoteBranchHead:
|
||||||
|
item.LabelBG = branchBG;
|
||||||
geo = this.FindResource("Icons.Remote") as StreamGeometry;
|
geo = this.FindResource("Icons.Remote") as StreamGeometry;
|
||||||
break;
|
break;
|
||||||
case Models.DecoratorType.Tag:
|
case Models.DecoratorType.Tag:
|
||||||
item.Brush = tagBG;
|
item.LabelBG = tagBG;
|
||||||
geo = this.FindResource("Icons.Tag") as StreamGeometry;
|
geo = this.FindResource("Icons.Tag") as StreamGeometry;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
item.LabelBG = branchBG;
|
||||||
geo = this.FindResource("Icons.Branch") as StreamGeometry;
|
geo = this.FindResource("Icons.Branch") as StreamGeometry;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -163,7 +193,7 @@ namespace SourceGit.Views
|
||||||
var drawGeo = geo!.Clone();
|
var drawGeo = geo!.Clone();
|
||||||
var iconBounds = drawGeo.Bounds;
|
var iconBounds = drawGeo.Bounds;
|
||||||
var translation = Matrix.CreateTranslation(-(Vector)iconBounds.Position);
|
var translation = Matrix.CreateTranslation(-(Vector)iconBounds.Position);
|
||||||
var scale = Math.Min(10.0 / iconBounds.Width, 10.0 / iconBounds.Height);
|
var scale = Math.Min(8.0 / iconBounds.Width, 8.0 / iconBounds.Height);
|
||||||
var transform = translation * Matrix.CreateScale(scale, scale);
|
var transform = translation * Matrix.CreateScale(scale, scale);
|
||||||
if (drawGeo.Transform == null || drawGeo.Transform.Value == Matrix.Identity)
|
if (drawGeo.Transform == null || drawGeo.Transform.Value == Matrix.Identity)
|
||||||
drawGeo.Transform = new MatrixTransform(transform);
|
drawGeo.Transform = new MatrixTransform(transform);
|
||||||
|
@ -171,14 +201,12 @@ namespace SourceGit.Views
|
||||||
drawGeo.Transform = new MatrixTransform(drawGeo.Transform.Value * transform);
|
drawGeo.Transform = new MatrixTransform(drawGeo.Transform.Value * transform);
|
||||||
|
|
||||||
item.Icon = drawGeo;
|
item.Icon = drawGeo;
|
||||||
item.Width = 16 + (isHead ? 0 : 4) + label.Width + 4;
|
|
||||||
_items.Add(item);
|
_items.Add(item);
|
||||||
|
requiredWidth += label.Width + 16 /* icon */ + 8 /* label margin */ + 4 /* item right margin */;
|
||||||
requiredWidth += item.Width + 4;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
InvalidateVisual();
|
InvalidateVisual();
|
||||||
return new Size(requiredWidth + 2, 16);
|
return new Size(requiredWidth, 16);
|
||||||
}
|
}
|
||||||
|
|
||||||
InvalidateVisual();
|
InvalidateVisual();
|
||||||
|
|
|
@ -138,11 +138,16 @@
|
||||||
VerticalAlignment="Center"/>
|
VerticalAlignment="Center"/>
|
||||||
|
|
||||||
<v:CommitRefsPresenter Grid.Column="1"
|
<v:CommitRefsPresenter Grid.Column="1"
|
||||||
TagBackground="{DynamicResource Brush.DecoratorTag}"
|
IconBackground="{DynamicResource Brush.DecoratorIconBG}"
|
||||||
Foreground="{DynamicResource Brush.FG1}"
|
IconForeground="{DynamicResource Brush.DecoratorIcon}"
|
||||||
|
BranchNameBackground="{DynamicResource Brush.DecoratorBranch}"
|
||||||
|
HeadBranchNameBackground="{DynamicResource Brush.DecoratorHead}"
|
||||||
|
TagNameBackground="{DynamicResource Brush.DecoratorTag}"
|
||||||
|
LabelForeground="{DynamicResource Brush.DecoratorFG}"
|
||||||
FontFamily="{DynamicResource Fonts.Primary}"
|
FontFamily="{DynamicResource Fonts.Primary}"
|
||||||
FontSize="11"
|
FontSize="11"
|
||||||
VerticalAlignment="Center"/>
|
VerticalAlignment="Center"
|
||||||
|
Refs="{Binding Decorators}"/>
|
||||||
|
|
||||||
<v:CommitSubjectPresenter Grid.Column="2"
|
<v:CommitSubjectPresenter Grid.Column="2"
|
||||||
Classes="primary"
|
Classes="primary"
|
||||||
|
|
|
@ -74,7 +74,7 @@
|
||||||
HorizontalContentAlignment="Center"
|
HorizontalContentAlignment="Center"
|
||||||
VerticalContentAlignment="Center">
|
VerticalContentAlignment="Center">
|
||||||
<StackPanel Orientation="Horizontal">
|
<StackPanel Orientation="Horizontal">
|
||||||
<Path Width="12" Height="12" Data="{StaticResource Icons.Pull}" Fill="White"/>
|
<Path Width="12" Height="12" Data="{StaticResource Icons.Pull}"/>
|
||||||
<TextBlock Text="{DynamicResource Text.SelfUpdate.GotoDownload}" Margin="8,0,0,0"/>
|
<TextBlock Text="{DynamicResource Text.SelfUpdate.GotoDownload}" Margin="8,0,0,0"/>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</Button>
|
</Button>
|
||||||
|
|
Loading…
Reference in a new issue