mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-06-16 16:05:00 +00:00
refactor: rewrite git-flow integration
Signed-off-by: leo <longshuang@msn.cn>
This commit is contained in:
parent
6fa454ace8
commit
4d5be9f280
9 changed files with 197 additions and 166 deletions
46
src/Models/GitFlow.cs
Normal file
46
src/Models/GitFlow.cs
Normal file
|
@ -0,0 +1,46 @@
|
|||
namespace SourceGit.Models
|
||||
{
|
||||
public enum GitFlowBranchType
|
||||
{
|
||||
None = 0,
|
||||
Feature,
|
||||
Release,
|
||||
Hotfix,
|
||||
}
|
||||
|
||||
public class GitFlow
|
||||
{
|
||||
public string Master { get; set; } = string.Empty;
|
||||
public string Develop { get; set; } = string.Empty;
|
||||
public string FeaturePrefix { get; set; } = string.Empty;
|
||||
public string ReleasePrefix { get; set; } = string.Empty;
|
||||
public string HotfixPrefix { get; set; } = string.Empty;
|
||||
|
||||
public bool IsValid
|
||||
{
|
||||
get
|
||||
{
|
||||
return !string.IsNullOrEmpty(Master) &&
|
||||
!string.IsNullOrEmpty(Develop) &&
|
||||
!string.IsNullOrEmpty(FeaturePrefix) &&
|
||||
!string.IsNullOrEmpty(ReleasePrefix) &&
|
||||
!string.IsNullOrEmpty(HotfixPrefix);
|
||||
}
|
||||
}
|
||||
|
||||
public string GetPrefix(GitFlowBranchType type)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case GitFlowBranchType.Feature:
|
||||
return FeaturePrefix;
|
||||
case GitFlowBranchType.Release:
|
||||
return ReleasePrefix;
|
||||
case GitFlowBranchType.Hotfix:
|
||||
return HotfixPrefix;
|
||||
default:
|
||||
return string.Empty;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue