Skip to content

Commit e30c1e0

Browse files
committed
feature: add File scope for custom action (#1872)
If file is selected from commit changes or revision files, the `${SHA}` will be set to the SHA of that commit Signed-off-by: leo <longshuang@msn.cn>
1 parent 1fda332 commit e30c1e0

16 files changed

+121
-6
lines changed

src/Models/CustomAction.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ public enum CustomActionScope
1010
Branch,
1111
Tag,
1212
Remote,
13+
File,
1314
}
1415

1516
public enum CustomActionControlType
@@ -20,6 +21,8 @@ public enum CustomActionControlType
2021
ComboBox,
2122
}
2223

24+
public record CustomActionTargetFile(string File, Commit Revision);
25+
2326
public class CustomActionControl : ObservableObject
2427
{
2528
public CustomActionControlType Type

src/Resources/Locales/de_DE.axaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,7 @@
209209
${BRANCH_FRIENDLY_NAME} Freundlicher Name des selektierten Branches, enthält ${REMOTE}-Teil für Remote-Branches
210210
${SHA} Hash des selektierten Commits
211211
${TAG} selektiertes Tag
212+
${FILE} Ausgewählte Datei, relativ zum Stammverzeichnis des Repositorys
212213
$1, $2 ... Werte der Eingabe-Steuerelemente
213214
</x:String>
214215
<x:String x:Key="Text.Configure.CustomAction.Executable" xml:space="preserve">Ausführbare Datei:</x:String>
@@ -218,6 +219,7 @@
218219
<x:String x:Key="Text.Configure.CustomAction.Scope" xml:space="preserve">Geltungsbereich:</x:String>
219220
<x:String x:Key="Text.Configure.CustomAction.Scope.Branch" xml:space="preserve">Branch</x:String>
220221
<x:String x:Key="Text.Configure.CustomAction.Scope.Commit" xml:space="preserve">Commit</x:String>
222+
<x:String x:Key="Text.Configure.CustomAction.Scope.File" xml:space="preserve">Datei</x:String>
221223
<x:String x:Key="Text.Configure.CustomAction.Scope.Remote" xml:space="preserve">Remote</x:String>
222224
<x:String x:Key="Text.Configure.CustomAction.Scope.Repository" xml:space="preserve">Repository</x:String>
223225
<x:String x:Key="Text.Configure.CustomAction.Scope.Tag" xml:space="preserve">Tag</x:String>
@@ -261,7 +263,7 @@
261263
<x:String x:Key="Text.ConfigureCustomActionControls.Label" xml:space="preserve">Bezeichnung:</x:String>
262264
<x:String x:Key="Text.ConfigureCustomActionControls.Options" xml:space="preserve">Einträge:</x:String>
263265
<x:String x:Key="Text.ConfigureCustomActionControls.Options.Tip" xml:space="preserve">Nutze '|', um Einträge zu trennen</x:String>
264-
<x:String x:Key="Text.ConfigureCustomActionControls.StringValue.Tip" xml:space="preserve">Die vordefinierten Parameter ${REPO}, ${REMOTE}, ${BRANCH}, ${BRANCH_FRIENDLY_NAME}, ${SHA}, and ${TAG} bleiben hier verwendbar</x:String>
266+
<x:String x:Key="Text.ConfigureCustomActionControls.StringValue.Tip" xml:space="preserve">Die vordefinierten Parameter ${REPO}, ${REMOTE}, ${BRANCH}, ${BRANCH_FRIENDLY_NAME}, ${SHA}, ${FILE}, and ${TAG} bleiben hier verwendbar</x:String>
265267
<x:String x:Key="Text.ConfigureCustomActionControls.Type" xml:space="preserve">Typ:</x:String>
266268
<x:String x:Key="Text.ConfigureWorkspace" xml:space="preserve">Arbeitsplätze</x:String>
267269
<x:String x:Key="Text.ConfigureWorkspace.Color" xml:space="preserve">Farbe</x:String>

src/Resources/Locales/en_US.axaml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,7 @@
205205
${BRANCH_FRIENDLY_NAME} Friendly name of selected branch, contains ${REMOTE} part for remote branches
206206
${SHA} Selected commit's hash
207207
${TAG} Selected tag
208+
${FILE} Selected file, relative to repository root
208209
$1, $2 ... Input control values</x:String>
209210
<x:String x:Key="Text.Configure.CustomAction.Executable" xml:space="preserve">Executable File:</x:String>
210211
<x:String x:Key="Text.Configure.CustomAction.InputControls" xml:space="preserve">Input Controls:</x:String>
@@ -213,6 +214,7 @@
213214
<x:String x:Key="Text.Configure.CustomAction.Scope" xml:space="preserve">Scope:</x:String>
214215
<x:String x:Key="Text.Configure.CustomAction.Scope.Branch" xml:space="preserve">Branch</x:String>
215216
<x:String x:Key="Text.Configure.CustomAction.Scope.Commit" xml:space="preserve">Commit</x:String>
217+
<x:String x:Key="Text.Configure.CustomAction.Scope.File" xml:space="preserve">File</x:String>
216218
<x:String x:Key="Text.Configure.CustomAction.Scope.Remote" xml:space="preserve">Remote</x:String>
217219
<x:String x:Key="Text.Configure.CustomAction.Scope.Repository" xml:space="preserve">Repository</x:String>
218220
<x:String x:Key="Text.Configure.CustomAction.Scope.Tag" xml:space="preserve">Tag</x:String>
@@ -256,7 +258,7 @@
256258
<x:String x:Key="Text.ConfigureCustomActionControls.Label" xml:space="preserve">Label:</x:String>
257259
<x:String x:Key="Text.ConfigureCustomActionControls.Options" xml:space="preserve">Options:</x:String>
258260
<x:String x:Key="Text.ConfigureCustomActionControls.Options.Tip" xml:space="preserve">Use '|' as delimiter for options</x:String>
259-
<x:String x:Key="Text.ConfigureCustomActionControls.StringValue.Tip" xml:space="preserve">The built-in variables ${REPO}, ${REMOTE}, ${BRANCH}, ${BRANCH_FRIENDLY_NAME}, ${SHA}, and ${TAG} remain available here</x:String>
261+
<x:String x:Key="Text.ConfigureCustomActionControls.StringValue.Tip" xml:space="preserve">The built-in variables ${REPO}, ${REMOTE}, ${BRANCH}, ${BRANCH_FRIENDLY_NAME}, ${SHA}, ${FILE}, and ${TAG} remain available here</x:String>
260262
<x:String x:Key="Text.ConfigureCustomActionControls.Type" xml:space="preserve">Type:</x:String>
261263
<x:String x:Key="Text.ConfigureWorkspace" xml:space="preserve">Workspaces</x:String>
262264
<x:String x:Key="Text.ConfigureWorkspace.Color" xml:space="preserve">Color</x:String>
@@ -385,6 +387,7 @@
385387
<x:String x:Key="Text.Fetch.Remote" xml:space="preserve">Remote:</x:String>
386388
<x:String x:Key="Text.Fetch.Title" xml:space="preserve">Fetch Remote Changes</x:String>
387389
<x:String x:Key="Text.FileCM.AssumeUnchanged" xml:space="preserve">Assume unchanged</x:String>
390+
<x:String x:Key="Text.FileCM.CustomAction" xml:space="preserve">Custom Action</x:String>
388391
<x:String x:Key="Text.FileCM.Discard" xml:space="preserve">Discard...</x:String>
389392
<x:String x:Key="Text.FileCM.DiscardMulti" xml:space="preserve">Discard {0} files...</x:String>
390393
<x:String x:Key="Text.FileCM.ResolveUsing" xml:space="preserve">Resolve Using ${0}$</x:String>

src/Resources/Locales/es_ES.axaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,7 @@
209209
${BRANCH_FRIENDLY_NAME} Nombre amigable de la rama seleccionada, contiene la parte ${REMOTE} para ramas remotas
210210
${SHA} Hash del commit seleccionado
211211
${TAG} Etiqueta seleccionada
212+
${FILE} Archivo seleccionado, relativo a la raíz del repositorio
212213
$1, $2 ... Valores de control de entrada</x:String>
213214
<x:String x:Key="Text.Configure.CustomAction.Executable" xml:space="preserve">Archivo Ejecutable:</x:String>
214215
<x:String x:Key="Text.Configure.CustomAction.InputControls" xml:space="preserve">Controles de entrada:</x:String>
@@ -217,6 +218,7 @@
217218
<x:String x:Key="Text.Configure.CustomAction.Scope" xml:space="preserve">Alcance:</x:String>
218219
<x:String x:Key="Text.Configure.CustomAction.Scope.Branch" xml:space="preserve">Rama</x:String>
219220
<x:String x:Key="Text.Configure.CustomAction.Scope.Commit" xml:space="preserve">Commit</x:String>
221+
<x:String x:Key="Text.Configure.CustomAction.Scope.File" xml:space="preserve">Archivo</x:String>
220222
<x:String x:Key="Text.Configure.CustomAction.Scope.Remote" xml:space="preserve">Remoto</x:String>
221223
<x:String x:Key="Text.Configure.CustomAction.Scope.Repository" xml:space="preserve">Repositorio</x:String>
222224
<x:String x:Key="Text.Configure.CustomAction.Scope.Tag" xml:space="preserve">Etiqueta</x:String>
@@ -260,7 +262,7 @@
260262
<x:String x:Key="Text.ConfigureCustomActionControls.Label" xml:space="preserve">Etiqueta:</x:String>
261263
<x:String x:Key="Text.ConfigureCustomActionControls.Options" xml:space="preserve">Opciones:</x:String>
262264
<x:String x:Key="Text.ConfigureCustomActionControls.Options.Tip" xml:space="preserve">Usar '|' como delimitador para las opciones</x:String>
263-
<x:String x:Key="Text.ConfigureCustomActionControls.StringValue.Tip" xml:space="preserve">La variables incorporadas ${REPO}, ${REMOTE}, ${BRANCH}, ${BRANCH_FRIENDLY_NAME}, ${SHA}, y ${TAG} permanecen disponibles aquí</x:String>
265+
<x:String x:Key="Text.ConfigureCustomActionControls.StringValue.Tip" xml:space="preserve">La variables incorporadas ${REPO}, ${REMOTE}, ${BRANCH}, ${BRANCH_FRIENDLY_NAME}, ${SHA}, ${FILE}, y ${TAG} permanecen disponibles aquí</x:String>
264266
<x:String x:Key="Text.ConfigureCustomActionControls.Type" xml:space="preserve">Tipo:</x:String>
265267
<x:String x:Key="Text.ConfigureWorkspace" xml:space="preserve">Espacios de Trabajo</x:String>
266268
<x:String x:Key="Text.ConfigureWorkspace.Color" xml:space="preserve">Color</x:String>

src/Resources/Locales/id_ID.axaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,7 @@
196196
${BRANCH_FRIENDLY_NAME} Nama ramah dari branch yang dipilih, mengandung bagian ${REMOTE} untuk remote branch
197197
${SHA} Hash commit yang dipilih
198198
${TAG} Tag yang dipilih
199+
${FILE} Berkas yang dipilih, relatif terhadap akar repositori
199200
$1, $2 ... Nilai kontrol input</x:String>
200201
<x:String x:Key="Text.Configure.CustomAction.Executable" xml:space="preserve">Berkas Eksekusi:</x:String>
201202
<x:String x:Key="Text.Configure.CustomAction.InputControls" xml:space="preserve">Kontrol Input:</x:String>
@@ -204,6 +205,7 @@
204205
<x:String x:Key="Text.Configure.CustomAction.Scope" xml:space="preserve">Lingkup:</x:String>
205206
<x:String x:Key="Text.Configure.CustomAction.Scope.Branch" xml:space="preserve">Branch</x:String>
206207
<x:String x:Key="Text.Configure.CustomAction.Scope.Commit" xml:space="preserve">Commit</x:String>
208+
<x:String x:Key="Text.Configure.CustomAction.Scope.File" xml:space="preserve">Berkas</x:String>
207209
<x:String x:Key="Text.Configure.CustomAction.Scope.Remote" xml:space="preserve">Remote</x:String>
208210
<x:String x:Key="Text.Configure.CustomAction.Scope.Repository" xml:space="preserve">Repositori</x:String>
209211
<x:String x:Key="Text.Configure.CustomAction.Scope.Tag" xml:space="preserve">Tag</x:String>

src/Resources/Locales/it_IT.axaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,7 @@
186186
${BRANCH_FRIENDLY_NAME} Nome amichevole del branch selezionato, contiene la parte ${REMOTE} per i branch remoti
187187
${SHA} Hash del commit selezionato
188188
${TAG} Tag selezionato
189+
${FILE} File selezionato, relativo alla radice del repository
189190
$1, $2 ... Valori dei controlli di input</x:String>
190191
<x:String x:Key="Text.Configure.CustomAction.Executable" xml:space="preserve">File Eseguibile:</x:String>
191192
<x:String x:Key="Text.Configure.CustomAction.InputControls" xml:space="preserve">Controlli di Input:</x:String>
@@ -194,6 +195,7 @@
194195
<x:String x:Key="Text.Configure.CustomAction.Scope" xml:space="preserve">Ambito:</x:String>
195196
<x:String x:Key="Text.Configure.CustomAction.Scope.Branch" xml:space="preserve">Branch</x:String>
196197
<x:String x:Key="Text.Configure.CustomAction.Scope.Commit" xml:space="preserve">Commit</x:String>
198+
<x:String x:Key="Text.Configure.CustomAction.Scope.File" xml:space="preserve">File</x:String>
197199
<x:String x:Key="Text.Configure.CustomAction.Scope.Remote" xml:space="preserve">Remoto</x:String>
198200
<x:String x:Key="Text.Configure.CustomAction.Scope.Repository" xml:space="preserve">Repository</x:String>
199201
<x:String x:Key="Text.Configure.CustomAction.Scope.Tag" xml:space="preserve">Tag</x:String>

src/Resources/Locales/ko_KR.axaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,7 @@
195195
${BRANCH_FRIENDLY_NAME} 선택한 브랜치의 식별하기 쉬운 이름 (원격 브랜치의 경우 ${REMOTE} 부분 포함)
196196
${SHA} 선택한 커밋의 해시
197197
${TAG} 선택한 태그
198+
${FILE} 저장소 루트에 상대적인 선택된 파일
198199
$1, $2 ... 입력 컨트롤 값</x:String>
199200
<x:String x:Key="Text.Configure.CustomAction.Executable" xml:space="preserve">실행 파일:</x:String>
200201
<x:String x:Key="Text.Configure.CustomAction.InputControls" xml:space="preserve">입력 컨트롤:</x:String>
@@ -203,6 +204,7 @@
203204
<x:String x:Key="Text.Configure.CustomAction.Scope" xml:space="preserve">범위:</x:String>
204205
<x:String x:Key="Text.Configure.CustomAction.Scope.Branch" xml:space="preserve">브랜치</x:String>
205206
<x:String x:Key="Text.Configure.CustomAction.Scope.Commit" xml:space="preserve">커밋</x:String>
207+
<x:String x:Key="Text.Configure.CustomAction.Scope.File" xml:space="preserve">파일</x:String>
206208
<x:String x:Key="Text.Configure.CustomAction.Scope.Remote" xml:space="preserve">원격</x:String>
207209
<x:String x:Key="Text.Configure.CustomAction.Scope.Repository" xml:space="preserve">저장소</x:String>
208210
<x:String x:Key="Text.Configure.CustomAction.Scope.Tag" xml:space="preserve">태그</x:String>

src/Resources/Locales/ru_RU.axaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,7 @@
209209
${BRANCH_FRIENDLY_NAME} Понятное имя выбранной ветки, содержащую ${REMOTE} удалённые ветки
210210
${SHA} Хеш выбранной ревизии
211211
${TAG} Выбранная метка
212+
${FILE} Выбранный файл, относительно корня репозитория
212213
$1, $2 ... Ввод управляющих значений</x:String>
213214
<x:String x:Key="Text.Configure.CustomAction.Executable" xml:space="preserve">Исполняемый файл:</x:String>
214215
<x:String x:Key="Text.Configure.CustomAction.InputControls" xml:space="preserve">Элементы управления вводом:</x:String>
@@ -217,6 +218,7 @@
217218
<x:String x:Key="Text.Configure.CustomAction.Scope" xml:space="preserve">Диапазон:</x:String>
218219
<x:String x:Key="Text.Configure.CustomAction.Scope.Branch" xml:space="preserve">Ветка</x:String>
219220
<x:String x:Key="Text.Configure.CustomAction.Scope.Commit" xml:space="preserve">Ревизия</x:String>
221+
<x:String x:Key="Text.Configure.CustomAction.Scope.File" xml:space="preserve">Файл</x:String>
220222
<x:String x:Key="Text.Configure.CustomAction.Scope.Remote" xml:space="preserve">Удалённый</x:String>
221223
<x:String x:Key="Text.Configure.CustomAction.Scope.Repository" xml:space="preserve">Репозиторий</x:String>
222224
<x:String x:Key="Text.Configure.CustomAction.Scope.Tag" xml:space="preserve">Метка</x:String>
@@ -260,7 +262,7 @@
260262
<x:String x:Key="Text.ConfigureCustomActionControls.Label" xml:space="preserve">Метка:</x:String>
261263
<x:String x:Key="Text.ConfigureCustomActionControls.Options" xml:space="preserve">Опции:</x:String>
262264
<x:String x:Key="Text.ConfigureCustomActionControls.Options.Tip" xml:space="preserve">Используйте разделитель «|» для опций</x:String>
263-
<x:String x:Key="Text.ConfigureCustomActionControls.StringValue.Tip" xml:space="preserve">Встроенные переменные ${REPO}, ${REMOTE}, ${BRANCH}, ${BRANCH_FRIENDLY_NAME}, ${SHA}, и ${TAG} останутся здесь доступными</x:String>
265+
<x:String x:Key="Text.ConfigureCustomActionControls.StringValue.Tip" xml:space="preserve">Встроенные переменные ${REPO}, ${REMOTE}, ${BRANCH}, ${BRANCH_FRIENDLY_NAME}, ${SHA}, ${FILE}, и ${TAG} останутся здесь доступными</x:String>
264266
<x:String x:Key="Text.ConfigureCustomActionControls.Type" xml:space="preserve">Тип:</x:String>
265267
<x:String x:Key="Text.ConfigureWorkspace" xml:space="preserve">Рабочие пространства</x:String>
266268
<x:String x:Key="Text.ConfigureWorkspace.Color" xml:space="preserve">Цвет</x:String>

src/Resources/Locales/zh_CN.axaml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,7 @@
209209
${BRANCH_FRIENDLY_NAME} 选中的分支,对于远程分支包含远程名
210210
${SHA} 选中的提交哈希
211211
${TAG} 选中的标签
212+
${FILE} 选中的文件
212213
$1, $2 ... 输入控件中填写的值</x:String>
213214
<x:String x:Key="Text.Configure.CustomAction.Executable" xml:space="preserve">可执行文件路径 :</x:String>
214215
<x:String x:Key="Text.Configure.CustomAction.InputControls" xml:space="preserve">输入控件 :</x:String>
@@ -217,6 +218,7 @@
217218
<x:String x:Key="Text.Configure.CustomAction.Scope" xml:space="preserve">作用目标 :</x:String>
218219
<x:String x:Key="Text.Configure.CustomAction.Scope.Branch" xml:space="preserve">选中的分支</x:String>
219220
<x:String x:Key="Text.Configure.CustomAction.Scope.Commit" xml:space="preserve">选中的提交</x:String>
221+
<x:String x:Key="Text.Configure.CustomAction.Scope.File" xml:space="preserve">选中的文件</x:String>
220222
<x:String x:Key="Text.Configure.CustomAction.Scope.Remote" xml:space="preserve">远程仓库</x:String>
221223
<x:String x:Key="Text.Configure.CustomAction.Scope.Repository" xml:space="preserve">仓库</x:String>
222224
<x:String x:Key="Text.Configure.CustomAction.Scope.Tag" xml:space="preserve">选中的标签</x:String>
@@ -260,7 +262,7 @@
260262
<x:String x:Key="Text.ConfigureCustomActionControls.Label" xml:space="preserve">名称 :</x:String>
261263
<x:String x:Key="Text.ConfigureCustomActionControls.Options" xml:space="preserve">选项列表 :</x:String>
262264
<x:String x:Key="Text.ConfigureCustomActionControls.Options.Tip" xml:space="preserve">选项之间请使用英文 '|' 作为分隔符</x:String>
263-
<x:String x:Key="Text.ConfigureCustomActionControls.StringValue.Tip" xml:space="preserve">内置变量 ${REPO}, ${REMOTE}, ${BRANCH}, ${BRANCH_FRIENDLY_NAME}, ${SHA} 与 ${TAG} 在这里仍然可用</x:String>
265+
<x:String x:Key="Text.ConfigureCustomActionControls.StringValue.Tip" xml:space="preserve">内置变量 ${REPO}, ${REMOTE}, ${BRANCH}, ${BRANCH_FRIENDLY_NAME}, ${SHA}, ${FILE} 与 ${TAG} 在这里仍然可用</x:String>
264266
<x:String x:Key="Text.ConfigureCustomActionControls.Type" xml:space="preserve">类型 :</x:String>
265267
<x:String x:Key="Text.ConfigureWorkspace" xml:space="preserve">工作区</x:String>
266268
<x:String x:Key="Text.ConfigureWorkspace.Color" xml:space="preserve">颜色</x:String>
@@ -389,6 +391,7 @@
389391
<x:String x:Key="Text.Fetch.Remote" xml:space="preserve">远程仓库 :</x:String>
390392
<x:String x:Key="Text.Fetch.Title" xml:space="preserve">拉取远程仓库内容</x:String>
391393
<x:String x:Key="Text.FileCM.AssumeUnchanged" xml:space="preserve">不跟踪此文件的更改</x:String>
394+
<x:String x:Key="Text.FileCM.CustomAction" xml:space="preserve">自定义操作</x:String>
392395
<x:String x:Key="Text.FileCM.Discard" xml:space="preserve">放弃更改...</x:String>
393396
<x:String x:Key="Text.FileCM.DiscardMulti" xml:space="preserve">放弃 {0} 个文件的更改...</x:String>
394397
<x:String x:Key="Text.FileCM.ResolveUsing" xml:space="preserve">应用 ${0}$</x:String>

0 commit comments

Comments
 (0)