diff --git a/src/Models/CustomAction.cs b/src/Models/CustomAction.cs
index 4e9107a1..c6130fe0 100644
--- a/src/Models/CustomAction.cs
+++ b/src/Models/CustomAction.cs
@@ -8,6 +8,7 @@ namespace SourceGit.Models
Repository,
Commit,
Branch,
+ Tag,
}
public enum CustomActionControlType
diff --git a/src/Resources/Locales/en_US.axaml b/src/Resources/Locales/en_US.axaml
index b3c41d33..f5cc4e68 100644
--- a/src/Resources/Locales/en_US.axaml
+++ b/src/Resources/Locales/en_US.axaml
@@ -160,7 +160,7 @@
Template Name:
CUSTOM ACTION
Arguments:
- ${REPO} - Repository's path; ${BRANCH} - Selected branch; ${SHA} - Selected commit's SHA
+ Built-in parameters: ${REPO} - Repository's path; ${BRANCH} - Selected branch; ${SHA} - Selected commit's SHA; ${TAG} - Selected tag
Executable File:
Input Controls:
Edit
@@ -170,6 +170,7 @@
Branch
Commit
Repository
+ Tag
Wait for action exit
Email Address
Email address
@@ -747,6 +748,7 @@
OK
Copy Tag Name
Copy Tag Message
+ Custom Action
Delete ${0}$...
Merge ${0}$ into ${1}$...
Push ${0}$...
diff --git a/src/Resources/Locales/zh_CN.axaml b/src/Resources/Locales/zh_CN.axaml
index 3cc822a2..13ef2c64 100644
--- a/src/Resources/Locales/zh_CN.axaml
+++ b/src/Resources/Locales/zh_CN.axaml
@@ -164,7 +164,7 @@
模板名 :
自定义操作
命令行参数 :
- 请使用${REPO}代替仓库路径,${BRANCH}代替选中的分支,${SHA}代替提交哈希
+ 内置变量:${REPO} 仓库路径、${BRANCH} 选中的分支、${SHA} 选中的提交哈希,${TAG} 选中的标签
可执行文件路径 :
输入控件 :
编辑
@@ -174,6 +174,7 @@
选中的分支
选中的提交
仓库
+ 选中的标签
等待操作执行完成
电子邮箱
邮箱地址
@@ -751,6 +752,7 @@
确 定
复制标签名
复制标签信息
+ 自定义操作
删除 ${0}$...
合并 ${0}$ 到 ${1}$...
推送 ${0}$...
diff --git a/src/Resources/Locales/zh_TW.axaml b/src/Resources/Locales/zh_TW.axaml
index dc4a227b..b7959568 100644
--- a/src/Resources/Locales/zh_TW.axaml
+++ b/src/Resources/Locales/zh_TW.axaml
@@ -164,7 +164,7 @@
範本名稱:
自訂動作
指令參數:
- 使用 ${REPO} 表示存放庫路徑、${BRANCH} 表示所選的分支、${SHA} 表示所選的提交編號
+ 內建參數: ${REPO} 存放庫路徑、${BRANCH} 所選的分支、${SHA} 所選的提交編號、${TAG} 所選的標籤
可執行檔案路徑:
輸入控件:
編輯
@@ -174,6 +174,7 @@
選取的分支
選取的提交
存放庫
+ 選取的標籤
等待自訂動作執行結束
電子郵件
電子郵件地址
@@ -751,6 +752,7 @@
確 定
複製標籤名稱
複製標籤訊息
+ 自訂動作
刪除 ${0}$...
合併 ${0}$ 到 ${1}$...
推送 ${0}$...
diff --git a/src/ViewModels/ExecuteCustomAction.cs b/src/ViewModels/ExecuteCustomAction.cs
index 5effd3a1..b26e2f67 100644
--- a/src/ViewModels/ExecuteCustomAction.cs
+++ b/src/ViewModels/ExecuteCustomAction.cs
@@ -111,6 +111,14 @@ namespace SourceGit.ViewModels
PrepareControlParameters();
}
+ public ExecuteCustomAction(Repository repo, Models.CustomAction action, Models.Tag tag)
+ {
+ _repo = repo;
+ _commandline = action.Arguments.Replace("${REPO}", GetWorkdir()).Replace("${TAG}", tag.Name);
+ CustomAction = action;
+ PrepareControlParameters();
+ }
+
public override Task Sure()
{
_repo.SetWatcherEnabled(false);
diff --git a/src/ViewModels/Repository.cs b/src/ViewModels/Repository.cs
index 7c8476a3..cc6314ce 100644
--- a/src/ViewModels/Repository.cs
+++ b/src/ViewModels/Repository.cs
@@ -834,6 +834,8 @@ namespace SourceGit.ViewModels
popup = new ExecuteCustomAction(this, action, b);
else if (scope is Models.Commit c)
popup = new ExecuteCustomAction(this, action, c);
+ else if (scope is Models.Tag t)
+ popup = new ExecuteCustomAction(this, action, t);
else
popup = new ExecuteCustomAction(this, action);
@@ -2388,6 +2390,41 @@ namespace SourceGit.ViewModels
ev.Handled = true;
};
+ var menu = new ContextMenu();
+ menu.Items.Add(createBranch);
+ menu.Items.Add(new MenuItem() { Header = "-" });
+ menu.Items.Add(pushTag);
+ menu.Items.Add(deleteTag);
+ menu.Items.Add(new MenuItem() { Header = "-" });
+ menu.Items.Add(archive);
+ menu.Items.Add(new MenuItem() { Header = "-" });
+
+ var actions = GetCustomActions(Models.CustomActionScope.Tag);
+ if (actions.Count > 0)
+ {
+ var custom = new MenuItem();
+ custom.Header = App.Text("TagCM.CustomAction");
+ custom.Icon = App.CreateMenuIcon("Icons.Action");
+
+ foreach (var action in actions)
+ {
+ var dup = action;
+ var item = new MenuItem();
+ item.Icon = App.CreateMenuIcon("Icons.Action");
+ item.Header = dup.Name;
+ item.Click += (_, e) =>
+ {
+ ExecCustomAction(dup, tag);
+ e.Handled = true;
+ };
+
+ custom.Items.Add(item);
+ }
+
+ menu.Items.Add(custom);
+ menu.Items.Add(new MenuItem() { Header = "-" });
+ }
+
var copy = new MenuItem();
copy.Header = App.Text("TagCM.Copy");
copy.Icon = App.CreateMenuIcon("Icons.Copy");
@@ -2407,14 +2444,6 @@ namespace SourceGit.ViewModels
ev.Handled = true;
};
- var menu = new ContextMenu();
- menu.Items.Add(createBranch);
- menu.Items.Add(new MenuItem() { Header = "-" });
- menu.Items.Add(pushTag);
- menu.Items.Add(deleteTag);
- menu.Items.Add(new MenuItem() { Header = "-" });
- menu.Items.Add(archive);
- menu.Items.Add(new MenuItem() { Header = "-" });
menu.Items.Add(copy);
menu.Items.Add(copyMessage);
return menu;
diff --git a/src/Views/Preferences.axaml b/src/Views/Preferences.axaml
index b392068b..275f72e7 100644
--- a/src/Views/Preferences.axaml
+++ b/src/Views/Preferences.axaml
@@ -644,6 +644,7 @@
+
diff --git a/src/Views/RepositoryConfigure.axaml b/src/Views/RepositoryConfigure.axaml
index ecf10aba..a3dbf724 100644
--- a/src/Views/RepositoryConfigure.axaml
+++ b/src/Views/RepositoryConfigure.axaml
@@ -472,6 +472,7 @@
+