Skip to content

Commit 932baee

Browse files
committed
Merge branch 'release/v2025.21'
2 parents 0594196 + 637e133 commit 932baee

File tree

95 files changed

+1359
-693
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

95 files changed

+1359
-693
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ You can find the current translation status in [TRANSLATION.md](https://github.c
5656

5757
**To use this tool, you need to install Git(>=2.25.1) first.**
5858

59-
You can download the latest stable from [Releases](https://github.com/sourcegit-scm/sourcegit/releases/latest) or download workflow artifacts from [Github Actions](https://github.com/sourcegit-scm/sourcegit/actions) to try this app based on latest commits.
59+
You can download the latest stable from [Releases](https://github.com/sourcegit-scm/sourcegit/releases/latest) or download workflow artifacts from [GitHub Actions](https://github.com/sourcegit-scm/sourcegit/actions) to try this app based on latest commits.
6060

6161
This software creates a folder `$"{System.Environment.SpecialFolder.ApplicationData}/SourceGit"`, which is platform-dependent, to store user settings, downloaded avatars and crash logs.
6262

@@ -93,7 +93,7 @@ For **macOS** users:
9393
brew tap ybeapps/homebrew-sourcegit
9494
brew install --cask --no-quarantine sourcegit
9595
```
96-
* If you want to install `SourceGit.app` from Github Release manually, you need run following command to make sure it works:
96+
* If you want to install `SourceGit.app` from GitHub Release manually, you need run following command to make sure it works:
9797
```shell
9898
sudo xattr -cr /Applications/SourceGit.app
9999
```

TRANSLATION.md

Lines changed: 22 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,12 @@ This document shows the translation status of each locale file in the repository
66

77
### ![en_US](https://img.shields.io/badge/en__US-%E2%88%9A-brightgreen)
88

9-
### ![de__DE](https://img.shields.io/badge/de__DE-96.50%25-yellow)
9+
### ![de__DE](https://img.shields.io/badge/de__DE-96.38%25-yellow)
1010

1111
<details>
1212
<summary>Missing keys in de_DE.axaml</summary>
1313

14+
- Text.Avatar.Load
1415
- Text.BranchCM.ResetToSelectedCommit
1516
- Text.CommitDetail.Changes.Count
1617
- Text.CreateBranch.OverwriteExisting
@@ -42,13 +43,21 @@ This document shows the translation status of each locale file in the repository
4243

4344
</details>
4445

45-
### ![es__ES](https://img.shields.io/badge/es__ES-%E2%88%9A-brightgreen)
46+
### ![es__ES](https://img.shields.io/badge/es__ES-99.88%25-yellow)
4647

47-
### ![fr__FR](https://img.shields.io/badge/fr__FR-92.38%25-yellow)
48+
<details>
49+
<summary>Missing keys in es_ES.axaml</summary>
50+
51+
- Text.Avatar.Load
52+
53+
</details>
54+
55+
### ![fr__FR](https://img.shields.io/badge/fr__FR-92.26%25-yellow)
4856

4957
<details>
5058
<summary>Missing keys in fr_FR.axaml</summary>
5159

60+
- Text.Avatar.Load
5261
- Text.Bisect
5362
- Text.Bisect.Abort
5463
- Text.Bisect.Bad
@@ -113,11 +122,12 @@ This document shows the translation status of each locale file in the repository
113122

114123
</details>
115124

116-
### ![it__IT](https://img.shields.io/badge/it__IT-97.75%25-yellow)
125+
### ![it__IT](https://img.shields.io/badge/it__IT-97.63%25-yellow)
117126

118127
<details>
119128
<summary>Missing keys in it_IT.axaml</summary>
120129

130+
- Text.Avatar.Load
121131
- Text.BranchCM.ResetToSelectedCommit
122132
- Text.CommitDetail.Changes.Count
123133
- Text.CreateBranch.OverwriteExisting
@@ -144,6 +154,7 @@ This document shows the translation status of each locale file in the repository
144154
<details>
145155
<summary>Missing keys in ja_JP.axaml</summary>
146156

157+
- Text.Avatar.Load
147158
- Text.Bisect
148159
- Text.Bisect.Abort
149160
- Text.Bisect.Bad
@@ -185,7 +196,6 @@ This document shows the translation status of each locale file in the repository
185196
- Text.Repository.FilterCommits
186197
- Text.Repository.Search.ByContent
187198
- Text.Repository.ShowSubmodulesAsTree
188-
- Text.Repository.Tags.OrderByNameDes
189199
- Text.Repository.ViewLogs
190200
- Text.Repository.Visit
191201
- Text.ResetWithoutCheckout
@@ -222,6 +232,7 @@ This document shows the translation status of each locale file in the repository
222232
- Text.ApplyStash.DropAfterApply
223233
- Text.ApplyStash.RestoreIndex
224234
- Text.ApplyStash.Stash
235+
- Text.Avatar.Load
225236
- Text.Bisect
226237
- Text.Bisect.Abort
227238
- Text.Bisect.Bad
@@ -308,8 +319,7 @@ This document shows the translation status of each locale file in the repository
308319
- Text.Repository.ShowSubmodulesAsTree
309320
- Text.Repository.Skip
310321
- Text.Repository.Tags.OrderByCreatorDate
311-
- Text.Repository.Tags.OrderByNameAsc
312-
- Text.Repository.Tags.OrderByNameDes
322+
- Text.Repository.Tags.OrderByName
313323
- Text.Repository.Tags.Sort
314324
- Text.Repository.UseRelativeTimeInHistories
315325
- Text.Repository.ViewLogs
@@ -347,22 +357,14 @@ This document shows the translation status of each locale file in the repository
347357

348358
</details>
349359

350-
### ![ru__RU](https://img.shields.io/badge/ru__RU-99.63%25-yellow)
351-
352-
<details>
353-
<summary>Missing keys in ru_RU.axaml</summary>
354-
355-
- Text.BranchCM.CompareWithCurrent
356-
- Text.Repository.ClearStashes
357-
- Text.WorkingCopy.ResetAuthor
358-
359-
</details>
360+
### ![ru__RU](https://img.shields.io/badge/ru__RU-%E2%88%9A-brightgreen)
360361

361-
### ![ta__IN](https://img.shields.io/badge/ta__IN-92.26%25-yellow)
362+
### ![ta__IN](https://img.shields.io/badge/ta__IN-92.13%25-yellow)
362363

363364
<details>
364365
<summary>Missing keys in ta_IN.axaml</summary>
365366

367+
- Text.Avatar.Load
366368
- Text.Bisect
367369
- Text.Bisect.Abort
368370
- Text.Bisect.Bad
@@ -428,11 +430,12 @@ This document shows the translation status of each locale file in the repository
428430

429431
</details>
430432

431-
### ![uk__UA](https://img.shields.io/badge/uk__UA-93.51%25-yellow)
433+
### ![uk__UA](https://img.shields.io/badge/uk__UA-93.38%25-yellow)
432434

433435
<details>
434436
<summary>Missing keys in uk_UA.axaml</summary>
435437

438+
- Text.Avatar.Load
436439
- Text.Bisect
437440
- Text.Bisect.Abort
438441
- Text.Bisect.Bad

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2025.20
1+
2025.21

build/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@
1212
dotnet publish -c Release -r $RUNTIME_IDENTIFIER -o $DESTINATION_FOLDER src/SourceGit.csproj
1313
```
1414
> [!NOTE]
15-
> Please replace the `$RUNTIME_IDENTIFIER` with one of `win-x64`,`win-arm64`,`linux-x64`,`linux-arm64`,`osx-x64`,`osx-arm64`, and replece the `$DESTINATION_FOLDER` with the real path that will store the output executable files.
15+
> Please replace the `$RUNTIME_IDENTIFIER` with one of `win-x64`,`win-arm64`,`linux-x64`,`linux-arm64`,`osx-x64`,`osx-arm64`, and replace the `$DESTINATION_FOLDER` with the real path that will store the output executable files.

src/App.axaml.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@ public static IStorageProvider GetStorageProvider()
338338
return null;
339339
}
340340

341-
public static ViewModels.Launcher GetLauncer()
341+
public static ViewModels.Launcher GetLauncher()
342342
{
343343
return Current is App app ? app._launcher : null;
344344
}

src/App.manifest

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
33
<!-- This manifest is used on Windows only.
4-
Don't remove it as it might cause problems with window transparency and embeded controls.
4+
Don't remove it as it might cause problems with window transparency and embedded controls.
55
For more details visit https://learn.microsoft.com/en-us/windows/win32/sbscs/application-manifests -->
66
<assemblyIdentity version="1.0.0.0" name="SourceGit.Desktop"/>
77

src/Commands/Blame.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ private void ParseLine(string line)
8989

9090
private readonly Models.BlameData _result = new Models.BlameData();
9191
private readonly StringBuilder _content = new StringBuilder();
92-
private readonly string _dateFormat = Models.DateTimeFormat.Actived.DateOnly;
92+
private readonly string _dateFormat = Models.DateTimeFormat.Active.DateOnly;
9393
private string _lastSHA = string.Empty;
9494
private bool _needUnifyCommitSHA = false;
9595
private int _minSHALen = 64;

src/Commands/MergeTool.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public static bool OpenForMerge(string repo, int toolType, string toolPath, stri
2424

2525
if (!File.Exists(toolPath))
2626
{
27-
Dispatcher.UIThread.Post(() => App.RaiseException(repo, $"Can NOT found external merge tool in '{toolPath}'!"));
27+
Dispatcher.UIThread.Post(() => App.RaiseException(repo, $"Can NOT find external merge tool in '{toolPath}'!"));
2828
return false;
2929
}
3030

@@ -54,7 +54,7 @@ public static bool OpenForDiff(string repo, int toolType, string toolPath, Model
5454

5555
if (!File.Exists(toolPath))
5656
{
57-
Dispatcher.UIThread.Invoke(() => App.RaiseException(repo, $"Can NOT found external diff tool in '{toolPath}'!"));
57+
Dispatcher.UIThread.Invoke(() => App.RaiseException(repo, $"Can NOT find external diff tool in '{toolPath}'!"));
5858
return false;
5959
}
6060

src/Commands/QueryFileContent.cs

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,5 +35,39 @@ public static Stream Run(string repo, string revision, string file)
3535

3636
return stream;
3737
}
38+
39+
public static Stream FromLFS(string repo, string oid, long size)
40+
{
41+
var starter = new ProcessStartInfo();
42+
starter.WorkingDirectory = repo;
43+
starter.FileName = Native.OS.GitExecutable;
44+
starter.Arguments = $"lfs smudge";
45+
starter.UseShellExecute = false;
46+
starter.CreateNoWindow = true;
47+
starter.WindowStyle = ProcessWindowStyle.Hidden;
48+
starter.RedirectStandardInput = true;
49+
starter.RedirectStandardOutput = true;
50+
51+
var stream = new MemoryStream();
52+
try
53+
{
54+
var proc = new Process() { StartInfo = starter };
55+
proc.Start();
56+
proc.StandardInput.WriteLine("version https://git-lfs.github.com/spec/v1");
57+
proc.StandardInput.WriteLine($"oid sha256:{oid}");
58+
proc.StandardInput.WriteLine($"size {size}");
59+
proc.StandardOutput.BaseStream.CopyTo(stream);
60+
proc.WaitForExit();
61+
proc.Close();
62+
63+
stream.Position = 0;
64+
}
65+
catch (Exception e)
66+
{
67+
App.RaiseException(repo, $"Failed to query file content: {e}");
68+
}
69+
70+
return stream;
71+
}
3872
}
3973
}

src/Commands/SaveRevisionFile.cs

Lines changed: 5 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -13,20 +13,16 @@ public static void Run(string repo, string revision, string file, string saveTo)
1313
var isLFSFiltered = new IsLFSFiltered(repo, revision, file).Result();
1414
if (isLFSFiltered)
1515
{
16-
var tmpFile = saveTo + ".tmp";
17-
if (ExecCmd(repo, $"show {revision}:\"{file}\"", tmpFile))
18-
{
19-
ExecCmd(repo, $"lfs smudge", saveTo, tmpFile);
20-
}
21-
File.Delete(tmpFile);
16+
var pointerStream = QueryFileContent.Run(repo, revision, file);
17+
ExecCmd(repo, $"lfs smudge", saveTo, pointerStream);
2218
}
2319
else
2420
{
2521
ExecCmd(repo, $"show {revision}:\"{file}\"", saveTo);
2622
}
2723
}
2824

