mirror of
https://github.com/sourcegit-scm/sourcegit.git
synced 2024-12-24 20:57:19 -08:00
code_review: PR #589
* do not using namespace `SourceGit.*` * should use branch instead of repository
This commit is contained in:
parent
1855b43750
commit
728d003717
2 changed files with 3 additions and 4 deletions
|
@ -4,7 +4,6 @@ using System.Text;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
|
|
||||||
using CommunityToolkit.Mvvm.ComponentModel;
|
using CommunityToolkit.Mvvm.ComponentModel;
|
||||||
using SourceGit.ViewModels;
|
|
||||||
|
|
||||||
namespace SourceGit.Models
|
namespace SourceGit.Models
|
||||||
{
|
{
|
||||||
|
@ -25,11 +24,11 @@ namespace SourceGit.Models
|
||||||
set => SetProperty(ref _content, value);
|
set => SetProperty(ref _content, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
public string Apply(Repository repo, List<Change> changes)
|
public string Apply(Branch branch, List<Change> changes)
|
||||||
{
|
{
|
||||||
var content = _content
|
var content = _content
|
||||||
.Replace("${files_num}", $"{changes.Count}")
|
.Replace("${files_num}", $"{changes.Count}")
|
||||||
.Replace("${branch_name}", repo.CurrentBranch.Name);
|
.Replace("${branch_name}", branch.Name);
|
||||||
|
|
||||||
var matches = REG_COMMIT_TEMPLATE_FILES().Matches(content);
|
var matches = REG_COMMIT_TEMPLATE_FILES().Matches(content);
|
||||||
if (matches.Count == 0)
|
if (matches.Count == 0)
|
||||||
|
|
|
@ -1157,7 +1157,7 @@ namespace SourceGit.ViewModels
|
||||||
item.Icon = App.CreateMenuIcon("Icons.Code");
|
item.Icon = App.CreateMenuIcon("Icons.Code");
|
||||||
item.Click += (_, e) =>
|
item.Click += (_, e) =>
|
||||||
{
|
{
|
||||||
CommitMessage = template.Apply(_repo, _staged);
|
CommitMessage = template.Apply(_repo.CurrentBranch, _staged);
|
||||||
e.Handled = true;
|
e.Handled = true;
|
||||||
};
|
};
|
||||||
menu.Items.Add(item);
|
menu.Items.Add(item);
|
||||||
|
|
Loading…
Reference in a new issue