Skip to content

Commit 9f155d7

Browse files
heartackerlove-linger
authored andcommitted
feature: add --simplify-by-decoration mode support (#1595)
1 parent 5ee3456 commit 9f155d7

File tree

4 files changed

+40
-2
lines changed

4 files changed

+40
-2
lines changed

src/Models/RepositorySettings.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,12 @@ public string DefaultRemote
1414
set;
1515
} = string.Empty;
1616

17+
public bool SimplifyByDecoration
18+
{
19+
get;
20+
set;
21+
} = false;
22+
1723
public bool EnableReflog
1824
{
1925
get;

src/Resources/Locales/en_US.axaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -670,6 +670,7 @@
670670
<x:String x:Key="Text.Repository.Search.InCurrentBranch" xml:space="preserve">Current Branch</x:String>
671671
<x:String x:Key="Text.Repository.ShowFirstParentOnly" xml:space="preserve">Show first-parent only</x:String>
672672
<x:String x:Key="Text.Repository.ShowLostCommits" xml:space="preserve">Show lost commits</x:String>
673+
<x:String x:Key="Text.Repository.SimplifyByDecoration" xml:space="preserve">Show Decorate Commits Only</x:String>
673674
<x:String x:Key="Text.Repository.ShowSubmodulesAsTree" xml:space="preserve">Show Submodules as Tree</x:String>
674675
<x:String x:Key="Text.Repository.ShowTagsAsTree" xml:space="preserve">Show Tags as Tree</x:String>
675676
<x:String x:Key="Text.Repository.Skip" xml:space="preserve">SKIP</x:String>

src/ViewModels/Repository.cs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,20 @@ public object SelectedView
9191
set => SetProperty(ref _selectedView, value);
9292
}
9393

94+
public bool SimplifyByDecoration
95+
{
96+
get => _settings.SimplifyByDecoration;
97+
set
98+
{
99+
if (value != _settings.SimplifyByDecoration)
100+
{
101+
_settings.SimplifyByDecoration = value;
102+
OnPropertyChanged();
103+
Task.Run(RefreshCommits);
104+
}
105+
}
106+
}
107+
94108
public bool EnableReflog
95109
{
96110
get => _settings.EnableReflog;
@@ -1271,6 +1285,9 @@ public void RefreshCommits()
12711285
builder.Append("--reflog ");
12721286
if (_settings.EnableFirstParentInHistories)
12731287
builder.Append("--first-parent ");
1288+
// only show commits with decorators
1289+
if (_settings.SimplifyByDecoration)
1290+
builder.Append("--simplify-by-decoration ");
12741291

12751292
var filters = _settings.BuildHistoriesFilter();
12761293
if (string.IsNullOrEmpty(filters))

src/Views/Repository.axaml

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@
8383
</ListBox.ItemsPanel>
8484

8585
<ListBoxItem>
86-
<Grid Classes="view_mode" ColumnDefinitions="Auto,*,Auto,Auto,Auto,Auto,Auto">
86+
<Grid Classes="view_mode" ColumnDefinitions="Auto,*,Auto,Auto,Auto,Auto,Auto,Auto">
8787
<Path Grid.Column="0" Classes="icon" Data="{StaticResource Icons.Histories}"/>
8888
<TextBlock Grid.Column="1" Classes="header" Text="{DynamicResource Text.Histories}"/>
8989

@@ -131,7 +131,21 @@
131131
ToolTip.Tip="{DynamicResource Text.Repository.UseRelativeTimeInGraph}">
132132
<Path Width="12" Height="12" Data="{StaticResource Icons.Stopwatch}"/>
133133
</ToggleButton>
134-
<Button Grid.Column="6"
134+
<ToggleButton Grid.Column="6"
135+
Classes="line_path"
136+
Width="26" Height="26"
137+
Background="Transparent"
138+
IsChecked="{Binding SimplifyByDecoration, Mode=TwoWay}">
139+
<ToolTip.Tip>
140+
<TextBlock>
141+
<Run Text="{DynamicResource Text.Repository.SimplifyByDecoration}"/>
142+
<Run Text=" "/>
143+
<Run Text="--simplify-by-decoration" FontSize="11" Foreground="{DynamicResource MenuFlyoutItemKeyboardAcceleratorTextForeground}"/>
144+
</TextBlock>
145+
</ToolTip.Tip>
146+
<Path Width="12" Height="12" Data="{StaticResource Icons.Tree}"/>
147+
</ToggleButton>
148+
<Button Grid.Column="7"
135149
Classes="icon_button"
136150
Width="26" Height="26"
137151
Click="OnOpenAdvancedHistoriesOption">

0 commit comments

Comments
 (0)