mirror of
https://github.com/sourcegit-scm/sourcegit.git
synced 2024-11-01 13:13:21 -07:00
enhance: supports search commits by changed file path like src/Commands/*
or */Add.cs
.
This commit is contained in:
parent
89f2d3dd11
commit
6426da3289
5 changed files with 59 additions and 16 deletions
|
@ -384,7 +384,9 @@
|
||||||
<x:String x:Key="Text.Repository.Remotes.Add" xml:space="preserve">ADD REMOTE</x:String>
|
<x:String x:Key="Text.Repository.Remotes.Add" xml:space="preserve">ADD REMOTE</x:String>
|
||||||
<x:String x:Key="Text.Repository.Resolve" xml:space="preserve">RESOLVE</x:String>
|
<x:String x:Key="Text.Repository.Resolve" xml:space="preserve">RESOLVE</x:String>
|
||||||
<x:String x:Key="Text.Repository.Search" xml:space="preserve">Search Commit</x:String>
|
<x:String x:Key="Text.Repository.Search" xml:space="preserve">Search Commit</x:String>
|
||||||
<x:String x:Key="Text.Repository.SearchTip" xml:space="preserve">Search Author/Committer/Message/SHA</x:String>
|
<x:String x:Key="Text.Repository.Search.By" xml:space="preserve">Search By</x:String>
|
||||||
|
<x:String x:Key="Text.Repository.Search.ByBaseInfo" xml:space="preserve">Information</x:String>
|
||||||
|
<x:String x:Key="Text.Repository.Search.ByFile" xml:space="preserve">File</x:String>
|
||||||
<x:String x:Key="Text.Repository.Statistics" xml:space="preserve">Statistics</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>
|
<x:String x:Key="Text.Repository.Submodules" xml:space="preserve">SUBMODULES</x:String>
|
||||||
<x:String x:Key="Text.Repository.Submodules.Add" xml:space="preserve">ADD SUBMODULE</x:String>
|
<x:String x:Key="Text.Repository.Submodules.Add" xml:space="preserve">ADD SUBMODULE</x:String>
|
||||||
|
|
|
@ -387,7 +387,9 @@
|
||||||
<x:String x:Key="Text.Repository.Remotes.Add" xml:space="preserve">添加远程</x:String>
|
<x:String x:Key="Text.Repository.Remotes.Add" xml:space="preserve">添加远程</x:String>
|
||||||
<x:String x:Key="Text.Repository.Resolve" xml:space="preserve">解决冲突</x:String>
|
<x:String x:Key="Text.Repository.Resolve" xml:space="preserve">解决冲突</x:String>
|
||||||
<x:String x:Key="Text.Repository.Search" xml:space="preserve">查找提交</x:String>
|
<x:String x:Key="Text.Repository.Search" xml:space="preserve">查找提交</x:String>
|
||||||
<x:String x:Key="Text.Repository.SearchTip" xml:space="preserve">支持搜索作者/提交者/主题/指纹</x:String>
|
<x:String x:Key="Text.Repository.Search.By" xml:space="preserve">搜索途径</x:String>
|
||||||
|
<x:String x:Key="Text.Repository.Search.ByBaseInfo" xml:space="preserve">摘要</x:String>
|
||||||
|
<x:String x:Key="Text.Repository.Search.ByFile" xml:space="preserve">文件</x:String>
|
||||||
<x:String x:Key="Text.Repository.Statistics" 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>
|
<x:String x:Key="Text.Repository.Submodules" xml:space="preserve">子模块列表</x:String>
|
||||||
<x:String x:Key="Text.Repository.Submodules.Add" xml:space="preserve">添加子模块</x:String>
|
<x:String x:Key="Text.Repository.Submodules.Add" xml:space="preserve">添加子模块</x:String>
|
||||||
|
|
|
@ -387,7 +387,9 @@
|
||||||
<x:String x:Key="Text.Repository.Remotes.Add" xml:space="preserve">新增遠端</x:String>
|
<x:String x:Key="Text.Repository.Remotes.Add" xml:space="preserve">新增遠端</x:String>
|
||||||
<x:String x:Key="Text.Repository.Resolve" xml:space="preserve">解決衝突</x:String>
|
<x:String x:Key="Text.Repository.Resolve" xml:space="preserve">解決衝突</x:String>
|
||||||
<x:String x:Key="Text.Repository.Search" xml:space="preserve">查詢提交</x:String>
|
<x:String x:Key="Text.Repository.Search" xml:space="preserve">查詢提交</x:String>
|
||||||
<x:String x:Key="Text.Repository.SearchTip" xml:space="preserve">支援搜尋作者/提交者/主題/指紋</x:String>
|
<x:String x:Key="Text.Repository.Search.By" xml:space="preserve">查詢方式</x:String>
|
||||||
|
<x:String x:Key="Text.Repository.Search.ByBaseInfo" xml:space="preserve">摘要</x:String>
|
||||||
|
<x:String x:Key="Text.Repository.Search.ByFile" xml:space="preserve">檔案</x:String>
|
||||||
<x:String x:Key="Text.Repository.Statistics" 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>
|
<x:String x:Key="Text.Repository.Submodules" xml:space="preserve">子模組列表</x:String>
|
||||||
<x:String x:Key="Text.Repository.Submodules.Add" xml:space="preserve">新增子模組</x:String>
|
<x:String x:Key="Text.Repository.Submodules.Add" xml:space="preserve">新增子模組</x:String>
|
||||||
|
|
|
@ -185,6 +185,13 @@ namespace SourceGit.ViewModels
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[JsonIgnore]
|
||||||
|
public int SearchCommitFilterType
|
||||||
|
{
|
||||||
|
get => _searchCommitFilterType;
|
||||||
|
set => SetProperty(ref _searchCommitFilterType, value);
|
||||||
|
}
|
||||||
|
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
public string SearchCommitFilter
|
public string SearchCommitFilter
|
||||||
{
|
{
|
||||||
|
@ -416,6 +423,9 @@ namespace SourceGit.ViewModels
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var visible = new List<Models.Commit>();
|
var visible = new List<Models.Commit>();
|
||||||
|
|
||||||
|
if (_searchCommitFilterType == 0)
|
||||||
|
{
|
||||||
foreach (var c in _histories.Commits)
|
foreach (var c in _histories.Commits)
|
||||||
{
|
{
|
||||||
if (c.SHA.Contains(_searchCommitFilter, StringComparison.OrdinalIgnoreCase)
|
if (c.SHA.Contains(_searchCommitFilter, StringComparison.OrdinalIgnoreCase)
|
||||||
|
@ -428,6 +438,11 @@ namespace SourceGit.ViewModels
|
||||||
visible.Add(c);
|
visible.Add(c);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
visible = new Commands.QueryCommits(FullPath, $"-1000 -- \"{_searchCommitFilter}\"", false).Result();
|
||||||
|
}
|
||||||
|
|
||||||
SearchedCommits = visible;
|
SearchedCommits = visible;
|
||||||
}
|
}
|
||||||
|
@ -1508,6 +1523,7 @@ namespace SourceGit.ViewModels
|
||||||
private object _selectedView = null;
|
private object _selectedView = null;
|
||||||
|
|
||||||
private bool _isSearching = false;
|
private bool _isSearching = false;
|
||||||
|
private int _searchCommitFilterType = 0;
|
||||||
private string _searchCommitFilter = string.Empty;
|
private string _searchCommitFilter = string.Empty;
|
||||||
private List<Models.Commit> _searchedCommits = new List<Models.Commit>();
|
private List<Models.Commit> _searchedCommits = new List<Models.Commit>();
|
||||||
|
|
||||||
|
|
|
@ -493,17 +493,17 @@
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
<!-- Left Search Mode -->
|
<!-- Left Search Mode -->
|
||||||
<Grid Grid.Column="0" RowDefinitions="32,*" IsVisible="{Binding IsSearching}" PropertyChanged="OnSearchCommitPanelPropertyChanged">
|
<Grid Grid.Column="0" RowDefinitions="32,32,*" IsVisible="{Binding IsSearching}" PropertyChanged="OnSearchCommitPanelPropertyChanged">
|
||||||
<!-- Search -->
|
<!-- Search -->
|
||||||
<TextBox Grid.Row="0"
|
<TextBox Grid.Row="0"
|
||||||
x:Name="txtSearchCommitsBox"
|
x:Name="txtSearchCommitsBox"
|
||||||
Margin="4,2"
|
Margin="4,2,4,0"
|
||||||
Height="24"
|
Height="24"
|
||||||
BorderThickness="1"
|
BorderThickness="1"
|
||||||
BorderBrush="{DynamicResource Brush.Border2}"
|
BorderBrush="{DynamicResource Brush.Border2}"
|
||||||
Background="{DynamicResource Brush.Contents}"
|
Background="{DynamicResource Brush.Contents}"
|
||||||
CornerRadius="4"
|
CornerRadius="4"
|
||||||
Watermark="{DynamicResource Text.Repository.SearchTip}"
|
Watermark="{DynamicResource Text.Repository.Search}"
|
||||||
Text="{Binding SearchCommitFilter, Mode=TwoWay}"
|
Text="{Binding SearchCommitFilter, Mode=TwoWay}"
|
||||||
VerticalContentAlignment="Center"
|
VerticalContentAlignment="Center"
|
||||||
KeyDown="OnSearchKeyDown">
|
KeyDown="OnSearchKeyDown">
|
||||||
|
@ -529,7 +529,27 @@
|
||||||
</TextBox.InnerRightContent>
|
</TextBox.InnerRightContent>
|
||||||
</TextBox>
|
</TextBox>
|
||||||
|
|
||||||
<DataGrid Grid.Row="1"
|
<Grid Grid.Row="1" ColumnDefinitions="Auto,*" Margin="4,0">
|
||||||
|
<TextBlock Grid.Column="0"
|
||||||
|
Text="{DynamicResource Text.Repository.Search.By}"
|
||||||
|
Foreground="{DynamicResource Brush.FG2}"
|
||||||
|
Margin="2,0,0,0"/>
|
||||||
|
|
||||||
|
<ComboBox Grid.Column="1"
|
||||||
|
MinHeight="24" Height="24"
|
||||||
|
Padding="8,0"
|
||||||
|
Background="{DynamicResource Brush.Contents}"
|
||||||
|
BorderBrush="{DynamicResource Brush.Border2}"
|
||||||
|
HorizontalAlignment="Right"
|
||||||
|
SelectedIndex="{Binding SearchCommitFilterType, Mode=TwoWay}">
|
||||||
|
<ComboBox.Items>
|
||||||
|
<TextBlock Text="{DynamicResource Text.Repository.Search.ByBaseInfo}" FontSize="12"/>
|
||||||
|
<TextBlock Text="{DynamicResource Text.Repository.Search.ByFile}" FontSize="12"/>
|
||||||
|
</ComboBox.Items>
|
||||||
|
</ComboBox>
|
||||||
|
</Grid>
|
||||||
|
|
||||||
|
<DataGrid Grid.Row="2"
|
||||||
ItemsSource="{Binding SearchedCommits}"
|
ItemsSource="{Binding SearchedCommits}"
|
||||||
SelectionMode="Single"
|
SelectionMode="Single"
|
||||||
SelectedItem="{Binding SearchResultSelectedCommit, Mode=OneWay}"
|
SelectedItem="{Binding SearchResultSelectedCommit, Mode=OneWay}"
|
||||||
|
@ -544,6 +564,7 @@
|
||||||
BorderBrush="{DynamicResource Brush.Border2}"
|
BorderBrush="{DynamicResource Brush.Border2}"
|
||||||
Background="{DynamicResource Brush.Contents}"
|
Background="{DynamicResource Brush.Contents}"
|
||||||
Margin="4,0,4,4"
|
Margin="4,0,4,4"
|
||||||
|
CornerRadius="4"
|
||||||
HorizontalScrollBarVisibility="Disabled"
|
HorizontalScrollBarVisibility="Disabled"
|
||||||
VerticalScrollBarVisibility="Auto"
|
VerticalScrollBarVisibility="Auto"
|
||||||
SelectionChanged="OnSearchResultDataGridSelectionChanged">
|
SelectionChanged="OnSearchResultDataGridSelectionChanged">
|
||||||
|
@ -572,7 +593,7 @@
|
||||||
</DataGrid.Columns>
|
</DataGrid.Columns>
|
||||||
</DataGrid>
|
</DataGrid>
|
||||||
|
|
||||||
<Path Grid.Row="1"
|
<Path Grid.Row="2"
|
||||||
HorizontalAlignment="Center" VerticalAlignment="Center"
|
HorizontalAlignment="Center" VerticalAlignment="Center"
|
||||||
Width="48" Height="48"
|
Width="48" Height="48"
|
||||||
Data="{StaticResource Icons.Empty}"
|
Data="{StaticResource Icons.Empty}"
|
||||||
|
|
Loading…
Reference in a new issue