Skip to content

Commit 5142a5f

Browse files
committed
refactor!: split repository settings into two parts - shared settings and ui states (#2071)
- All the attributes that can be changed from `Repository Configuration` window is `shared settings`, and will shared (also synced) between worktrees - The other UI states, such as current history filters, branch/tag sort methods, tree states etc., will be saved into each worktree's real git dir. And those states will not be synced between each others. BREAKING CHANGE: Users will lost their old UI states. But the shared settings remains.
1 parent 3b576b0 commit 5142a5f

20 files changed

+694
-640
lines changed

src/App.JsonCodeGen.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,12 +60,12 @@ public override void Write(Utf8JsonWriter writer, DataGridLength value, JsonSeri
6060
]
6161
)]
6262
[JsonSerializable(typeof(Models.ExternalToolCustomization))]
63-
[JsonSerializable(typeof(Models.HistoryFilterCollection))]
6463
[JsonSerializable(typeof(Models.InteractiveRebaseJobCollection))]
6564
[JsonSerializable(typeof(Models.JetBrainsState))]
6665
[JsonSerializable(typeof(Models.ThemeOverrides))]
6766
[JsonSerializable(typeof(Models.Version))]
6867
[JsonSerializable(typeof(Models.RepositorySettings))]
68+
[JsonSerializable(typeof(Models.RepositoryUIStates))]
6969
[JsonSerializable(typeof(List<Models.ConventionalCommitType>))]
7070
[JsonSerializable(typeof(List<Models.LFSLock>))]
7171
[JsonSerializable(typeof(List<Models.VisualStudioInstance>))]

src/Models/HistoryFilter.cs

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
using CommunityToolkit.Mvvm.ComponentModel;
2+
3+
namespace SourceGit.Models
4+
{
5+
public enum FilterType
6+
{
7+
LocalBranch = 0,
8+
LocalBranchFolder,
9+
RemoteBranch,
10+
RemoteBranchFolder,
11+
Tag,
12+
}
13+
14+
public enum FilterMode
15+
{
16+
None = 0,
17+
Included,
18+
Excluded,
19+
}
20+
21+
public class HistoryFilter : ObservableObject
22+
{
23+
public string Pattern
24+
{
25+
get => _pattern;
26+
set => SetProperty(ref _pattern, value);
27+
}
28+
29+
public FilterType Type
30+
{
31+
get;
32+
set;
33+
} = FilterType.LocalBranch;
34+
35+
public FilterMode Mode
36+
{
37+
get => _mode;
38+
set => SetProperty(ref _mode, value);
39+
}
40+
41+
public bool IsBranch
42+
{
43+
get => Type != FilterType.Tag;
44+
}
45+
46+
public HistoryFilter()
47+
{
48+
}
49+
50+
public HistoryFilter(string pattern, FilterType type, FilterMode mode)
51+
{
52+
_pattern = pattern;
53+
_mode = mode;
54+
Type = type;
55+
}
56+
57+
private string _pattern = string.Empty;
58+
private FilterMode _mode = FilterMode.None;
59+
}
60+
}

src/Models/HistoryFilterCollection.cs

Lines changed: 0 additions & 258 deletions
This file was deleted.

0 commit comments

Comments
 (0)