From f754b2c63a931f052d27a9cd4f447e2d5ee909e5 Mon Sep 17 00:00:00 2001 From: leo Date: Mon, 5 Aug 2024 17:34:49 +0800 Subject: [PATCH] feature: supports issue tracker in commit message (#315) --- src/App.JsonCodeGen.cs | 1 + src/Resources/Icons.axaml | 1 + src/Resources/Locales/en_US.axaml | 9 + src/Resources/Locales/zh_CN.axaml | 9 + src/Resources/Locales/zh_TW.axaml | 9 + src/Resources/Styles.axaml | 8 + src/ViewModels/CommitDetail.cs | 13 +- src/ViewModels/FileHistories.cs | 4 +- src/ViewModels/Histories.cs | 4 +- src/ViewModels/InteractiveRebase.cs | 2 +- src/ViewModels/IssueTrackerRule.cs | 164 ++++++++++++++++++ src/ViewModels/Repository.cs | 27 +++ src/ViewModels/RepositoryConfigure.cs | 49 +++++- src/ViewModels/WorkingCopy.cs | 2 +- src/Views/CommitBaseInfo.axaml | 7 +- src/Views/CommitBaseInfo.axaml.cs | 9 + src/Views/CommitDetail.axaml | 4 +- src/Views/CommitMessagePresenter.cs | 97 +++++++++++ src/Views/RepositoryConfigure.axaml | 224 +++++++++++++++++-------- src/Views/RepositoryConfigure.axaml.cs | 5 - 20 files changed, 563 insertions(+), 85 deletions(-) create mode 100644 src/ViewModels/IssueTrackerRule.cs create mode 100644 src/Views/CommitMessagePresenter.cs diff --git a/src/App.JsonCodeGen.cs b/src/App.JsonCodeGen.cs index f6e3cd88..228928a7 100644 --- a/src/App.JsonCodeGen.cs +++ b/src/App.JsonCodeGen.cs @@ -64,5 +64,6 @@ namespace SourceGit [JsonSerializable(typeof(Models.Version))] [JsonSerializable(typeof(Models.RepositorySettings))] [JsonSerializable(typeof(ViewModels.Preference))] + [JsonSerializable(typeof(ViewModels.IssueTrackerRuleSetting))] internal partial class JsonCodeGen : JsonSerializerContext { } } diff --git a/src/Resources/Icons.axaml b/src/Resources/Icons.axaml index e2940f68..5e79e402 100644 --- a/src/Resources/Icons.axaml +++ b/src/Resources/Icons.axaml @@ -52,6 +52,7 @@ M512 0C229 0 0 229 0 512s229 512 512 512 512-229 512-512S795 0 512 0zM512 928c-230 0-416-186-416-416S282 96 512 96s416 186 416 416S742 928 512 928zM538 343c47 0 83-38 83-78 0-32-21-61-62-61-55 0-82 45-82 77C475 320 498 343 538 343zM533 729c-8 0-11-10-3-40l43-166c16-61 11-100-22-100-39 0-131 40-211 108l16 27c25-17 68-35 78-35 8 0 7 10 0 36l-38 158c-23 89 1 110 34 110 33 0 118-30 196-110l-19-25C575 717 543 729 533 729z M412 66C326 132 271 233 271 347c0 17 1 34 4 50-41-48-98-79-162-83a444 444 0 00-46 196c0 207 142 382 337 439h2c19 0 34 15 34 33 0 11-6 21-14 26l1 14C183 973 0 763 0 511 0 272 166 70 393 7A35 35 0 01414 0c19 0 34 15 34 33a33 33 0 01-36 33zm200 893c86-66 141-168 141-282 0-17-1-34-4-50 41 48 98 79 162 83a444 444 0 0046-196c0-207-142-382-337-439h-2a33 33 0 01-34-33c0-11 6-21 14-26L596 0C841 51 1024 261 1024 513c0 239-166 441-393 504A35 35 0 01610 1024a33 33 0 01-34-33 33 33 0 0136-33zM512 704a192 192 0 110-384 192 192 0 010 384z M512 64A447 447 0 0064 512c0 248 200 448 448 448s448-200 448-448S760 64 512 64zM218 295h31c54 0 105 19 145 55 13 12 13 31 3 43a35 35 0 01-22 10 36 36 0 01-21-7 155 155 0 00-103-39h-31a32 32 0 01-31-31c0-18 13-31 30-31zm31 433h-31a32 32 0 01-31-31c0-16 13-31 31-31h31A154 154 0 00403 512 217 217 0 01620 295h75l-93-67a33 33 0 01-7-43 33 33 0 0143-7l205 148-205 148a29 29 0 01-18 6 32 32 0 01-31-31c0-10 4-19 13-25l93-67H620a154 154 0 00-154 154c0 122-97 220-217 220zm390 118a29 29 0 01-18 6 32 32 0 01-31-31c0-10 4-19 13-25l93-67h-75c-52 0-103-19-143-54-12-12-13-31-1-43a30 30 0 0142-3 151 151 0 00102 39h75L602 599a33 33 0 01-7-43 33 33 0 0143-7l205 148-203 151z + M922 39H102A65 65 0 0039 106v609a65 65 0 0063 68h94v168a34 34 0 0019 31 30 30 0 0012 3 30 30 0 0022-10l182-192H922a65 65 0 0063-68V106A65 65 0 00922 39zM288 378h479a34 34 0 010 68H288a34 34 0 010-68zm0-135h479a34 34 0 010 68H288a34 34 0 010-68zm0 270h310a34 34 0 010 68H288a34 34 0 010-68z M640 96c-158 0-288 130-288 288 0 17 3 31 5 46L105 681 96 691V928h224v-96h96v-96h96v-95c38 18 82 31 128 31 158 0 288-130 288-288s-130-288-288-288zm0 64c123 0 224 101 224 224s-101 224-224 224a235 235 0 01-109-28l-8-4H448v96h-96v96H256v96H160v-146l253-254 12-11-3-17C419 417 416 400 416 384c0-123 101-224 224-224zm64 96a64 64 0 100 128 64 64 0 100-128z M875 117H149C109 117 75 151 75 192v640c0 41 34 75 75 75h725c41 0 75-34 75-75V192c0-41-34-75-75-75zM139 832V192c0-6 4-11 11-11h331v661H149c-6 0-11-4-11-11zm747 0c0 6-4 11-11 11H544v-661H875c6 0 11 4 11 11v640z M875 117H149C109 117 75 151 75 192v640c0 41 34 75 75 75h725c41 0 75-34 75-75V192c0-41-34-75-75-75zm-725 64h725c6 0 11 4 11 11v288h-747V192c0-6 4-11 11-11zm725 661H149c-6 0-11-4-11-11V544h747V832c0 6-4 11-11 11z diff --git a/src/Resources/Locales/en_US.axaml b/src/Resources/Locales/en_US.axaml index d95d4c74..2c1e570e 100644 --- a/src/Resources/Locales/en_US.axaml +++ b/src/Resources/Locales/en_US.axaml @@ -124,6 +124,15 @@ Repository Configure Email Address Email address + GIT + ISSUE TRACKER + Add Sample Github Rule + Add Sample Jira Rule + New Rule + Issue Regex Expression: + Rule Name: + Result URL: + Please use $1, $2 to access regex groups values. HTTP Proxy HTTP proxy used by this repository User Name diff --git a/src/Resources/Locales/zh_CN.axaml b/src/Resources/Locales/zh_CN.axaml index 537c0d6c..c0ef6b6e 100644 --- a/src/Resources/Locales/zh_CN.axaml +++ b/src/Resources/Locales/zh_CN.axaml @@ -127,6 +127,15 @@ 仓库配置 电子邮箱 邮箱地址 + GIT配置 + ISSUE追踪 + 新增匹配Github Issue规则 + 新增匹配Jira规则 + 新增自定义规则 + 匹配ISSUE的正则表达式 : + 规则名 : + 为ISSUE生成的URL链接 : + 可在URL中使用$1,$2等变量填入正则表达式匹配的内容 HTTP代理 HTTP网络代理 用户名 diff --git a/src/Resources/Locales/zh_TW.axaml b/src/Resources/Locales/zh_TW.axaml index 25df2430..f991c912 100644 --- a/src/Resources/Locales/zh_TW.axaml +++ b/src/Resources/Locales/zh_TW.axaml @@ -127,6 +127,15 @@ 倉庫配置 電子郵箱 郵箱地址 + GIT配置 + ISSUE追蹤 + 新增匹配Github Issue規則 + 新增匹配Jira規則 + 新增自定義規則 + 匹配ISSUE的正則表達式 : + 規則名 : + 為ISSUE生成的URL連結 : + 可在URL中使用$1,$2等變數填入正則表示式匹配的內容 HTTP代理 HTTP網路代理 使用者名稱 diff --git a/src/Resources/Styles.axaml b/src/Resources/Styles.axaml index ad443a2c..c87b2c84 100644 --- a/src/Resources/Styles.axaml +++ b/src/Resources/Styles.axaml @@ -164,6 +164,7 @@ + @@ -276,6 +277,13 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Views/RepositoryConfigure.axaml.cs b/src/Views/RepositoryConfigure.axaml.cs index 0faa943b..b309453d 100644 --- a/src/Views/RepositoryConfigure.axaml.cs +++ b/src/Views/RepositoryConfigure.axaml.cs @@ -16,11 +16,6 @@ namespace SourceGit.Views } private void CloseWindow(object _1, RoutedEventArgs _2) - { - Close(); - } - - private void SaveAndClose(object _1, RoutedEventArgs _2) { (DataContext as ViewModels.RepositoryConfigure)?.Save(); Close();