Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
feat: Add solo mode functionality to repository toolbar
- Add a new localization string for solo mode functionality on HEAD.
- Add a solo mode button to the repository toolbar for toggling the current head view.
- Add solo commit filter mode for the current HEAD branch.
- Add `HEAD` and `HEAD_SHA` both is usefull and comparable while HEAD is Changed
  • Loading branch information
heartacker committed Aug 8, 2025
commit bcc04645552c73861f1f08d273ff5f6429def896
1 change: 1 addition & 0 deletions src/Resources/Locales/en_US.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -655,6 +655,7 @@
<x:String x:Key="Text.Repository.LocalBranches" xml:space="preserve">LOCAL BRANCHES</x:String>
<x:String x:Key="Text.Repository.MoreOptions" xml:space="preserve">More options...</x:String>
<x:String x:Key="Text.Repository.NavigateToCurrentHead" xml:space="preserve">Navigate to HEAD</x:String>
<x:String x:Key="Text.Repository.SoloModeOnCurrentHead" xml:space="preserve">Solo On HEAD</x:String>
<x:String x:Key="Text.Repository.NewBranch" xml:space="preserve">Create Branch</x:String>
<x:String x:Key="Text.Repository.Notifications.Clear" xml:space="preserve">CLEAR NOTIFICATIONS</x:String>
<x:String x:Key="Text.Repository.OnlyHighlightCurrentBranchInGraph" xml:space="preserve">Only highlight current branch</x:String>
Expand Down
20 changes: 17 additions & 3 deletions src/ViewModels/Repository.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Text.Json;
using System.Threading;
Expand Down Expand Up @@ -1062,10 +1063,13 @@ public void SetTagFilterMode(Models.Tag tag, Models.FilterMode mode)
if (changed)
RefreshHistoriesFilters(true);
}

public void SetSoloCommitFilterMode(Models.Commit commit, Models.FilterMode mode)
{
SetSoloCommitFilterMode(commit.SHA[..10], mode);
}
=> SetSoloCommitFilterMode(commit.SHA[..10], mode);


public void SetSoloCommitFilterMode(IEnumerable<Models.Commit> commits, Models.FilterMode mode)
=> SetSoloCommitFilterMode(commits.Select(x => x.SHA[..10]).ToList(), mode);

public void SetSoloCommitFilterMode(string sha, Models.FilterMode mode)
{
Expand All @@ -1074,6 +1078,16 @@ public void SetSoloCommitFilterMode(string sha, Models.FilterMode mode)
RefreshHistoriesFilters(true);
}

public void SetSoloCommitFilterMode(IEnumerable<string> shas, Models.FilterMode mode)
{
bool changed = false;
foreach (var sha in shas)
changed |= _settings.UpdateHistoriesFilter(sha, Models.FilterType.SoloCommits, mode);

if (changed)
RefreshHistoriesFilters(true);
}

public void SetBranchFilterMode(Models.Branch branch, Models.FilterMode mode, bool clearExists, bool refresh)
{
var node = FindBranchNode(branch.IsLocal ? _localBranchTrees : _remoteBranchTrees, branch.FullName);
Expand Down
3 changes: 3 additions & 0 deletions src/Views/RepositoryToolbar.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,9 @@
<Button Classes="icon_button" Width="32" Click="NavigateToHead" ToolTip.Tip="{DynamicResource Text.Repository.NavigateToCurrentHead}">
<Path Width="13" Height="13" Margin="0,2,0,0" Data="{StaticResource Icons.Target}" Fill="{DynamicResource Brush.FG1}"/>
</Button>
<Button Classes="icon_button" Width="32" Click="SoloModeOnCurrentHead" ToolTip.Tip="{DynamicResource Text.Repository.SoloModeOnCurrentHead}">
<Path Width="13" Height="13" Margin="0,2,0,0" Data="{StaticResource Icons.LightOn}" Fill="{DynamicResource Brush.FG1}"/>
</Button>
</StackPanel>
</Grid>
</UserControl>
9 changes: 9 additions & 0 deletions src/Views/RepositoryToolbar.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -462,5 +462,14 @@ private void NavigateToHead(object sender, RoutedEventArgs e)
e.Handled = true;
}
}

private void SoloModeOnCurrentHead(object sender, RoutedEventArgs e)
{
if (DataContext is ViewModels.Repository { CurrentBranch: not null } repo)
{
repo.SetSoloCommitFilterMode(["HEAD", repo.CurrentBranch.Head[..10]], Models.FilterMode.Included);
e.Handled = true;
}
}
}
}