mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-05-23 13:14:59 +00:00
refactor: rewrite the histories filter function to supports both include
and exclude
modes (#690)
Signed-off-by: leo <longshuang@msn.cn>
This commit is contained in:
parent
e3ffe3ef6c
commit
ca5bc4b4df
27 changed files with 767 additions and 309 deletions
60
src/Models/Filter.cs
Normal file
60
src/Models/Filter.cs
Normal file
|
@ -0,0 +1,60 @@
|
|||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
|
||||
namespace SourceGit.Models
|
||||
{
|
||||
public enum FilterType
|
||||
{
|
||||
LocalBranch = 0,
|
||||
LocalBranchFolder,
|
||||
RemoteBranch,
|
||||
RemoteBranchFolder,
|
||||
Tag,
|
||||
}
|
||||
|
||||
public enum FilterMode
|
||||
{
|
||||
None = 0,
|
||||
Included,
|
||||
Excluded,
|
||||
}
|
||||
|
||||
public class Filter : ObservableObject
|
||||
{
|
||||
public string Pattern
|
||||
{
|
||||
get => _pattern;
|
||||
set => SetProperty(ref _pattern, value);
|
||||
}
|
||||
|
||||
public FilterType Type
|
||||
{
|
||||
get;
|
||||
set;
|
||||
} = FilterType.LocalBranch;
|
||||
|
||||
public FilterMode Mode
|
||||
{
|
||||
get => _mode;
|
||||
set => SetProperty(ref _mode, value);
|
||||
}
|
||||
|
||||
public bool IsBranch
|
||||
{
|
||||
get => Type != FilterType.Tag;
|
||||
}
|
||||
|
||||
public Filter()
|
||||
{
|
||||
}
|
||||
|
||||
public Filter(string pattern, FilterType type, FilterMode mode)
|
||||
{
|
||||
_pattern = pattern;
|
||||
_mode = mode;
|
||||
Type = type;
|
||||
}
|
||||
|
||||
private string _pattern = string.Empty;
|
||||
private FilterMode _mode = FilterMode.None;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue