Skip to content

Commit 62ac429

Browse files
committed
feature: add a toggle button to enable --reflog when query commits
1 parent f2de7a0 commit 62ac429

File tree

6 files changed

+26
-1
lines changed

6 files changed

+26
-1
lines changed

src/Resources/Icons.axaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@
8585
<StreamGeometry x:Key="Icons.Pull">M432 0h160c27 0 48 21 48 48v336h175c36 0 53 43 28 68L539 757c-15 15-40 15-55 0L180 452c-25-25-7-68 28-68H384V48c0-27 21-48 48-48zm592 752v224c0 27-21 48-48 48H48c-27 0-48-21-48-48V752c0-27 21-48 48-48h293l98 98c40 40 105 40 145 0l98-98H976c27 0 48 21 48 48zm-248 176c0-22-18-40-40-40s-40 18-40 40s18 40 40 40s40-18 40-40zm128 0c0-22-18-40-40-40s-40 18-40 40s18 40 40 40s40-18 40-40z</StreamGeometry>
8686
<StreamGeometry x:Key="Icons.Push">M592 768h-160c-27 0-48-21-48-48V384h-175c-36 0-53-43-28-68L485 11c15-15 40-15 55 0l304 304c25 25 7 68-28 68H640v336c0 27-21 48-48 48zm432-16v224c0 27-21 48-48 48H48c-27 0-48-21-48-48V752c0-27 21-48 48-48h272v16c0 62 50 112 112 112h160c62 0 112-50 112-112v-16h272c27 0 48 21 48 48zm-248 176c0-22-18-40-40-40s-40 18-40 40s18 40 40 40s40-18 40-40zm128 0c0-22-18-40-40-40s-40 18-40 40s18 40 40 40s40-18 40-40z</StreamGeometry>
8787
<StreamGeometry x:Key="Icons.Rebase">M277 85a149 149 0 00-43 292v230a32 32 0 0064 0V555h267A160 160 0 00725 395v-12a149 149 0 10-64-5v17a96 96 0 01-96 96H299V383A149 149 0 00277 85zM228 720a32 32 0 00-37-52 150 150 0 00-53 68 32 32 0 1060 23 85 85 0 0130-39zm136-52a32 32 0 00-37 52 86 86 0 0130 39 32 32 0 1060-23 149 149 0 00-53-68zM204 833a32 32 0 10-55 32 149 149 0 0063 58 32 32 0 0028-57 85 85 0 01-36-33zm202 32a32 32 0 00-55-32 85 85 0 01-36 33 32 32 0 0028 57 149 149 0 0063-58z</StreamGeometry>
88+
<StreamGeometry x:Key="Icons.Reference">M854 234a171 171 0 00-171 171v51c13-5 28-7 43-7h35a136 136 0 01136 136v93a198 198 0 01-198 198 101 101 0 01-101-101V405a256 256 0 01256-256h21a21 21 0 0121 21v43a21 21 0 01-21 21h-21zM213 456c13-5 28-7 43-7h35a136 136 0 01136 136v93a198 198 0 01-198 198 101 101 0 01-101-101V405a256 256 0 01256-256h21a21 21 0 0121 21v43a21 21 0 01-21 21h-21a171 171 0 00-171 171v51z</StreamGeometry>
8889
<StreamGeometry x:Key="Icons.Relation">m224 154a166 166 0 00-166 166v192a166 166 0 00166 166h64v-76h-64a90 90 0 01-90-90v-192a90 90 0 0190-90h320a90 90 0 0190 90v192a90 90 0 01-90 90h-128v77h128a166 166 0 00166-167v-192a166 166 0 00-166-166h-320zm166 390a90 90 0 0190-90h128v-76h-128a166 166 0 00-166 166v192a166 166 0 00166 166h320a166 166 0 00166-166v-192a166 166 0 00-166-166h-64v77h64a90 90 0 0190 90v192a90 90 0 01-90 90h-320a90 90 0 01-90-90v-192z</StreamGeometry>
8990
<StreamGeometry x:Key="Icons.Remote">M512 128M706 302a289 289 0 00-173 44 27 27 0 1029 46 234 234 0 01125-36c23 0 45 3 66 9 93 28 161 114 161 215C914 704 813 805 687 805H337C211 805 110 704 110 580c0-96 61-178 147-210C282 263 379 183 495 183a245 245 0 01210 119z</StreamGeometry>
9091
<StreamGeometry x:Key="Icons.Remote.Add">M364 512h67v108h108v67h-108v108h-67v-108h-108v-67h108v-108zm298-64A107 107 0 01768 555C768 614 720 660 660 660h-108v-54h-108v-108h-94v108h-94c4-21 22-47 44-51l-1-12a75 75 0 0171-75a128 128 0 01239-7a106 106 0 0153-14z</StreamGeometry>

src/Resources/Locales/en_US.axaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -499,6 +499,7 @@
499499
<x:String x:Key="Text.Repository.ClearAllCommitsFilter" xml:space="preserve">Clear all</x:String>
500500
<x:String x:Key="Text.Repository.Configure" xml:space="preserve">Configure this repository</x:String>
501501
<x:String x:Key="Text.Repository.Continue" xml:space="preserve">CONTINUE</x:String>
502+
<x:String x:Key="Text.Repository.EnableReflog" xml:space="preserve">Enable '--reflog' Option</x:String>
502503
<x:String x:Key="Text.Repository.Explore" xml:space="preserve">Open In File Browser</x:String>
503504
<x:String x:Key="Text.Repository.Filter" xml:space="preserve">Search Branches/Tags/Submodules</x:String>
504505
<x:String x:Key="Text.Repository.FilterCommitPrefix" xml:space="preserve">FILTERED BY:</x:String>

src/Resources/Locales/zh_CN.axaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -497,6 +497,7 @@
497497
<x:String x:Key="Text.Repository.ClearAllCommitsFilter" xml:space="preserve">清空过滤规则</x:String>
498498
<x:String x:Key="Text.Repository.Configure" xml:space="preserve">配置本仓库</x:String>
499499
<x:String x:Key="Text.Repository.Continue" xml:space="preserve">下一步</x:String>
500+
<x:String x:Key="Text.Repository.EnableReflog" xml:space="preserve">启用 --reflog 选项</x:String>
500501
<x:String x:Key="Text.Repository.Explore" xml:space="preserve">在文件浏览器中打开</x:String>
501502
<x:String x:Key="Text.Repository.Filter" xml:space="preserve">快速查找分支/标签/子模块</x:String>
502503
<x:String x:Key="Text.Repository.FilterCommitPrefix" xml:space="preserve">过滤规则 :</x:String>

src/Resources/Locales/zh_TW.axaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -502,6 +502,7 @@
502502
<x:String x:Key="Text.Repository.ClearAllCommitsFilter" xml:space="preserve">清空篩選規則</x:String>
503503
<x:String x:Key="Text.Repository.Configure" xml:space="preserve">設定本存放庫</x:String>
504504
<x:String x:Key="Text.Repository.Continue" xml:space="preserve">下一步</x:String>
505+
<x:String x:Key="Text.Repository.EnableReflog" xml:space="preserve">啟用 [--reflog] 選項</x:String>
505506
<x:String x:Key="Text.Repository.Explore" xml:space="preserve">在檔案瀏覽器中開啟</x:String>
506507
<x:String x:Key="Text.Repository.Filter" xml:space="preserve">快速搜尋分支/標籤/子模組</x:String>
507508
<x:String x:Key="Text.Repository.FilterCommitPrefix" xml:space="preserve">篩選規則:</x:String>

src/ViewModels/Repository.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,16 @@ public object SelectedView
7474
set => SetProperty(ref _selectedView, value);
7575
}
7676

77+
public bool EnableReflog
78+
{
79+
get => _enableReflog;
80+
set
81+
{
82+
if (SetProperty(ref _enableReflog, value))
83+
Task.Run(RefreshCommits);
84+
}
85+
}
86+
7787
public bool EnableFirstParentInHistories
7888
{
7989
get => _enableFirstParentInHistories;
@@ -827,6 +837,8 @@ public void RefreshCommits()
827837
Dispatcher.UIThread.Invoke(() => _histories.IsLoading = true);
828838

829839
var limits = $"-{Preference.Instance.MaxHistoryCommits} ";
840+
if (_enableReflog)
841+
limits += "--reflog ";
830842
if (_enableFirstParentInHistories)
831843
limits += "--first-parent ";
832844

@@ -2126,6 +2138,7 @@ private void AutoFetchImpl(object sender)
21262138
private bool _isSearchCommitSuggestionOpen = false;
21272139
private int _searchCommitFilterType = 2;
21282140
private bool _onlySearchCommitsInCurrentBranch = false;
2141+
private bool _enableReflog = false;
21292142
private bool _enableFirstParentInHistories = false;
21302143
private string _searchCommitFilter = string.Empty;
21312144
private List<Models.Commit> _searchedCommits = new List<Models.Commit>();

src/Views/Repository.axaml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@
6767
</ListBox.ItemsPanel>
6868

6969
<ListBoxItem>
70-
<Grid Classes="view_mode" ColumnDefinitions="32,*,Auto,Auto">
70+
<Grid Classes="view_mode" ColumnDefinitions="32,*,Auto,Auto,Auto">
7171
<Path Grid.Column="0" Width="12" Height="12" Data="{StaticResource Icons.Histories}"/>
7272
<TextBlock Grid.Column="1" Classes="primary" Text="{DynamicResource Text.Histories}"/>
7373
<ToggleButton Grid.Column="2"
@@ -76,6 +76,14 @@
7676
IsChecked="{Binding Source={x:Static vm:Preference.Instance}, Path=UseTwoColumnsLayoutInHistories, Mode=TwoWay}"
7777
ToolTip.Tip="{DynamicResource Text.Histories.DisplayMode}"/>
7878
<ToggleButton Grid.Column="3"
79+
Classes="line_path"
80+
Width="32" Height="26"
81+
Background="Transparent"
82+
IsChecked="{Binding EnableReflog, Mode=TwoWay}"
83+
ToolTip.Tip="{DynamicResource Text.Repository.EnableReflog}">
84+
<Path Width="12" Height="12" Data="{StaticResource Icons.Reference}"/>
85+
</ToggleButton>
86+
<ToggleButton Grid.Column="4"
7987
Classes="line_path"
8088
Width="32" Height="26"
8189
Background="Transparent"

0 commit comments

Comments
 (0)