mirror of
https://github.com/sourcegit-scm/sourcegit.git
synced 2024-12-25 21:07:20 -08:00
Compare commits
6 commits
1c345df37d
...
7526def448
Author | SHA1 | Date | |
---|---|---|---|
|
7526def448 | ||
|
e4fb9eeb52 | ||
|
cb3727b524 | ||
|
39dff8a93f | ||
|
23326d179a | ||
|
6768a2c1fe |
8 changed files with 38 additions and 11 deletions
|
@ -35,7 +35,7 @@ namespace SourceGit.Models
|
|||
|
||||
private static AvatarManager _instance = null;
|
||||
|
||||
[GeneratedRegex(@"^(?:(\d+)\+)?(.+?)@users\.noreply\.github\.com$")]
|
||||
[GeneratedRegex(@"^(?:(\d+)\+)?(.+?)@.+\.github\.com$")]
|
||||
private static partial Regex REG_GITHUB_USER_EMAIL();
|
||||
|
||||
private object _synclock = new object();
|
||||
|
@ -43,6 +43,7 @@ namespace SourceGit.Models
|
|||
private List<IAvatarHost> _avatars = new List<IAvatarHost>();
|
||||
private Dictionary<string, Bitmap> _resources = new Dictionary<string, Bitmap>();
|
||||
private HashSet<string> _requesting = new HashSet<string>();
|
||||
private HashSet<string> _defaultAvatars = new HashSet<string>();
|
||||
|
||||
public void Start()
|
||||
{
|
||||
|
@ -50,8 +51,8 @@ namespace SourceGit.Models
|
|||
if (!Directory.Exists(_storePath))
|
||||
Directory.CreateDirectory(_storePath);
|
||||
|
||||
var icon = AssetLoader.Open(new Uri($"avares://SourceGit/Resources/Images/github.png", UriKind.RelativeOrAbsolute));
|
||||
_resources.Add("noreply@github.com", new Bitmap(icon));
|
||||
LoadDefaultAvatar("noreply@github.com", "github.png");
|
||||
LoadDefaultAvatar("unrealbot@epicgames.com", "unreal.png");
|
||||
|
||||
Task.Run(() =>
|
||||
{
|
||||
|
@ -140,7 +141,7 @@ namespace SourceGit.Models
|
|||
{
|
||||
if (forceRefetch)
|
||||
{
|
||||
if (email.Equals("noreply@github.com", StringComparison.Ordinal))
|
||||
if (_defaultAvatars.Contains(email))
|
||||
return null;
|
||||
|
||||
if (_resources.ContainsKey(email))
|
||||
|
@ -185,6 +186,13 @@ namespace SourceGit.Models
|
|||
return null;
|
||||
}
|
||||
|
||||
private void LoadDefaultAvatar(string key, string img)
|
||||
{
|
||||
var icon = AssetLoader.Open(new Uri($"avares://SourceGit/Resources/Images/{img}", UriKind.RelativeOrAbsolute));
|
||||
_resources.Add(key, new Bitmap(icon));
|
||||
_defaultAvatars.Add(key);
|
||||
}
|
||||
|
||||
private string GetEmailHash(string email)
|
||||
{
|
||||
var lowered = email.ToLower(CultureInfo.CurrentCulture).Trim();
|
||||
|
|
|
@ -26,6 +26,12 @@ namespace SourceGit.Models
|
|||
set;
|
||||
} = false;
|
||||
|
||||
public bool EnableForceOnFetch
|
||||
{
|
||||
get;
|
||||
set;
|
||||
} = false;
|
||||
|
||||
public bool FetchWithoutTags
|
||||
{
|
||||
get;
|
||||
|
|
BIN
src/Resources/Images/unreal.png
Normal file
BIN
src/Resources/Images/unreal.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 16 KiB |
|
@ -4,6 +4,7 @@
|
|||
xmlns:vm="using:SourceGit.ViewModels"
|
||||
xmlns:c="using:SourceGit.Converters"
|
||||
xmlns:ae="using:AvaloniaEdit"
|
||||
xmlns:aee="using:AvaloniaEdit.Editing"
|
||||
xmlns:aes="using:AvaloniaEdit.Search">
|
||||
<Design.PreviewWith>
|
||||
<StackPanel Orientation="Vertical">
|
||||
|
@ -580,6 +581,19 @@
|
|||
</Style>
|
||||
</Style>
|
||||
|
||||
<Style Selector="aee|TextArea">
|
||||
<Setter Property="SelectionBorder">
|
||||
<Setter.Value>
|
||||
<Pen Brush="{DynamicResource SystemAccentColor}" Thickness="1" />
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
<Setter Property="SelectionBrush">
|
||||
<Setter.Value>
|
||||
<SolidColorBrush Opacity="0.5" Color="{DynamicResource SystemAccentColor}" />
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<Style Selector="aes|SearchPanel">
|
||||
<Setter Property="Template">
|
||||
<ControlTemplate TargetType="aes:SearchPanel">
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
<RepositoryType>Public</RepositoryType>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)' == 'Release' and '$(SourceGitNoAot)' != 'true'">
|
||||
<PropertyGroup Condition="'$(DisableAOT)' != 'true'">
|
||||
<PublishAot>true</PublishAot>
|
||||
<PublishTrimmed>true</PublishTrimmed>
|
||||
<TrimMode>link</TrimMode>
|
||||
|
|
|
@ -30,15 +30,14 @@ namespace SourceGit.ViewModels
|
|||
|
||||
public bool Force
|
||||
{
|
||||
get;
|
||||
set;
|
||||
get => _repo.Settings.EnableForceOnFetch;
|
||||
set => _repo.Settings.EnableForceOnFetch = value;
|
||||
}
|
||||
|
||||
public Fetch(Repository repo, Models.Remote preferedRemote = null)
|
||||
{
|
||||
_repo = repo;
|
||||
_fetchAllRemotes = preferedRemote == null;
|
||||
Force = false;
|
||||
SelectedRemote = preferedRemote != null ? preferedRemote : _repo.Remotes[0];
|
||||
View = new Views.Fetch() { DataContext = this };
|
||||
}
|
||||
|
@ -49,7 +48,7 @@ namespace SourceGit.ViewModels
|
|||
|
||||
var notags = _repo.Settings.FetchWithoutTags;
|
||||
var prune = _repo.Settings.EnablePruneOnFetch;
|
||||
var force = Force;
|
||||
var force = _repo.Settings.EnableForceOnFetch;
|
||||
return Task.Run(() =>
|
||||
{
|
||||
if (FetchAllRemotes)
|
||||
|
|
|
@ -15,7 +15,7 @@ namespace SourceGit.Views
|
|||
{
|
||||
public partial class CommitMessagePresenter : SelectableTextBlock
|
||||
{
|
||||
[GeneratedRegex(@"\b([0-9a-fA-F]{8,40})\b")]
|
||||
[GeneratedRegex(@"\b([0-9a-fA-F]{10,40})\b")]
|
||||
private static partial Regex REG_SHA_FORMAT();
|
||||
|
||||
public static readonly StyledProperty<string> MessageProperty =
|
||||
|
|
|
@ -125,7 +125,7 @@
|
|||
</Button>
|
||||
</Grid>
|
||||
|
||||
<Border Grid.Row="1" Margin="8" Background="{DynamicResource Brush.Contents}" BorderThickness="1" BorderBrush="{DynamicResource Brush.Border2}">
|
||||
<Border Grid.Row="1" Margin="8" Background="Transparent">
|
||||
<ScrollViewer MaxHeight="200" HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto">
|
||||
<TextBlock Margin="4,2" TextWrapping="NoWrap" Text="{Binding Message}"/>
|
||||
</ScrollViewer>
|
||||
|
|
Loading…
Reference in a new issue