feature: support add custom actions for selected branch (#980)

Signed-off-by: leo <longshuang@msn.cn>
This commit is contained in:
leo 2025-02-14 10:43:08 +08:00
parent 9b07034846
commit 9104060d79
No known key found for this signature in database
7 changed files with 73 additions and 22 deletions

View file

@ -10,13 +10,26 @@ namespace SourceGit.ViewModels
private set;
}
public ExecuteCustomAction(Repository repo, Models.CustomAction action, Models.Commit commit)
public ExecuteCustomAction(Repository repo, Models.CustomAction action)
{
_repo = repo;
_args = action.Arguments.Replace("${REPO}", _repo.FullPath);
if (commit != null)
_args = _args.Replace("${SHA}", commit.SHA);
CustomAction = action;
View = new Views.ExecuteCustomAction() { DataContext = this };
}
public ExecuteCustomAction(Repository repo, Models.CustomAction action, Models.Branch branch)
{
_repo = repo;
_args = action.Arguments.Replace("${REPO}", _repo.FullPath).Replace("${BRANCH}", branch.FriendlyName);
CustomAction = action;
View = new Views.ExecuteCustomAction() { DataContext = this };
}
public ExecuteCustomAction(Repository repo, Models.CustomAction action, Models.Commit commit)
{
_repo = repo;
_args = action.Arguments.Replace("${REPO}", _repo.FullPath).Replace("${SHA}", commit.SHA);
CustomAction = action;
View = new Views.ExecuteCustomAction() { DataContext = this };
}