Revert "feature: add children list to the commit base info view"

This reverts commit 7ba35e1973.
This commit is contained in:
Dmitrij D. Czarkoff 2024-11-10 17:30:08 +01:00
parent 7ba35e1973
commit 1202230001
No known key found for this signature in database
5 changed files with 8 additions and 40 deletions

View file

@ -104,14 +104,6 @@ namespace SourceGit.Commands
if (_findFirstMerged && !_isHeadFounded && _commits.Count > 0) if (_findFirstMerged && !_isHeadFounded && _commits.Count > 0)
MarkFirstMerged(); MarkFirstMerged();
foreach (var commit in _commits)
{
foreach (var parent in _commits.FindAll(c => commit.Parents.Contains(c.SHA)))
{
parent.Children.Add(commit.SHA);
}
}
return _commits; return _commits;
} }

View file

@ -28,7 +28,6 @@ namespace SourceGit.Models
public ulong CommitterTime { get; set; } = 0; public ulong CommitterTime { get; set; } = 0;
public string Subject { get; set; } = string.Empty; public string Subject { get; set; } = string.Empty;
public List<string> Parents { get; set; } = new List<string>(); public List<string> Parents { get; set; } = new List<string>();
public List<string> Children { get; set; } = new List<string>();
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;

View file

@ -125,7 +125,6 @@
<x:String x:Key="Text.CommitDetail.Info" xml:space="preserve">INFORMATION</x:String> <x:String x:Key="Text.CommitDetail.Info" xml:space="preserve">INFORMATION</x:String>
<x:String x:Key="Text.CommitDetail.Info.Author" xml:space="preserve">AUTHOR</x:String> <x:String x:Key="Text.CommitDetail.Info.Author" xml:space="preserve">AUTHOR</x:String>
<x:String x:Key="Text.CommitDetail.Info.Changed" xml:space="preserve">CHANGED</x:String> <x:String x:Key="Text.CommitDetail.Info.Changed" xml:space="preserve">CHANGED</x:String>
<x:String x:Key="Text.CommitDetail.Info.Children" xml:space="preserve">CHILDREN</x:String>
<x:String x:Key="Text.CommitDetail.Info.Committer" xml:space="preserve">COMMITTER</x:String> <x:String x:Key="Text.CommitDetail.Info.Committer" xml:space="preserve">COMMITTER</x:String>
<x:String x:Key="Text.CommitDetail.Info.ContainsIn" xml:space="preserve">Check refs that contains this commit</x:String> <x:String x:Key="Text.CommitDetail.Info.ContainsIn" xml:space="preserve">Check refs that contains this commit</x:String>
<x:String x:Key="Text.CommitDetail.Info.ContainsIn.Title" xml:space="preserve">COMMIT IS CONTAINED BY</x:String> <x:String x:Key="Text.CommitDetail.Info.ContainsIn.Title" xml:space="preserve">COMMIT IS CONTAINED BY</x:String>

View file

