mirror of
https://github.com/sourcegit-scm/sourcegit.git
synced 2024-12-24 20:57:19 -08:00
feature: supports filter submodules (#443)
This commit is contained in:
parent
0e774ee035
commit
b1457fe39d
9 changed files with 60 additions and 29 deletions
|
@ -482,6 +482,7 @@
|
|||
<x:String x:Key="Text.Repository.Configure" xml:space="preserve">Repository Einstellungen</x:String>
|
||||
<x:String x:Key="Text.Repository.Continue" xml:space="preserve">WEITER</x:String>
|
||||
<x:String x:Key="Text.Repository.Explore" xml:space="preserve">Öffne im Datei-Browser</x:String>
|
||||
<x:String x:Key="Text.Repository.Filter" xml:space="preserve">Suche Branches & Tags & Submodules</x:String>
|
||||
<x:String x:Key="Text.Repository.FilterCommitPrefix" xml:space="preserve">GEFILTERT:</x:String>
|
||||
<x:String x:Key="Text.Repository.LocalBranches" xml:space="preserve">LOKALE BRANCHES</x:String>
|
||||
<x:String x:Key="Text.Repository.NavigateToCurrentHead" xml:space="preserve">Zum HEAD wechseln</x:String>
|
||||
|
@ -499,7 +500,6 @@
|
|||
<x:String x:Key="Text.Repository.Search.ByMessage" xml:space="preserve">Commit-Nachricht</x:String>
|
||||
<x:String x:Key="Text.Repository.Search.BySHA" xml:space="preserve">SHA</x:String>
|
||||
<x:String x:Key="Text.Repository.Search.ByUser" xml:space="preserve">Autor & Committer</x:String>
|
||||
<x:String x:Key="Text.Repository.SearchBranchTag" xml:space="preserve">Suche Branches & Tags</x:String>
|
||||
<x:String x:Key="Text.Repository.ShowTagsAsTree" xml:space="preserve">Zeige Tags als Baum</x:String>
|
||||
<x:String x:Key="Text.Repository.Statistics" xml:space="preserve">Statistiken</x:String>
|
||||
<x:String x:Key="Text.Repository.Submodules" xml:space="preserve">SUBMODULE</x:String>
|
||||
|
|
|
@ -484,6 +484,7 @@
|
|||
<x:String x:Key="Text.Repository.Configure" xml:space="preserve">Configure this repository</x:String>
|
||||
<x:String x:Key="Text.Repository.Continue" xml:space="preserve">CONTINUE</x:String>
|
||||
<x:String x:Key="Text.Repository.Explore" xml:space="preserve">Open In File Browser</x:String>
|
||||
<x:String x:Key="Text.Repository.Filter" xml:space="preserve">Search Branches & Tags & Submodules</x:String>
|
||||
<x:String x:Key="Text.Repository.FilterCommitPrefix" xml:space="preserve">FILTERED BY:</x:String>
|
||||
<x:String x:Key="Text.Repository.LocalBranches" xml:space="preserve">LOCAL BRANCHES</x:String>
|
||||
<x:String x:Key="Text.Repository.NavigateToCurrentHead" xml:space="preserve">Navigate To HEAD</x:String>
|
||||
|
@ -501,7 +502,6 @@
|
|||
<x:String x:Key="Text.Repository.Search.ByMessage" xml:space="preserve">Message</x:String>
|
||||
<x:String x:Key="Text.Repository.Search.BySHA" xml:space="preserve">SHA</x:String>
|
||||
<x:String x:Key="Text.Repository.Search.ByUser" xml:space="preserve">Author & Committer</x:String>
|
||||
<x:String x:Key="Text.Repository.SearchBranchTag" xml:space="preserve">Search Branches & Tags</x:String>
|
||||
<x:String x:Key="Text.Repository.ShowTagsAsTree" xml:space="preserve">Show Tags as Tree</x:String>
|
||||
<x:String x:Key="Text.Repository.Statistics" xml:space="preserve">Statistics</x:String>
|
||||
<x:String x:Key="Text.Repository.Submodules" xml:space="preserve">SUBMODULES</x:String>
|
||||
|
|
|
@ -481,6 +481,7 @@
|
|||
<x:String x:Key="Text.Repository.Configure" xml:space="preserve">Configure this repository</x:String>
|
||||
<x:String x:Key="Text.Repository.Continue" xml:space="preserve">CONTINUE</x:String>
|
||||
<x:String x:Key="Text.Repository.Explore" xml:space="preserve">Ouvrir dans l'explorateur Windows</x:String>
|
||||
<x:String x:Key="Text.Repository.Filter" xml:space="preserve">Search Branches & Tags & Submodules</x:String>
|
||||
<x:String x:Key="Text.Repository.FilterCommitPrefix" xml:space="preserve">FILTERED BY:</x:String>
|
||||
<x:String x:Key="Text.Repository.LocalBranches" xml:space="preserve">LOCAL BRANCHES</x:String>
|
||||
<x:String x:Key="Text.Repository.NavigateToCurrentHead" xml:space="preserve">Navigate To HEAD</x:String>
|
||||
|
@ -498,7 +499,6 @@
|
|||
<x:String x:Key="Text.Repository.Search.ByMessage" xml:space="preserve">Message</x:String>
|
||||
<x:String x:Key="Text.Repository.Search.BySHA" xml:space="preserve">SHA</x:String>
|
||||
<x:String x:Key="Text.Repository.Search.ByUser" xml:space="preserve">Author & Committer</x:String>
|
||||
<x:String x:Key="Text.Repository.SearchBranchTag" xml:space="preserve">Search Branches & Tags</x:String>
|
||||
<x:String x:Key="Text.Repository.ShowTagsAsTree" xml:space="preserve">Show Tags as Tree</x:String>
|
||||
<x:String x:Key="Text.Repository.Statistics" xml:space="preserve">Statistics</x:String>
|
||||
<x:String x:Key="Text.Repository.Submodules" xml:space="preserve">SUBMODULES</x:String>
|
||||
|
|
|
@ -474,6 +474,7 @@
|
|||
<x:String x:Key="Text.Repository.Configure" xml:space="preserve">Configurar este repositório</x:String>
|
||||
<x:String x:Key="Text.Repository.Continue" xml:space="preserve">CONTINUAR</x:String>
|
||||
<x:String x:Key="Text.Repository.Explore" xml:space="preserve">Abrir no Navegador de Arquivos</x:String>
|
||||
<x:String x:Key="Text.Repository.Filter" xml:space="preserve">Pesquisar Branches & Tags & Submódulos</x:String>
|
||||
<x:String x:Key="Text.Repository.FilterCommitPrefix" xml:space="preserve">FILTRADO POR:</x:String>
|
||||
<x:String x:Key="Text.Repository.LocalBranches" xml:space="preserve">BRANCHES LOCAIS</x:String>
|
||||
<x:String x:Key="Text.Repository.NavigateToCurrentHead" xml:space="preserve">Navegar para HEAD</x:String>
|
||||
|
@ -491,7 +492,6 @@
|
|||
<x:String x:Key="Text.Repository.Search.ByMessage" xml:space="preserve">Mensagem</x:String>
|
||||
<x:String x:Key="Text.Repository.Search.BySHA" xml:space="preserve">SHA</x:String>
|
||||
<x:String x:Key="Text.Repository.Search.ByUser" xml:space="preserve">Autor & Committer</x:String>
|
||||
<x:String x:Key="Text.Repository.SearchBranchTag" xml:space="preserve">Pesquisar Branches & Tags</x:String>
|
||||
<x:String x:Key="Text.Repository.ShowTagsAsTree" xml:space="preserve">Mostrar Tags como Árvore</x:String>
|
||||
<x:String x:Key="Text.Repository.Statistics" xml:space="preserve">Estatísticas</x:String>
|
||||
<x:String x:Key="Text.Repository.Submodules" xml:space="preserve">SUBMÓDULOS</x:String>
|
||||
|
|
|
@ -486,6 +486,7 @@
|
|||
<x:String x:Key="Text.Repository.Configure" xml:space="preserve">配置本仓库</x:String>
|
||||
<x:String x:Key="Text.Repository.Continue" xml:space="preserve">下一步</x:String>
|
||||
<x:String x:Key="Text.Repository.Explore" xml:space="preserve">在文件浏览器中打开</x:String>
|
||||
<x:String x:Key="Text.Repository.Filter" xml:space="preserve">快速查找分支、标签、子模块</x:String>
|
||||
<x:String x:Key="Text.Repository.FilterCommitPrefix" xml:space="preserve">过滤规则 :</x:String>
|
||||
<x:String x:Key="Text.Repository.LocalBranches" xml:space="preserve">本地分支</x:String>
|
||||
<x:String x:Key="Text.Repository.NavigateToCurrentHead" xml:space="preserve">定位HEAD</x:String>
|
||||
|
@ -503,7 +504,6 @@
|
|||
<x:String x:Key="Text.Repository.Search.ByMessage" xml:space="preserve">提交信息</x:String>
|
||||
<x:String x:Key="Text.Repository.Search.BySHA" xml:space="preserve">提交指纹</x:String>
|
||||
<x:String x:Key="Text.Repository.Search.ByUser" xml:space="preserve">作者及提交者</x:String>
|
||||
<x:String x:Key="Text.Repository.SearchBranchTag" xml:space="preserve">快速查找分支、标签</x:String>
|
||||
<x:String x:Key="Text.Repository.ShowTagsAsTree" xml:space="preserve">以树型结构展示</x:String>
|
||||
<x:String x:Key="Text.Repository.Statistics" xml:space="preserve">提交统计</x:String>
|
||||
<x:String x:Key="Text.Repository.Submodules" xml:space="preserve">子模块列表</x:String>
|
||||
|
|
|
@ -487,6 +487,7 @@
|
|||
<x:String x:Key="Text.Repository.Configure" xml:space="preserve">設定本存放庫</x:String>
|
||||
<x:String x:Key="Text.Repository.Continue" xml:space="preserve">下一步</x:String>
|
||||
<x:String x:Key="Text.Repository.Explore" xml:space="preserve">在檔案瀏覽器中開啟</x:String>
|
||||
<x:String x:Key="Text.Repository.Filter" xml:space="preserve">快速搜尋分支、標籤、子模組</x:String>
|
||||
<x:String x:Key="Text.Repository.FilterCommitPrefix" xml:space="preserve">篩選規則:</x:String>
|
||||
<x:String x:Key="Text.Repository.LocalBranches" xml:space="preserve">本機分支</x:String>
|
||||
<x:String x:Key="Text.Repository.NavigateToCurrentHead" xml:space="preserve">回到 HEAD</x:String>
|
||||
|
@ -504,7 +505,6 @@
|
|||
<x:String x:Key="Text.Repository.Search.ByMessage" xml:space="preserve">提交訊息</x:String>
|
||||
<x:String x:Key="Text.Repository.Search.BySHA" xml:space="preserve">提交編號</x:String>
|
||||
<x:String x:Key="Text.Repository.Search.ByUser" xml:space="preserve">作者及提交者</x:String>
|
||||
<x:String x:Key="Text.Repository.SearchBranchTag" xml:space="preserve">快速搜尋分支、標籤</x:String>
|
||||
<x:String x:Key="Text.Repository.ShowTagsAsTree" xml:space="preserve">以樹型結構展示</x:String>
|
||||
<x:String x:Key="Text.Repository.Statistics" xml:space="preserve">提交統計</x:String>
|
||||
<x:String x:Key="Text.Repository.Submodules" xml:space="preserve">子模組列表</x:String>
|
||||
|
|
|
@ -83,17 +83,18 @@ namespace SourceGit.ViewModels
|
|||
}
|
||||
}
|
||||
|
||||
public string SearchBranchFilter
|
||||
public string Filter
|
||||
{
|
||||
get => _searchBranchFilter;
|
||||
get => _filter;
|
||||
set
|
||||
{
|
||||
if (SetProperty(ref _searchBranchFilter, value))
|
||||
if (SetProperty(ref _filter, value))
|
||||
{
|
||||
var builder = BuildBranchTree(_branches, _remotes);
|
||||
LocalBranchTrees = builder.Locals;
|
||||
RemoteBranchTrees = builder.Remotes;
|
||||
VisibleTags = BuildVisibleTags();
|
||||
VisibleSubmodules = BuildVisibleSubmodules();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -152,6 +153,12 @@ namespace SourceGit.ViewModels
|
|||
private set => SetProperty(ref _submodules, value);
|
||||
}
|
||||
|
||||
public List<Models.Submodule> VisibleSubmodules
|
||||
{
|
||||
get => _visibleSubmodules;
|
||||
private set => SetProperty(ref _visibleSubmodules, value);
|
||||
}
|
||||
|
||||
public int LocalChangesCount
|
||||
{
|
||||
get => _localChangesCount;
|
||||
|
@ -391,6 +398,7 @@ namespace SourceGit.ViewModels
|
|||
_tags.Clear();
|
||||
_visibleTags.Clear();
|
||||
_submodules.Clear();
|
||||
_visibleSubmodules.Clear();
|
||||
_searchedCommits.Clear();
|
||||
|
||||
_revisionFiles.Clear();
|
||||
|
@ -525,6 +533,11 @@ namespace SourceGit.ViewModels
|
|||
PopupHost.ShowAndStartPopup(new Cleanup(this));
|
||||
}
|
||||
|
||||
public void ClearFilter()
|
||||
{
|
||||
Filter = string.Empty;
|
||||
}
|
||||
|
||||
public void ClearHistoriesFilter()
|
||||
{
|
||||
_settings.Filters.Clear();
|
||||
|
@ -582,11 +595,6 @@ namespace SourceGit.ViewModels
|
|||
});
|
||||
}
|
||||
|
||||
public void ClearSearchBranchFilter()
|
||||
{
|
||||
SearchBranchFilter = string.Empty;
|
||||
}
|
||||
|
||||
public void SetWatcherEnabled(bool enabled)
|
||||
{
|
||||
_watcher?.SetEnabled(enabled);
|
||||
|
@ -811,7 +819,12 @@ namespace SourceGit.ViewModels
|
|||
{
|
||||
var submodules = new Commands.QuerySubmodules(_fullpath).Result();
|
||||
_watcher?.SetSubmodules(submodules);
|
||||
Dispatcher.UIThread.Invoke(() => Submodules = submodules);
|
||||
|
||||
Dispatcher.UIThread.Invoke(() =>
|
||||
{
|
||||
Submodules = submodules;
|
||||
VisibleSubmodules = BuildVisibleSubmodules();
|
||||
});
|
||||
}
|
||||
|
||||
public void RefreshWorkingCopyChanges()
|
||||
|
@ -1919,7 +1932,7 @@ namespace SourceGit.ViewModels
|
|||
var builder = new BranchTreeNode.Builder();
|
||||
builder.SetFilters(_settings.Filters);
|
||||
|
||||
if (string.IsNullOrEmpty(_searchBranchFilter))
|
||||
if (string.IsNullOrEmpty(_filter))
|
||||
{
|
||||
builder.CollectExpandedNodes(_localBranchTrees, true);
|
||||
builder.CollectExpandedNodes(_remoteBranchTrees, false);
|
||||
|
@ -1930,7 +1943,7 @@ namespace SourceGit.ViewModels
|
|||
var visibles = new List<Models.Branch>();
|
||||
foreach (var b in branches)
|
||||
{
|
||||
if (b.FullName.Contains(_searchBranchFilter, StringComparison.OrdinalIgnoreCase))
|
||||
if (b.FullName.Contains(_filter, StringComparison.OrdinalIgnoreCase))
|
||||
visibles.Add(b);
|
||||
}
|
||||
|
||||
|
@ -1943,7 +1956,7 @@ namespace SourceGit.ViewModels
|
|||
private List<Models.Tag> BuildVisibleTags()
|
||||
{
|
||||
var visible = new List<Models.Tag>();
|
||||
if (string.IsNullOrEmpty(_searchBranchFilter))
|
||||
if (string.IsNullOrEmpty(_filter))
|
||||
{
|
||||
visible.AddRange(_tags);
|
||||
}
|
||||
|
@ -1951,7 +1964,7 @@ namespace SourceGit.ViewModels
|
|||
{
|
||||
foreach (var t in _tags)
|
||||
{
|
||||
if (t.Name.Contains(_searchBranchFilter, StringComparison.OrdinalIgnoreCase))
|
||||
if (t.Name.Contains(_filter, StringComparison.OrdinalIgnoreCase))
|
||||
visible.Add(t);
|
||||
}
|
||||
}
|
||||
|
@ -1959,6 +1972,24 @@ namespace SourceGit.ViewModels
|
|||
return visible;
|
||||
}
|
||||
|
||||
private List<Models.Submodule> BuildVisibleSubmodules()
|
||||
{
|
||||
var visible = new List<Models.Submodule>();
|
||||
if (string.IsNullOrEmpty(_filter))
|
||||
{
|
||||
visible.AddRange(_submodules);
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach (var s in _submodules)
|
||||
{
|
||||
if (s.Path.Contains(_filter, StringComparison.OrdinalIgnoreCase))
|
||||
visible.Add(s);
|
||||
}
|
||||
}
|
||||
return visible;
|
||||
}
|
||||
|
||||
private void UpdateCurrentRevisionFilesForSearchSuggestion()
|
||||
{
|
||||
_revisionFiles.Clear();
|
||||
|
@ -2002,8 +2033,7 @@ namespace SourceGit.ViewModels
|
|||
private bool _isSubmoduleGroupExpanded = false;
|
||||
private bool _isWorktreeGroupExpanded = false;
|
||||
|
||||
private string _searchBranchFilter = string.Empty;
|
||||
|
||||
private string _filter = string.Empty;
|
||||
private List<Models.Remote> _remotes = new List<Models.Remote>();
|
||||
private List<Models.Branch> _branches = new List<Models.Branch>();
|
||||
private Models.Branch _currentBranch = null;
|
||||
|
@ -2013,8 +2043,9 @@ namespace SourceGit.ViewModels
|
|||
private List<Models.Tag> _tags = new List<Models.Tag>();
|
||||
private List<Models.Tag> _visibleTags = new List<Models.Tag>();
|
||||
private List<Models.Submodule> _submodules = new List<Models.Submodule>();
|
||||
private bool _includeUntracked = true;
|
||||
private List<Models.Submodule> _visibleSubmodules = new List<Models.Submodule>();
|
||||
|
||||
private bool _includeUntracked = true;
|
||||
private InProgressContext _inProgressContext = null;
|
||||
private bool _hasUnsolvedConflicts = false;
|
||||
private Models.Commit _searchResultSelectedCommit = null;
|
||||
|
|
|
@ -128,15 +128,15 @@
|
|||
</Border>
|
||||
</Border>
|
||||
|
||||
<!-- Filter Branches -->
|
||||
<!-- Filter Branches/Tags/Submodules -->
|
||||
<TextBox Grid.Row="1"
|
||||
Height="24"
|
||||
Margin="8,6,4,0"
|
||||
BorderThickness="1"
|
||||
CornerRadius="4"
|
||||
BorderBrush="{DynamicResource Brush.Border2}"
|
||||
Watermark="{DynamicResource Text.Repository.SearchBranchTag}"
|
||||
Text="{Binding SearchBranchFilter, Mode=TwoWay}"
|
||||
Watermark="{DynamicResource Text.Repository.Filter}"
|
||||
Text="{Binding Filter, Mode=TwoWay}"
|
||||
VerticalContentAlignment="Center">
|
||||
<TextBox.InnerLeftContent>
|
||||
<Path Width="14" Height="14"
|
||||
|
@ -149,8 +149,8 @@
|
|||
<Button Classes="icon_button"
|
||||
Width="16"
|
||||
Margin="0,0,6,0"
|
||||
Command="{Binding ClearSearchBranchFilter}"
|
||||
IsVisible="{Binding SearchBranchFilter, Converter={x:Static StringConverters.IsNotNullOrEmpty}}"
|
||||
Command="{Binding ClearFilter}"
|
||||
IsVisible="{Binding Filter, Converter={x:Static StringConverters.IsNotNullOrEmpty}}"
|
||||
HorizontalAlignment="Right">
|
||||
<Path Width="14" Height="14"
|
||||
Margin="0,1,0,0"
|
||||
|
@ -253,7 +253,7 @@
|
|||
Height="0"
|
||||
Margin="8,0,4,0"
|
||||
Classes="repo_left_content_list"
|
||||
ItemsSource="{Binding Submodules}"
|
||||
ItemsSource="{Binding VisibleSubmodules}"
|
||||
SelectionMode="Single"
|
||||
ContextRequested="OnSubmoduleContextRequested"
|
||||
DoubleTapped="OnDoubleTappedSubmodule"
|
||||
|
|
|
@ -252,7 +252,7 @@ namespace SourceGit.Views
|
|||
var remoteBranchRows = vm.IsRemoteGroupExpanded ? RemoteBranchTree.Rows.Count : 0;
|
||||
var desiredBranches = (localBranchRows + remoteBranchRows) * 24.0;
|
||||
var desiredTag = vm.IsTagGroupExpanded ? 24.0 * TagsList.Rows : 0;
|
||||
var desiredSubmodule = vm.IsSubmoduleGroupExpanded ? 24.0 * vm.Submodules.Count : 0;
|
||||
var desiredSubmodule = vm.IsSubmoduleGroupExpanded ? 24.0 * vm.VisibleSubmodules.Count : 0;
|
||||
var desiredWorktree = vm.IsWorktreeGroupExpanded ? 24.0 * vm.Worktrees.Count : 0;
|
||||
var desiredOthers = desiredTag + desiredSubmodule + desiredWorktree;
|
||||
var hasOverflow = (desiredBranches + desiredOthers > leftHeight);
|
||||
|
|
Loading…
Reference in a new issue