2024-03-17 18:37:06 -07:00
|
|
|
|
namespace SourceGit.Models
|
|
|
|
|
{
|
|
|
|
|
public enum GitFlowBranchType
|
|
|
|
|
{
|
2021-04-29 05:05:55 -07:00
|
|
|
|
None,
|
|
|
|
|
Feature,
|
|
|
|
|
Release,
|
|
|
|
|
Hotfix,
|
|
|
|
|
}
|
|
|
|
|
|
2024-03-17 18:37:06 -07:00
|
|
|
|
public class GitFlow
|
|
|
|
|
{
|
2021-04-29 05:05:55 -07:00
|
|
|
|
public string Feature { get; set; }
|
|
|
|
|
public string Release { get; set; }
|
|
|
|
|
public string Hotfix { get; set; }
|
|
|
|
|
|
2024-03-17 18:37:06 -07:00
|
|
|
|
public bool IsEnabled
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
2021-04-29 05:05:55 -07:00
|
|
|
|
return !string.IsNullOrEmpty(Feature)
|
|
|
|
|
&& !string.IsNullOrEmpty(Release)
|
|
|
|
|
&& !string.IsNullOrEmpty(Hotfix);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2024-03-17 18:37:06 -07:00
|
|
|
|
public GitFlowBranchType GetBranchType(string name)
|
|
|
|
|
{
|
2021-04-29 05:05:55 -07:00
|
|
|
|
if (!IsEnabled) return GitFlowBranchType.None;
|
|
|
|
|
if (name.StartsWith(Feature)) return GitFlowBranchType.Feature;
|
|
|
|
|
if (name.StartsWith(Release)) return GitFlowBranchType.Release;
|
|
|
|
|
if (name.StartsWith(Hotfix)) return GitFlowBranchType.Hotfix;
|
|
|
|
|
return GitFlowBranchType.None;
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-03-17 18:37:06 -07:00
|
|
|
|
}
|