mirror of
https://github.com/sourcegit-scm/sourcegit.git
synced 2024-12-24 20:57:19 -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;
|
private static AvatarManager _instance = null;
|
||||||
|
|
||||||
[GeneratedRegex(@"^(?:(\d+)\+)?(.+?)@users\.noreply\.github\.com$")]
|
[GeneratedRegex(@"^(?:(\d+)\+)?(.+?)@.+\.github\.com$")]
|
||||||
private static partial Regex REG_GITHUB_USER_EMAIL();
|
private static partial Regex REG_GITHUB_USER_EMAIL();
|
||||||
|
|
||||||
private object _synclock = new object();
|
private object _synclock = new object();
|
||||||
|
@ -43,6 +43,7 @@ namespace SourceGit.Models
|
||||||
private List<IAvatarHost> _avatars = new List<IAvatarHost>();
|
private List<IAvatarHost> _avatars = new List<IAvatarHost>();
|
||||||
private Dictionary<string, Bitmap> _resources = new Dictionary<string, Bitmap>();
|
private Dictionary<string, Bitmap> _resources = new Dictionary<string, Bitmap>();
|
||||||
private HashSet<string> _requesting = new HashSet<string>();
|
private HashSet<string> _requesting = new HashSet<string>();
|
||||||
|
private HashSet<string> _defaultAvatars = new HashSet<string>();
|
||||||
|
|
||||||
public void Start()
|
public void Start()
|
||||||
{
|
{
|
||||||
|
@ -50,8 +51,8 @@ namespace SourceGit.Models
|
||||||
if (!Directory.Exists(_storePath))
|
if (!Directory.Exists(_storePath))
|
||||||
Directory.CreateDirectory(_storePath);
|
Directory.CreateDirectory(_storePath);
|
||||||
|
|
||||||
var icon = AssetLoader.Open(new Uri($"avares://SourceGit/Resources/Images/github.png", UriKind.RelativeOrAbsolute));
|
LoadDefaultAvatar("noreply@github.com", "github.png");
|
||||||
_resources.Add("noreply@github.com", new Bitmap(icon));
|
LoadDefaultAvatar("unrealbot@epicgames.com", "unreal.png");
|
||||||
|
|
||||||
Task.Run(() =>
|
Task.Run(() =>
|
||||||
{
|
{
|
||||||
|
@ -140,7 +141,7 @@ namespace SourceGit.Models
|
||||||
{
|
{
|
||||||
if (forceRefetch)
|
if (forceRefetch)
|
||||||
{
|
{
|
||||||
if (email.Equals("noreply@github.com", StringComparison.Ordinal))
|
if (_defaultAvatars.Contains(email))
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
if (_resources.ContainsKey(email))
|
if (_resources.ContainsKey(email))
|
||||||
|
@ -185,6 +186,13 @@ namespace SourceGit.Models
|
||||||
return null;
|
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)
|
private string GetEmailHash(string email)
|
||||||
{
|
{
|
||||||
var lowered = email.ToLower(CultureInfo.CurrentCulture).Trim();
|
var lowered = email.ToLower(CultureInfo.CurrentCulture).Trim();
|
||||||
|
|
|
@ -26,6 +26,12 @@ namespace SourceGit.Models
|
||||||
set;
|
set;
|
||||||
} = false;
|
} = false;
|
||||||
|
|
||||||
|
public bool EnableForceOnFetch
|
||||||
|
{
|
||||||
|
get;
|
||||||
|
set;
|
||||||
|
} = false;
|
||||||
|
|
||||||
public bool FetchWithoutTags
|
public bool FetchWithoutTags
|
||||||
{
|
{
|
||||||
get;
|
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:vm="using:SourceGit.ViewModels"
|
||||||
xmlns:c="using:SourceGit.Converters"
|
xmlns:c="using:SourceGit.Converters"
|
||||||
xmlns:ae="using:AvaloniaEdit"
|
xmlns:ae="using:AvaloniaEdit"
|
||||||
|
xmlns:aee="using:AvaloniaEdit.Editing"
|
||||||
xmlns:aes="using:AvaloniaEdit.Search">
|
xmlns:aes="using:AvaloniaEdit.Search">
|
||||||
<Design.PreviewWith>
|
<Design.PreviewWith>
|
||||||
<StackPanel Orientation="Vertical">
|
<StackPanel Orientation="Vertical">
|
||||||
|
@ -580,6 +581,19 @@
|
||||||
</Style>
|
</Style>
|
||||||
</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">
|
<Style Selector="aes|SearchPanel">
|
||||||
<Setter Property="Template">
|
<Setter Property="Template">
|
||||||
<ControlTemplate TargetType="aes:SearchPanel">
|
<ControlTemplate TargetType="aes:SearchPanel">
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
<RepositoryType>Public</RepositoryType>
|
<RepositoryType>Public</RepositoryType>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<PropertyGroup Condition="'$(Configuration)' == 'Release' and '$(SourceGitNoAot)' != 'true'">
|
<PropertyGroup Condition="'$(DisableAOT)' != 'true'">
|
||||||
<PublishAot>true</PublishAot>
|
<PublishAot>true</PublishAot>
|
||||||
<PublishTrimmed>true</PublishTrimmed>
|
<PublishTrimmed>true</PublishTrimmed>
|
||||||
<TrimMode>link</TrimMode>
|
<TrimMode>link</TrimMode>
|
||||||
|
|
|
@ -30,15 +30,14 @@ namespace SourceGit.ViewModels
|
||||||
|
|
||||||
public bool Force
|
public bool Force
|
||||||
{
|
{
|
||||||
get;
|
get => _repo.Settings.EnableForceOnFetch;
|
||||||
set;
|
set => _repo.Settings.EnableForceOnFetch = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Fetch(Repository repo, Models.Remote preferedRemote = null)
|
public Fetch(Repository repo, Models.Remote preferedRemote = null)
|
||||||
{
|
{
|
||||||
_repo = repo;
|
_repo = repo;
|
||||||
_fetchAllRemotes = preferedRemote == null;
|
_fetchAllRemotes = preferedRemote == null;
|
||||||
Force = false;
|
|
||||||
SelectedRemote = preferedRemote != null ? preferedRemote : _repo.Remotes[0];
|
SelectedRemote = preferedRemote != null ? preferedRemote : _repo.Remotes[0];
|
||||||
View = new Views.Fetch() { DataContext = this };
|
View = new Views.Fetch() { DataContext = this };
|
||||||
}
|
}
|
||||||
|
@ -49,7 +48,7 @@ namespace SourceGit.ViewModels
|
||||||
|
|
||||||
var notags = _repo.Settings.FetchWithoutTags;
|
var notags = _repo.Settings.FetchWithoutTags;
|
||||||
var prune = _repo.Settings.EnablePruneOnFetch;
|
var prune = _repo.Settings.EnablePruneOnFetch;
|
||||||
var force = Force;
|
var force = _repo.Settings.EnableForceOnFetch;
|
||||||
return Task.Run(() =>
|
return Task.Run(() =>
|
||||||
{
|
{
|
||||||
if (FetchAllRemotes)
|
if (FetchAllRemotes)
|
||||||
|
|
|
@ -15,7 +15,7 @@ namespace SourceGit.Views
|
||||||
{
|
{
|
||||||
public partial class CommitMessagePresenter : SelectableTextBlock
|
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();
|
private static partial Regex REG_SHA_FORMAT();
|
||||||
|
|
||||||
public static readonly StyledProperty<string> MessageProperty =
|
public static readonly StyledProperty<string> MessageProperty =
|
||||||
|
|
|
@ -125,7 +125,7 @@
|
||||||
</Button>
|
</Button>
|
||||||
</Grid>
|
</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">
|
<ScrollViewer MaxHeight="200" HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto">
|
||||||
<TextBlock Margin="4,2" TextWrapping="NoWrap" Text="{Binding Message}"/>
|
<TextBlock Margin="4,2" TextWrapping="NoWrap" Text="{Binding Message}"/>
|
||||||
</ScrollViewer>
|
</ScrollViewer>
|
||||||
|
|
Loading…
Reference in a new issue