Skip to content

Commit a935f81

Browse files
committed
refactor: drop support to show children in commit details panel
Only support to go to child commit with `Alt+Up/⌥+Up` hotkey Signed-off-by: leo <longshuang@msn.cn>
1 parent 6744e06 commit a935f81

8 files changed

Lines changed: 28 additions & 158 deletions

File tree

src/Commands/QueryCommitChildren.cs

Lines changed: 0 additions & 36 deletions
This file was deleted.

src/Resources/Locales/en_US.axaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,6 @@
184184
<x:String x:Key="Text.CommitDetail.Files.Submodule" xml:space="preserve">Submodule</x:String>
185185
<x:String x:Key="Text.CommitDetail.Info" xml:space="preserve">INFORMATION</x:String>
186186
<x:String x:Key="Text.CommitDetail.Info.Author" xml:space="preserve">AUTHOR</x:String>
187-
<x:String x:Key="Text.CommitDetail.Info.Children" xml:space="preserve">CHILDREN</x:String>
188187
<x:String x:Key="Text.CommitDetail.Info.Committer" xml:space="preserve">COMMITTER</x:String>
189188
<x:String x:Key="Text.CommitDetail.Info.ContainsIn" xml:space="preserve">Check refs that contains this commit</x:String>
190189
<x:String x:Key="Text.CommitDetail.Info.ContainsIn.Title" xml:space="preserve">COMMIT IS CONTAINED BY</x:String>
@@ -688,7 +687,6 @@
688687
<x:String x:Key="Text.Preferences.General.MaxHistoryCommits" xml:space="preserve">History Commits</x:String>
689688
<x:String x:Key="Text.Preferences.General.ShowChangesPageByDefault" xml:space="preserve">Show `LOCAL CHANGES` page by default</x:String>
690689
<x:String x:Key="Text.Preferences.General.ShowChangesTabInCommitDetailByDefault" xml:space="preserve">Show `CHANGES` tab in commit detail by default</x:String>
691-
<x:String x:Key="Text.Preferences.General.ShowChildren" xml:space="preserve">Show children in the commit details</x:String>
692690
<x:String x:Key="Text.Preferences.General.ShowRelativeTimeInGraph" xml:space="preserve">Show relative time in commit graph</x:String>
693691
<x:String x:Key="Text.Preferences.General.ShowTagsInGraph" xml:space="preserve">Show tags in commit graph</x:String>
694692
<x:String x:Key="Text.Preferences.General.SubjectGuideLength" xml:space="preserve">Subject Guide Length</x:String>

src/ViewModels/CommitDetail.cs

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -79,12 +79,6 @@ public List<Models.CommitLink> WebLinks
7979
private set;
8080
}
8181

82-
public List<string> Children
83-
{
84-
get => _children;
85-
private set => SetProperty(ref _children, value);
86-
}
87-
8882
public List<Models.Change> Changes
8983
{
9084
get => _changes;
@@ -471,7 +465,6 @@ private void Refresh()
471465
ViewRevisionFileContent = null;
472466
ViewRevisionFilePath = string.Empty;
473467
CanOpenRevisionFileWithDefaultEditor = false;
474-
Children = null;
475468
RevisionFileSearchFilter = string.Empty;
476469
RevisionFileSearchSuggestion = null;
477470
ScrollOffset = Vector.Zero;
@@ -518,20 +511,6 @@ private void Refresh()
518511
Dispatcher.UIThread.Post(() => SignInfo = signInfo);
519512
}, token);
520513

