mirror of
https://github.com/sourcegit-scm/sourcegit.git
synced 2025-01-23 01:36:57 -08:00
Display lines changed
This commit is contained in:
parent
399bd2f12b
commit
ac57c930cb
6 changed files with 32 additions and 73 deletions
|
@ -31,8 +31,10 @@ namespace SourceGit.Commands
|
|||
|
||||
if (parts.Length >= 2)
|
||||
{
|
||||
_addedLines += int.Parse(parts[0]);
|
||||
_removedLines += int.Parse(parts[1]);
|
||||
bool canParseAdded = int.TryParse(parts[0], out int addedLines);
|
||||
bool canParseRemoved = int.TryParse(parts[1], out int removedLines);
|
||||
if (canParseAdded) _addedLines += addedLines;
|
||||
if (canParseRemoved) _removedLines += removedLines;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -45,6 +45,9 @@ namespace SourceGit.Models
|
|||
public Thickness Margin { get; set; } = new Thickness(0);
|
||||
public IBrush Brush => CommitGraph.Pens[Color].Brush;
|
||||
|
||||
public int AddedLines { get; set; } = 0;
|
||||
public int RemovedLines { get; set; } = 0;
|
||||
|
||||
public void ParseDecorators(string data)
|
||||
{
|
||||
if (data.Length < 3)
|
||||
|
|
|
@ -637,9 +637,11 @@ namespace SourceGit.ViewModels
|
|||
|
||||
Task.Run(() =>
|
||||
{
|
||||
var lines = new Commands.QueryCommitChangedLines(_repo.FullPath, _commit.SHA).Result();
|
||||
Console.WriteLine(lines);
|
||||
//Dispatcher.UIThread.Invoke(() => FullMessage = fullMessage);
|
||||
(var addedLines, var removedLines) = new Commands.QueryCommitChangedLines(_repo.FullPath, _commit.SHA).Result();
|
||||
Dispatcher.UIThread.Invoke(() => {
|
||||
_commit.AddedLines = addedLines;
|
||||
_commit.RemovedLines = removedLines;
|
||||
});
|
||||
});
|
||||
|
||||
Task.Run(() =>
|
||||
|
|
|
@ -184,7 +184,26 @@
|
|||
|
||||
<!-- Stats -->
|
||||
<TextBlock Grid.Row="4" Grid.Column="0" Classes="info_label" VerticalAlignment="Top" Margin="0,4,0,0" Text="{DynamicResource Text.CommitDetail.Info.Stats}" />
|
||||
<v:LinesChanged Grid.Row="4" Grid.Column="1" AddedLines="0" RemovedLines="0" />
|
||||
<!--v:LinesChanged Grid.Row="4" Grid.Column="1" AddedCount="{Binding AddedLines}" RemovedCount="{Binding RemovedLines}" /-->
|
||||
<StackPanel Grid.Row="4" Grid.Column="1" Orientation="Horizontal" Height="24">
|
||||
<Border Margin="12,0,4,0" VerticalAlignment="Center" BorderBrush="Green" BorderThickness="1" CornerRadius="6">
|
||||
<TextBlock VerticalAlignment="Center" Foreground="Green" Padding="3,0">
|
||||
<TextBlock.Inlines>
|
||||
<Run Text="+"/>
|
||||
<Run Text="{Binding AddedLines}"/>
|
||||
</TextBlock.Inlines>
|
||||
</TextBlock>
|
||||
</Border>
|
||||
|
||||
<Border Margin="12,0,4,0" VerticalAlignment="Center" BorderBrush="Red" BorderThickness="1" CornerRadius="6">
|
||||
<TextBlock VerticalAlignment="Center" Foreground="Red" Padding="3,0">
|
||||
<TextBlock.Inlines>
|
||||
<Run Text="-"/>
|
||||
<Run Text="{Binding RemovedLines}"/>
|
||||
</TextBlock.Inlines>
|
||||
</TextBlock>
|
||||
</Border>
|
||||
</StackPanel>
|
||||
|
||||
<!-- Messages -->
|
||||
<TextBlock Grid.Row="5" Grid.Column="0" Classes="info_label" VerticalAlignment="Top" Margin="0,4,0,0" Text="{DynamicResource Text.CommitDetail.Info.Message}" />
|
||||
|
|
|
@ -1,26 +0,0 @@
|
|||
<UserControl xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="using:SourceGit.Views"
|
||||
x:Class="SourceGit.Views.LinesChanged"
|
||||
x:Name="ThisControl"
|
||||
x:DataType="local:LinesChanged">
|
||||
<StackPanel Orientation="Horizontal" Height="24">
|
||||
<Border Margin="12,0,4,0" VerticalAlignment="Center" BorderBrush="Green" BorderThickness="1" CornerRadius="6">
|
||||
<TextBlock VerticalAlignment="Center" Foreground="Green" Padding="3,0">
|
||||
<TextBlock.Inlines>
|
||||
<Run Text="+"/>
|
||||
<Run Text="{Binding AddedLines}"/>
|
||||
</TextBlock.Inlines>
|
||||
</TextBlock>
|
||||
</Border>
|
||||
|
||||
<Border Margin="12,0,4,0" VerticalAlignment="Center" BorderBrush="Red" BorderThickness="1" CornerRadius="6">
|
||||
<TextBlock VerticalAlignment="Center" Foreground="Red" Padding="3,0">
|
||||
<TextBlock.Inlines>
|
||||
<Run Text="-"/>
|
||||
<Run Text="{Binding RemovedLines}"/>
|
||||
</TextBlock.Inlines>
|
||||
</TextBlock>
|
||||
</Border>
|
||||
</StackPanel>
|
||||
</UserControl>
|
|
@ -1,41 +0,0 @@
|
|||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Markup.Xaml;
|
||||
|
||||
namespace SourceGit.Views
|
||||
{
|
||||
public partial class LinesChanged : UserControl
|
||||
{
|
||||
public static readonly DirectProperty<LinesChanged, int> AddedLinesProperty =
|
||||
AvaloniaProperty.RegisterDirect<LinesChanged, int>(nameof(AddedLines), o => o.AddedLines);
|
||||
|
||||
public static readonly DirectProperty<LinesChanged, int> RemovedLinesProperty =
|
||||
AvaloniaProperty.RegisterDirect<LinesChanged, int>(nameof(RemovedLines), o => o.RemovedLines);
|
||||
|
||||
private int _addedLines;
|
||||
private int _removedLines;
|
||||
|
||||
public int AddedLines
|
||||
{
|
||||
get => _addedLines;
|
||||
set => SetAndRaise(AddedLinesProperty, ref _addedLines, value);
|
||||
}
|
||||
|
||||
public int RemovedLines
|
||||
{
|
||||
get => _removedLines;
|
||||
set => SetAndRaise(RemovedLinesProperty, ref _removedLines, value);
|
||||
}
|
||||
|
||||
public LinesChanged()
|
||||
{
|
||||
InitializeComponent();
|
||||
this.DataContext = this;
|
||||
}
|
||||
|
||||
private void InitializeComponent()
|
||||
{
|
||||
AvaloniaXamlLoader.Load(this);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue