@@ -91,43 +91,14 @@ public object SelectedView
91
91
set => SetProperty ( ref _selectedView , value ) ;
92
92
}
93
93
94
- public bool SimplifyByDecoration
94
+ public Models . HistoryShowFlags HistoryShowFlags
95
95
{
96
- get => _settings . SimplifyByDecoration ;
96
+ get => _settings . HistoryShowFlags ;
97
97
set
98
98
{
99
- if ( value != _settings . SimplifyByDecoration )
99
+ if ( value != _settings . HistoryShowFlags )
100
100
{
101
- _settings . SimplifyByDecoration = value ;
102
- OnPropertyChanged ( ) ;
103
- Task . Run ( RefreshCommits ) ;
104
- }
105
- }
106
- }
107
-
108
- public bool EnableReflog
109
- {
110
- get => _settings . EnableReflog ;
111
- set
112
- {
113
- if ( value != _settings . EnableReflog )
114
- {
115
- _settings . EnableReflog = value ;
116
- OnPropertyChanged ( ) ;
117
- Task . Run ( RefreshCommits ) ;
118
- }
119
- }
120
- }
121
-
122
- public bool EnableFirstParentInHistories
123
- {
124
- get => _settings . EnableFirstParentInHistories ;
125
- set
126
- {
127
- if ( value != _settings . EnableFirstParentInHistories )
128
- {
129
- _settings . EnableFirstParentInHistories = value ;
130
- OnPropertyChanged ( ) ;
101
+ _settings . HistoryShowFlags = value ;
131
102
Task . Run ( RefreshCommits ) ;
132
103
}
133
104
}
@@ -1281,12 +1252,13 @@ public void RefreshCommits()
1281
1252
else
1282
1253
builder . Append ( "--date-order " ) ;
1283
1254
1284
- if ( _settings . EnableReflog )
1255
+ if ( _settings . HistoryShowFlags . HasFlag ( Models . HistoryShowFlags . Reflog ) )
1285
1256
builder . Append ( "--reflog " ) ;
1286
- if ( _settings . EnableFirstParentInHistories )
1257
+
1258
+ if ( _settings . HistoryShowFlags . HasFlag ( Models . HistoryShowFlags . FirstParentOnly ) )
1287
1259
builder . Append ( "--first-parent " ) ;
1288
- // only show commits with decorators
1289
- if ( _settings . SimplifyByDecoration )
1260
+
1261
+ if ( _settings . HistoryShowFlags . HasFlag ( Models . HistoryShowFlags . SimplifyByDecoration ) )
1290
1262
builder . Append ( "--simplify-by-decoration " ) ;
1291
1263
1292
1264
var filters = _settings . BuildHistoriesFilter ( ) ;
@@ -1296,7 +1268,7 @@ public void RefreshCommits()
1296
1268
builder . Append ( filters ) ;
1297
1269
1298
1270
var commits = new Commands . QueryCommits ( _fullpath , builder . ToString ( ) ) . GetResultAsync ( ) . Result ;
1299
- var graph = Models . CommitGraph . Parse ( commits , _settings . EnableFirstParentInHistories ) ;
1271
+ var graph = Models . CommitGraph . Parse ( commits , _settings . HistoryShowFlags . HasFlag ( Models . HistoryShowFlags . FirstParentOnly ) ) ;
1300
1272
1301
1273
Dispatcher . UIThread . Invoke ( ( ) =>
1302
1274
{
@@ -1822,7 +1794,7 @@ public ContextMenu CreateContextMenuForCustomAction()
1822
1794
return menu ;
1823
1795
}
1824
1796
1825
- public ContextMenu CreateContextMenuForHistoriesPage ( )
1797
+ public ContextMenu CreateContextMenuForHistoryAdvancedOption ( )
1826
1798
{
1827
1799
var layout = new MenuItem ( ) ;
1828
1800
layout . Header = App . Text ( "Repository.HistoriesLayout" ) ;
@@ -1849,6 +1821,43 @@ public ContextMenu CreateContextMenuForHistoriesPage()
1849
1821
ev . Handled = true ;
1850
1822
} ;
1851
1823
1824
+ var showFlags = new MenuItem ( ) ;
1825
+ showFlags . Header = App . Text ( "Repository.ShowFlags" ) ;
1826
+ showFlags . IsEnabled = false ;
1827
+
1828
+ var reflog = new MenuItem ( ) ;
1829
+ reflog . Header = App . Text ( "Repository.ShowLostCommits" ) ;
1830
+ reflog . Tag = "--reflog" ;
1831
+ if ( _settings . HistoryShowFlags . HasFlag ( Models . HistoryShowFlags . Reflog ) )
1832
+ reflog . Icon = App . CreateMenuIcon ( "Icons.Check" ) ;
1833
+ reflog . Click += ( _ , e ) =>
1834
+ {
1835
+ ToggleHistoryShowFlag ( Models . HistoryShowFlags . Reflog ) ;
1836
+ e . Handled = true ;
1837
+ } ;
1838
+
1839
+ var firstParentOnly = new MenuItem ( ) ;
1840
+ firstParentOnly . Header = App . Text ( "Repository.ShowFirstParentOnly" ) ;
1841
+ firstParentOnly . Tag = "--first-parent" ;
1842
+ if ( _settings . HistoryShowFlags . HasFlag ( Models . HistoryShowFlags . FirstParentOnly ) )
1843
+ firstParentOnly . Icon = App . CreateMenuIcon ( "Icons.Check" ) ;
1844
+ firstParentOnly . Click += ( _ , e ) =>
1845
+ {
1846
+ ToggleHistoryShowFlag ( Models . HistoryShowFlags . FirstParentOnly ) ;
1847
+ e . Handled = true ;
1848
+ } ;
1849
+
1850
+ var simplifyByDecoration = new MenuItem ( ) ;
1851
+ simplifyByDecoration . Header = App . Text ( "Repository.ShowDecoratedCommitsOnly" ) ;
1852
+ simplifyByDecoration . Tag = "--simplify-by-decoration" ;
1853
+ if ( _settings . HistoryShowFlags . HasFlag ( Models . HistoryShowFlags . SimplifyByDecoration ) )
1854
+ simplifyByDecoration . Icon = App . CreateMenuIcon ( "Icons.Check" ) ;
1855
+ simplifyByDecoration . Click += ( _ , e ) =>
1856
+ {
1857
+ ToggleHistoryShowFlag ( Models . HistoryShowFlags . SimplifyByDecoration ) ;
1858
+ e . Handled = true ;
1859
+ } ;
1860
+
1852
1861
var order = new MenuItem ( ) ;
1853
1862
order . Header = App . Text ( "Repository.HistoriesOrder" ) ;
1854
1863
order . IsEnabled = false ;
@@ -1890,6 +1899,11 @@ public ContextMenu CreateContextMenuForHistoriesPage()
1890
1899
menu . Items . Add ( horizontal ) ;
1891
1900
menu . Items . Add ( vertical ) ;
1892
1901
menu . Items . Add ( new MenuItem ( ) { Header = "-" } ) ;
1902
+ menu . Items . Add ( showFlags ) ;
1903
+ menu . Items . Add ( reflog ) ;
1904
+ menu . Items . Add ( firstParentOnly ) ;
1905
+ menu . Items . Add ( simplifyByDecoration ) ;
1906
+ menu . Items . Add ( new MenuItem ( ) { Header = "-" } ) ;
1893
1907
menu . Items . Add ( order ) ;
1894
1908
menu . Items . Add ( dateOrder ) ;
1895
1909
menu . Items . Add ( topoOrder ) ;
@@ -3091,6 +3105,14 @@ private void CalcMatchedFilesForSearching()
3091
3105
MatchedFilesForSearching = matched ;
3092
3106
}
3093
3107
3108
+ private void ToggleHistoryShowFlag ( Models . HistoryShowFlags flag )
3109
+ {
3110
+ if ( _settings . HistoryShowFlags . HasFlag ( flag ) )
3111
+ HistoryShowFlags -= flag ;
3112
+ else
3113
+ HistoryShowFlags |= flag ;
3114
+ }
3115
+
3094
3116
private async void AutoFetchImpl ( object sender )
3095
3117
{
3096
3118
try
0 commit comments