521-
if (Preferences.Instance.ShowChildren)
522-
{
523-
Task.Run(async () =>
524-
{
525-
var max = Preferences.Instance.MaxHistoryCommits;
526-
var children = await new Commands.QueryCommitChildren(_repo.FullPath, _commit.SHA, max)
527-
.WithCancellation(token)
528-
.GetResultAsync()
529-
.ConfigureAwait(false);
530-
if (!token.IsCancellationRequested)
531-
Dispatcher.UIThread.Post(() => Children = children);
532-
}, token);
533-
}
534-
535514
Task.Run(async () =>
536515
{
537516
var changes = await new Commands.CompareRevisions(_repo.FullPath, _commit.FirstParentToCompare, _commit.SHA)
@@ -757,7 +736,6 @@ private async Task SetViewingCommitAsync(Models.Object file)
757736
private Models.Commit _commit = null;
758737
private Models.CommitFullMessage _fullMessage = null;
759738
private Models.CommitSignInfo _signInfo = null;
760-
private List<string> _children = null;
761739
private List<Models.Change> _changes = [];
762740
private List<Models.Change> _visibleChanges = [];
763741
private List<Models.Change> _selectedChanges = null;

src/ViewModels/Preferences.cs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -193,12 +193,6 @@ public bool Check4UpdatesOnStartup
193193
set => SetProperty(ref _check4UpdatesOnStartup, value);
194194
}
195195

196-
public bool ShowChildren
197-
{
198-
get => _showChildren;
199-
set => SetProperty(ref _showChildren, value);
200-
}
201-
202196
public string IgnoreUpdateTag
203197
{
204198
get => _ignoreUpdateTag;
@@ -812,7 +806,6 @@ private bool RemoveInvalidRepositoriesRecursive(List<RepositoryNode> collection)
812806
private bool _useFixedTabWidth = true;
813807
private bool _useAutoHideScrollBars = true;
814808
private bool _useGitHubStyleAvatar = true;
815-
private bool _showChildren = false;
816809
private bool _useCompactBranchNamesInGraph = true;
817810

818811
private bool _check4UpdatesOnStartup = true;

src/Views/CommitBaseInfo.axaml

Lines changed: 5 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959
<Rectangle Height=".65" Margin="8,8,0,8" Fill="{DynamicResource Brush.Border2}" VerticalAlignment="Center"/>
6060

6161
<!-- Base Information -->
62-
<Grid RowDefinitions="24,Auto,Auto,Auto,Auto" ColumnDefinitions="96,*">
62+
<Grid RowDefinitions="24,Auto,Auto,Auto" ColumnDefinitions="96,*">
6363
<!-- SHA -->
6464
<TextBlock Grid.Row="0" Grid.Column="0" Classes="info_label" VerticalAlignment="Top" Margin="0,4,0,0" Text="{DynamicResource Text.CommitDetail.Info.SHA}" />
6565
<StackPanel Grid.Row="0" Grid.Column="1" Orientation="Horizontal" Height="24">
@@ -150,57 +150,9 @@
150150
</ItemsControl.ItemTemplate>
151151
</ItemsControl>
152152

153-
<!-- CHILDREN -->
154-
<TextBlock Grid.Row="2" Grid.Column="0" Classes="info_label" VerticalAlignment="Top" Margin="0,4,0,0" Text="{DynamicResource Text.CommitDetail.Info.Children}" IsVisible="{Binding #ThisControl.Children, Converter={x:Static c:ListConverters.IsNotNullOrEmpty}}"/>
155-
<ItemsControl Grid.Row="2" Grid.Column="1" Margin="12,0,0,0" ItemsSource="{Binding #ThisControl.Children}" IsVisible="{Binding #ThisControl.Children, Converter={x:Static c:ListConverters.IsNotNullOrEmpty}}">
156-
<ItemsControl.ItemsPanel>
157-
<ItemsPanelTemplate>
158-
<WrapPanel Orientation="Horizontal" VerticalAlignment="Center" ItemHeight="24"/>
159-
</ItemsPanelTemplate>
160-
</ItemsControl.ItemsPanel>
161-
162-
<ItemsControl.ItemTemplate>
163-
<DataTemplate>
164-
<TextBlock Text="{Binding Converter={x:Static c:StringConverters.ToShortSHA}}"
165-
FontFamily="{DynamicResource Fonts.Monospace}"
166-
Foreground="DarkOrange"
167-
TextDecorations="Underline"
168-
Cursor="Hand"
169-
Margin="0,0,16,0"
170-
PointerEntered="OnSHAPointerEntered"
171-
PointerPressed="OnSHAPressed"
172-
ToolTip.ShowDelay="0">
173-
<ToolTip.IsOpen>
174-
<MultiBinding Converter="{x:Static BoolConverters.And}">
175-
<Binding Path="$self.IsPointerOver"/>
176-
<Binding Path="$self.(ToolTip.Tip)" Converter="{x:Static ObjectConverters.IsNotNull}"/>
177-
</MultiBinding>
178-
</ToolTip.IsOpen>
179-
180-
<TextBlock.DataTemplates>
181-
<DataTemplate DataType="m:Commit">
182-
<StackPanel MinWidth="400" Orientation="Vertical">
183-
<Grid ColumnDefinitions="Auto,*,Auto">
184-
<v:Avatar Grid.Column="0" Width="16" Height="16" VerticalAlignment="Center" IsHitTestVisible="False" User="{Binding Author}"/>
185-
<TextBlock Grid.Column="1" Text="{Binding Author.Name}" Margin="8,0,0,0"/>
186-
<v:DateTimePresenter Grid.Column="2"
187-
Margin="8,0,0,0"
188-
Timestamp="{Binding CommitterTime}"
189-
Foreground="{DynamicResource Brush.FG2}"/>
190-
</Grid>
191-
192-
<TextBlock Margin="0,8,0,0" Text="{Binding Subject}" TextWrapping="Wrap"/>
193-
</StackPanel>
194-
</DataTemplate>
195-
</TextBlock.DataTemplates>
196-
</TextBlock>
197-
</DataTemplate>
198-
</ItemsControl.ItemTemplate>
199-
</ItemsControl>
200-
201153
<!-- REFS -->
202-
<TextBlock Grid.Row="3" Grid.Column="0" Classes="info_label" VerticalAlignment="Top" Margin="0,4,0,0" Text="{DynamicResource Text.CommitDetail.Info.Refs}" IsVisible="{Binding HasDecorators}"/>
203-
<Border Grid.Row="3" Grid.Column="1" Margin="12,0,0,0" MinHeight="24" IsVisible="{Binding HasDecorators}">
154+
<TextBlock Grid.Row="2" Grid.Column="0" Classes="info_label" VerticalAlignment="Top" Margin="0,4,0,0" Text="{DynamicResource Text.CommitDetail.Info.Refs}" IsVisible="{Binding HasDecorators}"/>
155+
<Border Grid.Row="2" Grid.Column="1" Margin="12,0,0,0" MinHeight="24" IsVisible="{Binding HasDecorators}">
204156
<v:CommitRefsPresenter Foreground="{DynamicResource Brush.FG1}"
205157
FontSize="12"
206158
AllowWrap="True"
@@ -210,8 +162,8 @@
210162
</Border>
211163

212164
<!-- Messages -->
213-
<TextBlock Grid.Row="4" Grid.Column="0" Classes="info_label" VerticalAlignment="Top" Margin="0,4,0,0" Text="{DynamicResource Text.CommitDetail.Info.Message}" />
214-
<v:CommitMessagePresenter Grid.Row="4" Grid.Column="1"
165+
<TextBlock Grid.Row="3" Grid.Column="0" Classes="info_label" VerticalAlignment="Top" Margin="0,4,0,0" Text="{DynamicResource Text.CommitDetail.Info.Message}" />
166+
<v:CommitMessagePresenter Grid.Row="3" Grid.Column="1"
215167
Margin="12,4,0,0"
216168
Foreground="{DynamicResource Brush.FG1}"
217169
FullMessage="{Binding #ThisControl.FullMessage}"

src/Views/CommitBaseInfo.axaml.cs

Lines changed: 19 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -35,18 +35,6 @@ public Models.CommitSignInfo SignInfo
3535
set => SetAndRaise(SignInfoProperty, ref _signInfo, value);
3636
}
3737

38-
public static readonly DirectProperty<CommitBaseInfo, bool> SupportsContainsInProperty =
39-
AvaloniaProperty.RegisterDirect<CommitBaseInfo, bool>(
40-
nameof(SupportsContainsIn),
41-
static o => o.SupportsContainsIn,
42-
static (o, v) => o.SupportsContainsIn = v);
43-
44-
public bool SupportsContainsIn
45-
{
46-
get => _supportsContainsIn;
47-
set => SetAndRaise(SupportsContainsInProperty, ref _supportsContainsIn, value);
48-
}
49-
5038
public static readonly DirectProperty<CommitBaseInfo, List<Models.CommitLink>> WebLinksProperty =
5139
AvaloniaProperty.RegisterDirect<CommitBaseInfo, List<Models.CommitLink>>(
5240
nameof(WebLinks),
@@ -59,18 +47,6 @@ public List<Models.CommitLink> WebLinks
5947
set => SetAndRaise(WebLinksProperty, ref _webLinks, value);
6048
}
6149

62-
public static readonly DirectProperty<CommitBaseInfo, List<string>> ChildrenProperty =
63-
AvaloniaProperty.RegisterDirect<CommitBaseInfo, List<string>>(
64-
nameof(Children),
65-
static o => o.Children,
66-
static (o, v) => o.Children = v);
67-
68-
public List<string> Children
69-
{
70-
get => _children;
71-
set => SetAndRaise(ChildrenProperty, ref _children, value);
72-
}
73-
7450
public static readonly DirectProperty<CommitBaseInfo, bool> IsSHACopiedProperty =
7551
AvaloniaProperty.RegisterDirect<CommitBaseInfo, bool>(
7652
nameof(IsSHACopied),
@@ -79,14 +55,31 @@ public List<string> Children
7955
public bool IsSHACopied
8056
{
8157
get => _isSHACopied;
82-
set => SetAndRaise(IsSHACopiedProperty, ref _isSHACopied, value);
58+
private set => SetAndRaise(IsSHACopiedProperty, ref _isSHACopied, value);
59+
}
60+
61+
public static readonly DirectProperty<CommitBaseInfo, bool> SupportsContainsInProperty =
62+
AvaloniaProperty.RegisterDirect<CommitBaseInfo, bool>(
63+
nameof(SupportsContainsIn),
64+
static o => o.SupportsContainsIn);
65+
66+
public bool SupportsContainsIn
67+
{
68+
get => _supportsContainsIn;
69+
private set => SetAndRaise(SupportsContainsInProperty, ref _supportsContainsIn, value);
8370
}
8471

8572
public CommitBaseInfo()
8673
{
8774
InitializeComponent();
8875
}
8976

77+
protected override void OnDataContextChanged(EventArgs e)
78+
{
79+
base.OnDataContextChanged(e);
80+
SupportsContainsIn = DataContext is ViewModels.CommitDetail;
81+
}
82+
9083
protected override void OnPropertyChanged(AvaloniaPropertyChangedEventArgs change)
9184
{
9285
base.OnPropertyChanged(change);
@@ -103,7 +96,7 @@ protected override void OnLoaded(RoutedEventArgs e)
10396
base.OnLoaded(e);
10497

10598
_iconResetTimer = new DispatcherTimer();
106-
_iconResetTimer.Interval = TimeSpan.FromSeconds(1.5);
99+
_iconResetTimer.Interval = TimeSpan.FromSeconds(1);
107100
_iconResetTimer.Tag = this;
108101
_iconResetTimer.Tick += static (o, _) =>
109102
{
@@ -310,7 +303,6 @@ sender is CommitRefsPresenter presenter &&
310303
private Models.CommitSignInfo _signInfo = null;
311304
private bool _supportsContainsIn = false;
312305
private List<Models.CommitLink> _webLinks = null;
313-
private List<string> _children = null;
314306
private bool _isSHACopied = false;
315307
private DispatcherTimer _iconResetTimer = null;
316308
}

src/Views/CommitDetail.axaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,7 @@
2828
<v:CommitBaseInfo Content="{Binding Commit}"
2929
FullMessage="{Binding FullMessage}"
3030
SignInfo="{Binding SignInfo}"
31-
SupportsContainsIn="True"
3231
WebLinks="{Binding WebLinks}"
33-
Children="{Binding Children}"
3432
Margin="0,0,12,0"/>
3533

3634
<!-- Line -->

src/Views/Preferences.axaml

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
<TabItem.Header>
4848
<TextBlock Classes="tab_header" Text="{DynamicResource Text.Preferences.General}"/>
4949
</TabItem.Header>
50-
<Grid Margin="8" RowDefinitions="32,32,32,32,32,32,32,32,32,32,32,32,32,Auto" ColumnDefinitions="Auto,*">
50+
<Grid Margin="8" RowDefinitions="32,32,32,32,32,32,32,32,32,32,32,32,Auto" ColumnDefinitions="Auto,*">
5151
<TextBlock Grid.Row="0" Grid.Column="0"
5252
Text="{DynamicResource Text.Preferences.General.Locale}"
5353
HorizontalAlignment="Right"
@@ -162,26 +162,21 @@
162162
IsChecked="{Binding DisplayTimeAsPeriodInHistories, Mode=TwoWay}"/>
163163

164164
<CheckBox Grid.Row="9" Grid.Column="1"
165-
Height="32"
166-
Content="{DynamicResource Text.Preferences.General.ShowChildren}"
167-
IsChecked="{Binding ShowChildren, Mode=TwoWay}"/>
168-
169-
<CheckBox Grid.Row="10" Grid.Column="1"
170165
Height="32"
171166
Content="{DynamicResource Text.Preferences.General.UseCompactBranchNames}"
172167
IsChecked="{Binding UseCompactBranchNamesInGraph, Mode=TwoWay}"/>
173168

174-
<CheckBox Grid.Row="11" Grid.Column="1"
169+
<CheckBox Grid.Row="10" Grid.Column="1"
175170
Height="32"
176171
Content="{DynamicResource Text.Preferences.General.EnableCompactFolders}"
177172
IsChecked="{Binding EnableCompactFoldersInChangesTree, Mode=TwoWay}"/>
178173

179-
<CheckBox Grid.Row="12" Grid.Column="1"
174+
<CheckBox Grid.Row="11" Grid.Column="1"
180175
Height="32"
181176
Content="{DynamicResource Text.Preferences.General.UseGitHubStyleAvatar}"
182177
IsChecked="{Binding UseGitHubStyleAvatar, Mode=TwoWay}"/>
183178

184-
<CheckBox Grid.Row="13" Grid.Column="1"
179+
<CheckBox Grid.Row="12" Grid.Column="1"
185180
Height="32"
186181
Content="{DynamicResource Text.Preferences.General.Check4UpdatesOnStartup}"
187182
IsVisible="{x:Static s:App.IsCheckForUpdateCommandVisible}"

0 commit comments

Comments
 (0)