29-
private static bool ExecCmd(string repo, string args, string outputFile, string inputFile = null)
25+
private static bool ExecCmd(string repo, string args, string outputFile, Stream input = null)
3026
{
3127
var starter = new ProcessStartInfo();
3228
starter.WorkingDirectory = repo;
@@ -45,21 +41,8 @@ private static bool ExecCmd(string repo, string args, string outputFile, string
4541
{
4642
var proc = new Process() { StartInfo = starter };
4743
proc.Start();
48-
49-
if (inputFile != null)
50-
{
51-
using (StreamReader sr = new StreamReader(inputFile))
52-
{
53-
while (true)
54-
{
55-
var line = sr.ReadLine();
56-
if (line == null)
57-
break;
58-
proc.StandardInput.WriteLine(line);
59-
}
60-
}
61-
}
62-
44+
if (input != null)
45+
proc.StandardInput.Write(new StreamReader(input).ReadToEnd());
6346
proc.StandardOutput.BaseStream.CopyTo(sw);
6447
proc.WaitForExit();
6548
var rs = proc.ExitCode == 0;

src/Converters/ObjectConverters.cs

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
using System;
2+
using System.Globalization;
3+
using Avalonia.Data.Converters;
4+
5+
namespace SourceGit.Converters
6+
{
7+
public static class ObjectConverters
8+
{
9+
public class IsTypeOfConverter : IValueConverter
10+
{
11+
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
12+
{
13+
if (value == null || parameter == null)
14+
return false;
15+
16+
return value.GetType().IsAssignableTo((Type)parameter);
17+
}
18+
19+
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
20+
{
21+
return new NotImplementedException();
22+
}
23+
}
24+
25+
public static readonly IsTypeOfConverter IsTypeOf = new IsTypeOfConverter();
26+
}
27+
}

src/Models/AvatarManager.cs

Lines changed: 36 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ namespace SourceGit.Models
1717
{
1818
public interface IAvatarHost
1919
{
20-
void OnAvatarResourceChanged(string email);
20+
void OnAvatarResourceChanged(string email, Bitmap image);
2121
}
2222

2323
public partial class AvatarManager
@@ -119,7 +119,7 @@ public void Start()
119119
Dispatcher.UIThread.InvokeAsync(() =>
120120
{
121121
_resources[email] = img;
122-
NotifyResourceChanged(email);
122+
NotifyResourceChanged(email, img);
123123
});
124124
}
125125

@@ -151,7 +151,7 @@ public Bitmap Request(string email, bool forceRefetch)
151151
if (File.Exists(localFile))
152152
File.Delete(localFile);
153153

154-
NotifyResourceChanged(email);
154+
NotifyResourceChanged(email, null);
155155
}
156156
else
157157
{
@@ -186,6 +186,37 @@ public Bitmap Request(string email, bool forceRefetch)
186186
return null;
187187
}
188188

189+
public void SetFromLocal(string email, string file)
190+
{
191+
try
192+
{
193+
Bitmap image = null;
194+
195+
using (var stream = File.OpenRead(file))
196+
{
197+
image = Bitmap.DecodeToWidth(stream, 128);
198+
}
199+
200+
if (image == null)
201+
return;
202+
203+
if (_resources.ContainsKey(email))
204+
_resources[email] = image;
205+
else
206+
_resources.Add(email, image);
207+
208+
_requesting.Remove(email);
209+
210+
var store = Path.Combine(_storePath, GetEmailHash(email));
211+
File.Copy(file, store, true);
212+
NotifyResourceChanged(email, image);
213+
}
214+
catch
215+
{
216+
// ignore
217+
}
218+
}
219+
189220
private void LoadDefaultAvatar(string key, string img)
190221
{
191222
var icon = AssetLoader.Open(new Uri($"avares://SourceGit/Resources/Images/{img}", UriKind.RelativeOrAbsolute));
@@ -203,12 +234,10 @@ private string GetEmailHash(string email)
203234
return builder.ToString();
204235
}
205236

206-
private void NotifyResourceChanged(string email)
237+
private void NotifyResourceChanged(string email, Bitmap image)
207238
{
208239
foreach (var avatar in _avatars)
209-
{
210-
avatar.OnAvatarResourceChanged(email);
211-
}
240+
avatar.OnAvatarResourceChanged(email, image);
212241
}
213242
}
214243
}

0 commit comments

Comments
 (0)