Skip to content

Commit 4692df9

Browse files
committed
feature: show total changes in revision compare and branch compare
Signed-off-by: leo <[email protected]>
1 parent eef1dcc commit 4692df9

File tree

4 files changed

+38
-2
lines changed

4 files changed

+38
-2
lines changed

src/ViewModels/BranchCompare.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,12 @@ public Models.Commit ToHead
4343
private set => SetProperty(ref _toHead, value);
4444
}
4545

46+
public int TotalChanges
47+
{
48+
get => _totalChanges;
49+
private set => SetProperty(ref _totalChanges, value);
50+
}
51+
4652
public List<Models.Change> VisibleChanges
4753
{
4854
get => _visibleChanges;
@@ -175,6 +181,7 @@ private void Refresh()
175181

176182
Dispatcher.UIThread.Post(() =>
177183
{
184+
TotalChanges = _changes.Count;
178185
VisibleChanges = visible;
179186
IsLoading = false;
180187

@@ -214,6 +221,7 @@ private void RefreshVisible()
214221
private Models.Branch _to = null;
215222
private Models.Commit _baseHead = null;
216223
private Models.Commit _toHead = null;
224+
private int _totalChanges = 0;
217225
private List<Models.Change> _changes = null;
218226
private List<Models.Change> _visibleChanges = null;
219227
private List<Models.Change> _selectedChanges = null;

src/ViewModels/RevisionCompare.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,12 @@ public object EndPoint
2828

2929
public bool CanSaveAsPatch { get; }
3030

31+
public int TotalChanges
32+
{
33+
get => _totalChanges;
34+
private set => SetProperty(ref _totalChanges, value);
35+
}
36+
3137
public List<Models.Change> VisibleChanges
3238
{
3339
get => _visibleChanges;
@@ -182,6 +188,7 @@ private void Refresh()
182188

183189
Dispatcher.UIThread.Post(() =>
184190
{
191+
TotalChanges = _changes.Count;
185192
VisibleChanges = visible;
186193
IsLoading = false;
187194

@@ -202,6 +209,7 @@ private string GetSHA(object obj)
202209
private bool _isLoading = true;
203210
private object _startPoint = null;
204211
private object _endPoint = null;
212+
private int _totalChanges = 0;
205213
private List<Models.Change> _changes = null;
206214
private List<Models.Change> _visibleChanges = null;
207215
private List<Models.Change> _selectedChanges = null;

src/Views/BranchCompare.axaml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@
9393
<ColumnDefinition Width="*"/>
9494
</Grid.ColumnDefinitions>
9595

96-
<Grid Grid.Column="0" RowDefinitions="26,*">
96+
<Grid Grid.Column="0" RowDefinitions="26,*,26">
9797
<!-- Search & Display Mode -->
9898
<Grid Grid.Row="0" ColumnDefinitions="*,18">
9999
<TextBox Grid.Column="0"
@@ -137,6 +137,16 @@
137137
Width="48" Height="48"
138138
HorizontalAlignment="Center" VerticalAlignment="Center"
139139
IsVisible="{Binding IsLoading}"/>
140+
141+
<!-- Summary -->
142+
<Border Grid.Row="2" BorderBrush="{DynamicResource Brush.Border2}" BorderThickness="1,0,1,1" Background="Transparent">
143+
<TextBlock Margin="4,0,0,0"
144+
Foreground="{DynamicResource Brush.FG2}"
145+
HorizontalAlignment="Left" VerticalAlignment="Center">
146+
<Run Text="{Binding TotalChanges, Mode=OneWay}" FontWeight="Bold"/>
147+
<Run Text="{DynamicResource Text.CommitDetail.Changes.Count}"/>
148+
</TextBlock>
149+
</Border>
140150
</Grid>
141151

142152
<GridSplitter Grid.Column="1"

src/Views/RevisionCompare.axaml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@
6565
<ColumnDefinition Width="*"/>
6666
</Grid.ColumnDefinitions>
6767

68-
<Grid Grid.Column="0" RowDefinitions="26,*">
68+
<Grid Grid.Column="0" RowDefinitions="26,*,26">
6969
<!-- Search & Display Mode -->
7070
<Grid Grid.Row="0" ColumnDefinitions="*,18">
7171
<TextBox Grid.Column="0"
@@ -109,6 +109,16 @@
109109
Width="48" Height="48"
110110
HorizontalAlignment="Center" VerticalAlignment="Center"
111111
IsVisible="{Binding IsLoading}"/>
112+
113+
<!-- Summary -->
114+
<Border Grid.Row="2" BorderBrush="{DynamicResource Brush.Border2}" BorderThickness="1,0,1,1" Background="Transparent">
115+
<TextBlock Margin="4,0,0,0"
116+
Foreground="{DynamicResource Brush.FG2}"
117+
HorizontalAlignment="Left" VerticalAlignment="Center">
118+
<Run Text="{Binding TotalChanges, Mode=OneWay}" FontWeight="Bold"/>
119+
<Run Text="{DynamicResource Text.CommitDetail.Changes.Count}"/>
120+
</TextBlock>
121+
</Border>
112122
</Grid>
113123

114124
<GridSplitter Grid.Column="1"

0 commit comments

Comments
 (0)