@ -51,7 +51,7 @@
<Rectangle Height=".65" Margin="8" Fill="{DynamicResource Brush.Border2}" VerticalAlignment="Center"/> <Rectangle Height=".65" Margin="8" Fill="{DynamicResource Brush.Border2}" VerticalAlignment="Center"/>
<!-- Base Information --> <!-- Base Information -->
<Grid RowDefinitions="24,Auto,Auto,Auto,Auto" ColumnDefinitions="96,*"> <Grid RowDefinitions="24,Auto,Auto,Auto" ColumnDefinitions="96,*">
<!-- SHA --> <!-- SHA -->
<TextBlock Grid.Row="0" Grid.Column="0" Classes="info_label" Text="{DynamicResource Text.CommitDetail.Info.SHA}" /> <TextBlock Grid.Row="0" Grid.Column="0" Classes="info_label" Text="{DynamicResource Text.CommitDetail.Info.SHA}" />
<StackPanel Grid.Row="0" Grid.Column="1" Orientation="Horizontal"> <StackPanel Grid.Row="0" Grid.Column="1" Orientation="Horizontal">
@ -101,7 +101,7 @@
</StackPanel> </StackPanel>
<!-- PARENTS --> <!-- PARENTS -->
<TextBlock Grid.Row="1" Grid.Column="0" Classes="info_label" Text="{DynamicResource Text.CommitDetail.Info.Parents}"/> <TextBlock Grid.Row="1" Grid.Column="0" Classes="info_label" Text="{DynamicResource Text.CommitDetail.Info.Parents}" IsVisible="{Binding Parents.Count, Converter={x:Static c:IntConverters.IsGreaterThanZero}}"/>
<ItemsControl Grid.Row="1" Grid.Column="1" Height="24" Margin="12,0,0,0" ItemsSource="{Binding Parents}" IsVisible="{Binding Parents.Count, Converter={x:Static c:IntConverters.IsGreaterThanZero}}"> <ItemsControl Grid.Row="1" Grid.Column="1" Height="24" Margin="12,0,0,0" ItemsSource="{Binding Parents}" IsVisible="{Binding Parents.Count, Converter={x:Static c:IntConverters.IsGreaterThanZero}}">
<ItemsControl.ItemsPanel> <ItemsControl.ItemsPanel>
<ItemsPanelTemplate> <ItemsPanelTemplate>
@ -117,36 +117,14 @@
TextDecorations="Underline" TextDecorations="Underline"
Cursor="Hand" Cursor="Hand"
Margin="0,0,16,0" Margin="0,0,16,0"
PointerPressed="OnSHAPressed"/> PointerPressed="OnParentSHAPressed"/>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
<!-- CHILDREN -->
<TextBlock Grid.Row="2" Grid.Column="0" Classes="info_label" Text="{DynamicResource Text.CommitDetail.Info.Children}"/>
<ItemsControl Grid.Row="2" Grid.Column="1" Height="24" Margin="12,0,0,0" ItemsSource="{Binding Children}" IsVisible="{Binding Children.Count, Converter={x:Static c:IntConverters.IsGreaterThanZero}}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel Orientation="Horizontal" VerticalAlignment="Center"/>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate>
<TextBlock Classes="primary"
Text="{Binding Converter={x:Static c:StringConverters.ToShortSHA}}"
Foreground="DarkOrange"
TextDecorations="Underline"
Cursor="Hand"
Margin="0,0,16,0"
PointerPressed="OnSHAPressed"/>
</DataTemplate> </DataTemplate>
</ItemsControl.ItemTemplate> </ItemsControl.ItemTemplate>
</ItemsControl> </ItemsControl>
<!-- REFS --> <!-- REFS -->
<TextBlock Grid.Row="3" 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="3" 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 TagBackground="{DynamicResource Brush.DecoratorTag}"
Foreground="{DynamicResource Brush.FG1}" Foreground="{DynamicResource Brush.FG1}"
FontFamily="{DynamicResource Fonts.Primary}" FontFamily="{DynamicResource Fonts.Primary}"
@ -156,8 +134,8 @@
</Border> </Border>
<!-- Messages --> <!-- Messages -->
<TextBlock Grid.Row="4" Grid.Column="0" Classes="info_label" Text="{DynamicResource Text.CommitDetail.Info.Message}" VerticalAlignment="Top" Margin="0,4,0,0" /> <TextBlock Grid.Row="3" Grid.Column="0" Classes="info_label" Text="{DynamicResource Text.CommitDetail.Info.Message}" VerticalAlignment="Top" Margin="0,4,0,0" />
<v:CommitMessagePresenter Grid.Row="4" Grid.Column="1" <v:CommitMessagePresenter Grid.Row="3" Grid.Column="1"
Margin="12,5,8,0" Margin="12,5,8,0"
Classes="primary" Classes="primary"
Message="{Binding #ThisControl.Message}" Message="{Binding #ThisControl.Message}"

View file

@ -113,7 +113,7 @@ namespace SourceGit.Views
e.Handled = true; e.Handled = true;
} }
private void OnSHAPressed(object sender, PointerPressedEventArgs e) private void OnParentSHAPressed(object sender, PointerPressedEventArgs e)
{ {
if (DataContext is ViewModels.CommitDetail detail && sender is Control { DataContext: string sha }) if (DataContext is ViewModels.CommitDetail detail && sender is Control { DataContext: string sha })
{ {